Transferred from the Adobe Open Source Subversion Repository

Revision: 16696
Author:   cframpto@adobe.com
Date:     2010-06-28T14:48:27.485336Z

Log Message:
-----------
The following changes apply to Spark DataGrid only.   Code reviews have been deferred until the implementation is closer to completion.

Initial pass at getting the column header bar mouse event handlers framework set up for both header and separator events.  The header events use the grid events and there is a new set of events for the separators (in GridEvent for now).  In Grid, added resizeableColumns.  For a column to resize, this must be true and the individual column must be resizeable.  Added getColumnIndexAt() to GridLayout.  Added columnResizeIndicator to the CHB skin.

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Grid.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/events/GridEvent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/ColumnHeaderBar.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ColumnHeaderBarSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/GridLayout.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1279043 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/GridColumnHeaderGroup.as
+++ frameworks/projects/spark/src/spark/components/GridColumnHeaderGroup.as
@@ -11,822 +11,1386 @@

 package spark.components
 {
-import flash.events.Event;
-import flash.events.MouseEvent;
-import flash.geom.Point;
+    import flash.events.Event;
+    import flash.events.MouseEvent;
+    import flash.geom.Point;
+    import flash.geom.Rectangle;
+
+    import mx.collections.IList;
+    import mx.core.ClassFactory;
+    import mx.core.IFactory;
+    import mx.core.IInvalidating;
+    import mx.core.IVisualElement;
+    import mx.core.UIComponent;
+    import mx.core.mx_internal;
+    import mx.managers.CursorManager;
+    import mx.managers.CursorManagerPriority;
+    import mx.managers.IFocusManagerComponent;
+
+    import spark.components.supportClasses.ColumnHeaderBarLayout;
+    import spark.components.supportClasses.DefaultColumnHeaderRenderer;
+    import spark.components.supportClasses.GridColumn;
+    import spark.components.supportClasses.GridDimensions;
+    import spark.events.GridEvent;
+    import spark.events.RendererExistenceEvent;
+    import spark.utils.LabelUtil;
+    import spark.utils.MouseEventUtil;
+
+    use namespace mx_internal;
+    //--------------------------------------
+    //  Events
+    //--------------------------------------
+
+    /**
+     *  Dispatched when the mouse button is pressed over a column header.
+     *
+     *  @eventType spark.events.GridEvent.GRID_MOUSE_DOWN
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridMouseDown", type="spark.events.GridEvent")]
+
+
+    /**
+     *  Dispatched after a GRID_MOUSE_DOWN event if the mouse moves before the button is released.
+     *
+     *  @eventType spark.events.GridEvent.GRID_MOUSE_DRAG
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridMouseDrag", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched after a GRID_MOUSE_DOWN event when the mouse button is released, even
+     *  if the mouse is no longer within the ColumnHeaderBar.
+     *
+     *  @eventType spark.events.GridEvent.GRID_MOUSE_UP
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridMouseUp", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse enters a column header.
+     *
+     *  @eventType spark.events.GridEvent.GRID_ROLL_OVER
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridRollOver", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse leaves a column header.
+     *
+     *  @eventType spark.events.GridEvent.GRID_ROLL_OUT
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridRollOut", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse is clicked over a column header.
+     *
+     *  @eventType spark.events.GridEvent.GRID_CLICK
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridClick", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse is double-clicked over a column header.
+     *
+     *  @eventType spark.events.GridEvent.GRID_DOUBLE_CLICK
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridDoubleClick", type="spark.events.GridEvent")]
+
+
+    /**
+     *  Dispatched when the mouse button is pressed over a column header.
+     *
+     *  @eventType spark.events.GridEvent.GRID_MOUSE_DOWN
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="gridMouseDown", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched after a SEPARATOR_MOUSE_DOWN event if the mouse moves before
+     *  the button is released.
+     *
+     *  @eventType spark.events.GridEvent.SEPARATOR_MOUSE_DRAG
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="separatorMouseDrag", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched after a SEPARATOR_MOUSE_DOWN event when the mouse button is
+     *  released, even if the mouse is no longer within the separator affordance.
+     *
+     *  @eventType spark.events.GridEvent.SEPARATOR_MOUSE_UP
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="separatorMouseUp", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse is over a column header separator.
+     *
+     *  @eventType spark.events.GridEvent.SEPARATOR_ROLL_OVER
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="separatorRollOver", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse leaves a column header separator.
+     *
+     *  @eventType spark.events.GridEvent.SEPARATOR_ROLL_OUT
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    [Event(name="separatorRollOut", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse is clicked over a column header separator.
+     *
+     *  @eventType spark.events.GridEvent.SEPARATOR_CLICK
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    //[Event(name="separatorClick", type="spark.events.GridEvent")]
+
+    /**
+     *  Dispatched when the mouse is double-clicked over a column
+     *  header separator.
+     *
+     *  @eventType spark.events.GridEvent.SEPARATOR_DOUBLE_CLICK
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    //[Event(name="separatorDoubleClick", type="spark.events.GridEvent")]
+
+    //--------------------------------------
+    //  Other metadata
+    //--------------------------------------

-import mx.collections.IList;
-import mx.core.ClassFactory;
-import mx.core.IFactory;
-import mx.core.IVisualElement;
-import mx.core.mx_internal;
-import mx.managers.CursorManager;
-import mx.managers.IFocusManagerComponent;
-
-import spark.components.supportClasses.ColumnHeaderBarLayout;
-import spark.components.supportClasses.DefaultColumnHeaderRenderer;
-import spark.components.supportClasses.GridColumn;
-import spark.events.RendererExistenceEvent;
-import spark.utils.LabelUtil;
-
-use namespace mx_internal;
-
-[IconFile("ColumnHeaderBar.png")]
-
-/**
- * Questions:
- *  - Should you be able to tab to the ColumnHeaderBar?
- *  - How about to each item within the bar?
- *  - Should you be able to move between the items using the keyboard?
- *  - Contract between Grid and ColumnHeaderBar?
- *  - how is the column width determined?
- *  - how does the ColumnHeaderBar find out about column changes?
- *  - do column headers support word-wrap thru skinning?
- *  - If we allow developers to provide custom item renderers that either extend
- *      ItemRenderer or implement IItemRenderer directly, we'll be inheriting
- *      ItemRenderer's 7 states (see ItemRenderer/getCurrentRendererState()).
- *      That means that developers will not be able to configure the renderer
- *      based on its column's sort-direction.  That's probably not going to
- *      work, which means that we'll need a ColumnHeaderRenderer subclass of
- *      ItemRenderer that adds extra states.
- */
-
-/**
- *  The ColumnHeaderBar control defines
- *
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 2.0
- *  @productversion Flex 4.5
- */
-public class ColumnHeaderBar extends SkinnableDataContainer
-    implements IFocusManagerComponent
-{
-    include "../core/Version.as";
-
-    //--------------------------------------------------------------------------
-    //
-    //  Constructor
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  Constructor.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    public function ColumnHeaderBar()
+    [IconFile("ColumnHeaderBar.png")]
+
+    /**
+     *  The ColumnHeaderBar control defines
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    public class ColumnHeaderBar extends SkinnableDataContainer
+        implements IFocusManagerComponent
     {
-        super();
+        include "../core/Version.as";
+
+        //--------------------------------------------------------------------------
+        //
+        //  Constructor
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function ColumnHeaderBar()
+        {
+            super();
+
+            layout = new ColumnHeaderBarLayout();
+            layout.useVirtualLayout = true;
+            layout.clipAndEnableScrolling = true;
+
+            itemRendererFunction = defaultColumnHeaderBarItemRendererFunction;
+
+            MouseEventUtil.addDownDragUpListeners(this,
+                chb_mouseDownDragUpHandler,
+                chb_mouseDownDragUpHandler,
+                chb_mouseDownDragUpHandler);
+
+            addEventListener(MouseEvent.MOUSE_MOVE, chb_mouseMoveHandler);
+            addEventListener(MouseEvent.ROLL_OUT, chb_mouseRollOutHandler);
+            addEventListener(MouseEvent.CLICK, chb_clickHandler);
+            addEventListener(MouseEvent.DOUBLE_CLICK, chb_doubleClickHandler);
+
+            addEventListener(GridEvent.GRID_MOUSE_DOWN, header_mouseDownHandler);
+            addEventListener(GridEvent.GRID_ROLL_OVER, header_rollOverHandler);
+            addEventListener(GridEvent.GRID_ROLL_OUT, header_rollOutHandler);
+
+            addEventListener(GridEvent.SEPARATOR_MOUSE_DOWN, sep_mouseDownHandler);
+            addEventListener(GridEvent.SEPARATOR_ROLL_OVER, sep_rollOverHandler);
+            addEventListener(GridEvent.SEPARATOR_ROLL_OUT, sep_rollOutHandler);
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Skin Parts
+        //
+        //--------------------------------------------------------------------------
+
+        //----------------------------------
+        //  columnResizeIndicator
+        //----------------------------------
+
+        [SkinPart(required="false", type="flash.display.DisplayObject")]
+
+        /**
+         *  A skin part that defines the appearance of the column resize indicator.
+         *  The column resize indicator is resized and positioned by the layout
+         *  to ... TBD
+         *
+         *
By default, the column resize indicator for a is a solid line that
+         *  spans the height of the control.
+         *  Create a custom column resize indicator by creating a custom skin class for the drop target.
+         *  In your skin class, create a skin part named columnResizeIndicator,
+         *  in the <fx:Declarations> area of the skin class

+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.0
+         *  @productversion Flex 4
+         */
+        public var columnResizeIndicator:IFactory;
+
+        //--------------------------------------------------------------------------
+        //
+        //  Class variables
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         */
+        public var overlayGroup:Group;
+
+        /**
+         *  @private
+         */
+        private var resizeCursorID:int = CursorManager.NO_CURSOR;
+
+        /**
+         *  @private
+         *  Additional affordance given to header separators.
+         *  TBD: should this be configurable?
+         */
+        private var separatorAffordance:Number = 3;
+
+        //--------------------------------------------------------------------------
+        //
+        //  Properties
+        //
+        //--------------------------------------------------------------------------
+
+        //----------------------------------
+        //  firstItemRenderer
+        //----------------------------------
+
+        private var _firstItemRenderer:IFactory = null;
+
+        [Bindable("firstItemRendererChanged")]
+
+        /**
+         *  A factory for IItemRenderers used to render the header for the first
+         *  grid columns.  If not specified, the column header bar's
+         *  headerItemRenderer is return.
+         *
+         *  @default The value of the firstItemRenderer, or the headerItemRenderer,
+         *  if this has not been set.
+         *
+         *  @see #dataField
+         *  @see GridItemRenderer
+         */
+        public function get firstItemRenderer():IFactory
+        {
+            return (_firstItemRenderer) ? _firstItemRenderer : itemRenderer;
+        }
+
+        /**
+         *  @private
+         */
+        public function set firstItemRenderer(value:IFactory):void
+        {
+            if (_firstItemRenderer == value)
+                return;
+
+            _firstItemRenderer = value;
+
+            // Force the itemRenderers to be recreated.
+            super.itemRenderer = super.itemRenderer;
+
+            dispatchChangeEvent("firstItemRendererChanged");
+        }
+
+        //----------------------------------
+        //  headerSeparator
+        //----------------------------------
+
+        [Bindable("headerSeparatorChanged")]
+
+        private var _headerSeparator:IFactory = null;
+
+        /**
+         *  A visual element that's displayed in between each column.
+         *
+         *  @default null
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4.5
+         */
+        public function get headerSeparator():IFactory
+        {
+            return _headerSeparator;
+        }
+
+        /**
+         *  @private
+         */
+        public function set headerSeparator(value:IFactory):void
+        {
+            if (_headerSeparator == value)
+                return;
+
+            _headerSeparator = value;
+
+            invalidateDisplayList();
+
+            dispatchChangeEvent("headerSeparatorChanged");
+        }
+
+        //----------------------------------
+        //  horizontalScrollPosition
+        //----------------------------------
+
+        private var _horizontalScrollPosition:int;
+
+        public function get horizontalScrollPosition():Number
+        {
+            return dataGroup ?
+                   dataGroup.horizontalScrollPosition : _horizontalScrollPosition;
+        }
+
+        /**
+         *  @private
+         */
+        public function set horizontalScrollPosition(value:Number):void
+        {
+            // If there is no layout, dataGroup caches this.
+            if (dataGroup)
+                dataGroup.horizontalScrollPosition = value;
+            else
+                _horizontalScrollPosition = value;
+        }
+
+        //----------------------------------
+        //  labelField
+        //----------------------------------
+
+        /**
+         *  @private
+         */
+        private var _labelField:String = "headerText";
+
+        /**
+         *  @private
+         */
+        private var labelFieldOrFunctionChanged:Boolean;
+
+        /**
+         *  The name of the field in the data provider items to display
+         *  as the header label.
+         *  The labelFunction property overrides this property.
+         *
+         *  @default "headerText"
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2
+         *  @productversion Flex 4.5
+         */
+        public function get labelField():String
+        {
+            return _labelField;
+        }
+
+        /**
+         *  @private
+         */
+        public function set labelField(value:String):void
+        {
+            if (value == _labelField)
+                return

-        layout = new ColumnHeaderBarLayout();
-        layout.useVirtualLayout = true;
-        layout.clipAndEnableScrolling = true;
-
-        itemRendererFunction = defaultColumnHeaderBarItemRendererFunction;
-
-        addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
-        addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
-        addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
-
-/*
-        MouseEventUtil.addDownDragUpListeners(this,
-                                        mouseDownDragUpHandler,
-                                        mouseDownDragUpHandler,
-                                        mouseDownDragUpHandler);
-*/
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Class variables
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     */
-    public var overlayGroup:Group;
-
-    /**
-     *  @private
-     */
-    private var resizeCursorID:int = CursorManager.NO_CURSOR;
-
-    //--------------------------------------------------------------------------
-    //
-    //  Properties
-    //
-    //--------------------------------------------------------------------------
-
-    //----------------------------------
-    //  firstItemRenderer
-    //----------------------------------
-
-    private var _firstItemRenderer:IFactory = null;
-
-    [Bindable("firstItemRendererChanged")]
-
-    /**
-     *  A factory for IItemRenderers used to render the header for the first
-     *  grid columns.  If not specified, the column header bar's
-     *  headerItemRenderer is return.
-     *
-     *  @default The value of the firstItemRenderer, or the headerItemRenderer,
-     *  if this has not been set.
-     *
-     *  @see #dataField
-     *  @see GridItemRenderer
-     */
-    public function get firstItemRenderer():IFactory
-    {
-        return (_firstItemRenderer) ? _firstItemRenderer : itemRenderer;
-    }
-
-    /**
-     *  @private
-     */
-    public function set firstItemRenderer(value:IFactory):void
-    {
-        if (_firstItemRenderer == value)
-            return;
-
-        _firstItemRenderer = value;
-
-        // Force the itemRenderers to be recreated.
-        super.itemRenderer = super.itemRenderer;
-
-        dispatchChangeEvent("firstItemRendererChanged");
-    }
+            _labelField = value;
+            labelFieldOrFunctionChanged = true;
+            invalidateProperties();
+        }
+
+        //----------------------------------
+        //  labelFunction
+        //----------------------------------
+
+        /**
+         *  @private
+         */
+        private var _labelFunction:Function;
+
+        /**
+         *  A user-supplied function to run on each item to determine its label.
+         *  The labelFunction property overrides
+         *  the labelField property.
+         *
+         *
You can supply a labelFunction that finds the
+         *  appropriate fields and returns a displayable string. The
+         *  labelFunction is also good for handling formatting and
+         *  localization.

+         *
+         *
The label function takes a single argument which is the item in
+         *  the data provider and returns a String.

+         *

+         *  myLabelFunction(item:Object):String

+         *
+         *  @default null
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2
+         *  @productversion Flex 4.5
+         */
+        public function get labelFunction():Function
+        {
+            return _labelFunction;
+        }
+
+        /**
+         *  @private
+         */
+        public function set labelFunction(value:Function):void
+        {
+            if (value == _labelFunction)
+                return

-    //----------------------------------
-    //  headerSeparator
-    //----------------------------------
-
-    [Bindable("headerSeparatorChanged")]
-
-    private var _headerSeparator:IFactory = null;
-
-    /**
-     *  A visual element that's displayed in between each column.
-     *
-     *  @default null
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4.5
-     */
-    public function get headerSeparator():IFactory
-    {
-        return _headerSeparator;
-    }
-
-    /**
-     *  @private
-     */
-    public function set headerSeparator(value:IFactory):void
-    {
-        if (_headerSeparator == value)
-            return;
-
-        _headerSeparator = value;
-
-        invalidateDisplayList();
-
-        dispatchChangeEvent("headerSeparatorChanged");
-    }
-
-    //----------------------------------
-    //  horizontalScrollPosition
-    //----------------------------------
-
-    private var _horizontalScrollPosition:int;
-
-    public function get horizontalScrollPosition():Number
-    {
-        return dataGroup ?
-               dataGroup.horizontalScrollPosition : _horizontalScrollPosition;
-    }
-
-    /**
-     *  @private
-     */
-    public function set horizontalScrollPosition(value:Number):void
-    {
-        // If there is no layout, dataGroup caches this.
-        if (dataGroup)
-            dataGroup.horizontalScrollPosition = value;
-        else
-            _horizontalScrollPosition = value;
-    }
-
-    //----------------------------------
-    //  labelField
-    //----------------------------------
-
-    /**
-     *  @private
-     */
-    private var _labelField:String = "headerText";
-
-    /**
-     *  @private
-     */
-    private var labelFieldOrFunctionChanged:Boolean;
-
-    /**
-     *  The name of the field in the data provider items to display
-     *  as the header label.
-     *  The labelFunction property overrides this property.
-     *
-     *  @default "headerText"
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 2
-     *  @productversion Flex 4.5
-     */
-    public function get labelField():String
-    {
-        return _labelField;
-    }
-
-    /**
-     *  @private
-     */
-    public function set labelField(value:String):void
-    {
-        if (value == _labelField)
-            return
-
-        _labelField = value;
-        labelFieldOrFunctionChanged = true;
-        invalidateProperties();
-    }
-
-    //----------------------------------
-    //  labelFunction
-    //----------------------------------
-
-    /**
-     *  @private
-     */
-    private var _labelFunction:Function;
-
-    /**
-     *  A user-supplied function to run on each item to determine its label.
-     *  The labelFunction property overrides
-     *  the labelField property.
-     *
-     *
You can supply a labelFunction that finds the
-     *  appropriate fields and returns a displayable string. The
-     *  labelFunction is also good for handling formatting and
-     *  localization.

-     *
-     *
The label function takes a single argument which is the item in
-     *  the data provider and returns a String.

-     *

-     *  myLabelFunction(item:Object):String

-     *
-     *  @default null
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 2
-     *  @productversion Flex 4.5
-     */
-    public function get labelFunction():Function
-    {
-        return _labelFunction;
-    }
-
-    /**
-     *  @private
-     */
-    public function set labelFunction(value:Function):void
-    {
-        if (value == _labelFunction)
-            return
-
-            _labelFunction = value;
-        labelFieldOrFunctionChanged = true;
-        invalidateProperties();
-    }
-
-    //----------------------------------
-    //  lastItemRenderer
-    //----------------------------------
-
-    private var _lastItemRenderer:IFactory = null;
-
-    [Bindable("lastItemRendererChanged")]
-
-    /**
-     *  A factory for IItemRenderers used to render the header for the last
-     *  grid columns.  If not specified, the column header bar's
-     *  itemRenderer is return.
-     *
-     *  @default The value of the lastItemRenderer, or the itemRenderer,
-     *  if this has not been set.
-     *
-     *  @see #dataField
-     *  @see GridItemRenderer
-     */
-    public function get lastItemRenderer():IFactory
-    {
-        return (_lastItemRenderer) ? _lastItemRenderer : itemRenderer;
-    }
-
-    /**
-     *  @private
-     */
-    public function set lastItemRenderer(value:IFactory):void
-    {
-        if (_lastItemRenderer == value)
-            return;
-
-        _lastItemRenderer = value;
-
-        // Force the itemRenderers to be recreated.
-        super.itemRenderer = super.itemRenderer;
-
-        dispatchChangeEvent("lastItemRendererChanged");
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Overridden Properties
-    //
-    //--------------------------------------------------------------------------
-
-    //----------------------------------
-    //  dataProvider
-    //----------------------------------
-
-    /**
-     *  TBD: this is for the column headers
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    override public function set dataProvider(value:IList):void
-    {
-        //if (dataProvider)
-        //    dataProvider.removeEventListener(CollectionEvent.COLLECTION_CHANGE, dataProvider_collectionChangeHandler);
+                _labelFunction = value;
+            labelFieldOrFunctionChanged = true;
+            invalidateProperties();
+        }
+
+        //----------------------------------
+        //  lastItemRenderer
+        //----------------------------------
+
+        private var _lastItemRenderer:IFactory = null;
+
+        [Bindable("lastItemRendererChanged")]
+
+        /**
+         *  A factory for IItemRenderers used to render the header for the last
+         *  grid columns.  If not specified, the column header bar's
+         *  itemRenderer is return.
+         *
+         *  @default The value of the lastItemRenderer, or the itemRenderer,
+         *  if this has not been set.
+         *
+         *  @see #dataField
+         *  @see GridItemRenderer
+         */
+        public function get lastItemRenderer():IFactory
+        {
+            return (_lastItemRenderer) ? _lastItemRenderer : itemRenderer;
+        }
+
+        /**
+         *  @private
+         */
+        public function set lastItemRenderer(value:IFactory):void
+        {
+            if (_lastItemRenderer == value)
+                return;
+
+            _lastItemRenderer = value;
+
+            // Force the itemRenderers to be recreated.
+            super.itemRenderer = super.itemRenderer;
+
+            dispatchChangeEvent("lastItemRendererChanged");
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Overridden Properties
+        //
+        //--------------------------------------------------------------------------
+
+        //----------------------------------
+        //  dataProvider
+        //----------------------------------
+
+        /**
+         *  TBD: this is for the column headers
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        override public function set dataProvider(value:IList):void
+        {
+            //if (dataProvider)
+            //    dataProvider.removeEventListener(CollectionEvent.COLLECTION_CHANGE, dataProvider_collectionChangeHandler);
+
+            // ensure that our listener is added before the dataGroup which adds a listener during
+            // the base class setter if the dataGroup already exists.  If the dataGroup isn't
+            // created yet, then we still be first.
+            //if (value)
+            //    value.addEventListener(CollectionEvent.COLLECTION_CHANGE, dataProvider_collectionChangeHandler);
+
+            super.dataProvider = value;
+        }
+
+        //----------------------------------
+        //  itemRenderer
+        //----------------------------------
+
+        private var _itemRenderer:IFactory = null;
+
+        [Bindable("itemRendererChanged")]
+
+        /**
+         *  A factory for IItemRenderers used to render the header for the
+         *  grid columns.  If not specified, the
+         *  DefaultColumnHeaderRenderer is returned.
+         *
+         *
The default item renderer just displays the value of its
+         *  label property, which is based on the dataProvider item for
+         *  the column, and on the column's headerText property.  Custom item
+         *  renderers that derive more values from the column item and include
+         *  more complex visuals are easily created by subclassing
+         *  ItemRenderer.

+         *
+         *  @default The value of the headerItemRenderer.
+         *
+         *  @see DefaultColumnHeaderRenderer
+         */
+        override public function get itemRenderer():IFactory
+        {
+            if (!_itemRenderer)
+                _itemRenderer = new ClassFactory(DefaultColumnHeaderRenderer);
+
+            return _itemRenderer;
+        }
+
+        /**
+         *  @private
+         */
+        override public function set itemRenderer(value:IFactory):void
+        {
+            if (_itemRenderer == value)
+                return;
+
+            _itemRenderer = value;
+
+            dispatchChangeEvent("itemRendererChanged");
+        }

-        // ensure that our listener is added before the dataGroup which adds a listener during
-        // the base class setter if the dataGroup already exists.  If the dataGroup isn't
-        // created yet, then we still be first.
-        //if (value)
-        //    value.addEventListener(CollectionEvent.COLLECTION_CHANGE, dataProvider_collectionChangeHandler);
-
-        super.dataProvider = value;
-    }
-
-    //----------------------------------
-    //  itemRenderer
-    //----------------------------------
-
-    private var _itemRenderer:IFactory = null;
-
-    [Bindable("itemRendererChanged")]
-
-    /**
-     *  A factory for IItemRenderers used to render the header for the
-     *  grid columns.  If not specified, the
-     *  DefaultColumnHeaderRenderer is returned.
-     *
-     *
The default item renderer just displays the value of its
-     *  label property, which is based on the dataProvider item for
-     *  the column, and on the column's headerText property.  Custom item
-     *  renderers that derive more values from the column item and include
-     *  more complex visuals are easily created by subclassing
-     *  ItemRenderer.

-     *
-     *  @default The value of the headerItemRenderer.
-     *
-     *  @see DefaultColumnHeaderRenderer
-     */
-    override public function get itemRenderer():IFactory
-    {
-        if (!_itemRenderer)
-            _itemRenderer = new ClassFactory(DefaultColumnHeaderRenderer);
-
-        return _itemRenderer;
-    }
-
-    /**
-     *  @private
-     */
-    override public function set itemRenderer(value:IFactory):void
-    {
-        if (_itemRenderer == value)
-            return;
-
-        _itemRenderer = value;
-
-        dispatchChangeEvent("itemRendererChanged");
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Overridden Methods
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     */
-    override protected function partAdded(partName:String, instance:Object):void
-    {
-        super.partAdded(partName, instance);
-
-        if (instance == dataGroup)
-        {
-            overlayGroup = new Group();
-            overlayGroup.layout = null;
-            dataGroup.overlay.addDisplayObject(overlayGroup);
-
-            dataGroup.horizontalScrollPosition = _horizontalScrollPosition;
-            dataGroup.addEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
-            dataGroup.addEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
-        }
-    }
-
-    /**
-     * @private
-     */
-    override protected function partRemoved(partName:String, instance:Object):void
-    {
-        if (instance == dataGroup)
-        {
-            dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
-            dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
-            horizontalScrollPosition = 0;
-
-            overlayGroup = null;
-        }
-
-        super.partRemoved(partName, instance);
-    }
-
-    /**
-     *  @private
-     */
-    override protected function commitProperties():void
-    {
-        if (labelFieldOrFunctionChanged)
-        {
-            // Cycle through all instantiated renderers to push the correct text
-            // in to the renderer by setting its label property
-            if (dataGroup)
+        //--------------------------------------------------------------------------
+        //
+        //  Overridden Methods
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         */
+        override protected function partAdded(partName:String, instance:Object):void
+        {
+            super.partAdded(partName, instance);
+
+            if (instance == dataGroup)
+            {
+                overlayGroup = new Group();
+                overlayGroup.layout = null;
+                dataGroup.overlay.addDisplayObject(overlayGroup);
+
+                dataGroup.horizontalScrollPosition = _horizontalScrollPosition;
+                dataGroup.addEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
+                dataGroup.addEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
+            }
+        }
+
+        /**
+         * @private
+         */
+        override protected function partRemoved(partName:String, instance:Object):void
+        {
+            if (instance == dataGroup)
             {
-                var itemIndex:int;
+                dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
+                dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
+                horizontalScrollPosition = 0;

-                // if virtual layout, only loop through the indices in view
-                // otherwise, loop through all of the item renderers
-                if (layout && layout.useVirtualLayout)
+                overlayGroup = null;
+            }
+
+            super.partRemoved(partName, instance);
+        }
+
+        /**
+         *  @private
+         */
+        override protected function commitProperties():void
+        {
+            if (labelFieldOrFunctionChanged)
+            {
+                // Cycle through all instantiated renderers to push the correct text
+                // in to the renderer by setting its label property
+                if (dataGroup)
                 {
-                    for each (itemIndex in dataGroup.getItemIndicesInView())
+                    var itemIndex:int;
+
+                    // if virtual layout, only loop through the indices in view
+                    // otherwise, loop through all of the item renderers
+                    if (layout && layout.useVirtualLayout)
                     {
-                        updateRendererLabelProperty(itemIndex);
+                        for each (itemIndex in dataGroup.getItemIndicesInView())
+                        {
+                            updateRendererLabelProperty(itemIndex);
+                        }
+                    }
+                    else
+                    {
+                        var n:int = dataGroup.numElements;
+                        for (itemIndex = 0; itemIndex < n; itemIndex++)
+                        {
+                            updateRendererLabelProperty(itemIndex);
+                        }
                     }
                 }
-                else
+
+                labelFieldOrFunctionChanged = false;
+            }
+        }
+
+        /**
+         *  @private
+         */
+        override protected function measure():void
+        {
+            super.measure();
+            //trace("CHB.measure", measuredWidth, measuredHeight, "min", measuredMinWidth, measuredMinHeight);
+        }
+
+        /**
+         * @private
+         */
+        override protected function updateDisplayList(unscaledWidth:Number,
+                                                      unscaledHeight:Number):void
+        {
+            //trace("CHB.udl", unscaledWidth, unscaledHeight);
+            super.updateDisplayList(unscaledWidth, unscaledHeight);
+        }
+
+        /**
+         *  @private
+         */
+        override public function updateRenderer(renderer:IVisualElement, itemIndex:int, data:Object):void
+        {
+            // If the CHB has a height set on it, force all the headers to be
+            // that height.
+            if (!isNaN(explicitHeight))
+                renderer.height = explicitHeight;
+
+            super.updateRenderer(renderer, itemIndex, data);
+        }
+
+        /**
+         *  Given a data item, return the correct text a renderer
+         *  should display while taking the labelField
+         *  and labelFunction properties into account.
+         *
+         *  @param item A data item
+         *
+         *  @return String representing the text to display for the
+         *  data item in the  renderer.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        override public function itemToLabel(item:Object):String
+        {
+            return LabelUtil.itemToLabel(item, labelField, labelFunction);
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Private Methods
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         */
+        private function get dataGrid():DataGrid
+        {
+            return owner as DataGrid;
+        }
+
+        /**
+         *  @private
+         */
+        private function get grid():Grid
+        {
+            return dataGrid ? dataGrid.grid : null;
+        }
+
+        /**
+         *  @private
+         */
+        private function getDataProviderItem(columnIndex:int):Object
+        {
+            const dataProvider:IList = dataProvider;
+            if ((dataProvider == null) || (columnIndex >= dataProvider.length))
+                return null;
+
+            return dataProvider.getItemAt(columnIndex);
+        }
+
+        private function dispatchChangeEvent(type:String):void
+        {
+            if (hasEventListener(type))
+                dispatchEvent(new Event(type));
+        }
+
+        /**
+         *  @private
+         */
+        private function updateRendererLabelProperty(itemIndex:int):void
+        {
+            // grab the renderer at that index and re-compute it's label property
+            var renderer:IItemRenderer = dataGroup.getElementAt(itemIndex) as IItemRenderer;
+            if (renderer)
+                renderer.label = itemToLabel(renderer.data);
+        }
+
+        /**
+         *  @private
+         *  If the first column use the firstItemRenderer, if the last column use
+         *  the lastItemRenderer, otherwise use the itemRenderer.
+         */
+        private function defaultColumnHeaderBarItemRendererFunction(data:Object):IFactory
+        {
+            var column:GridColumn = GridColumn(data);
+
+            var columnIndex:int = column.columnIndex;
+
+            if (columnIndex == 0)
+                return firstItemRenderer;
+
+            if (columnIndex == dataProvider.length - 1)
+                return lastItemRenderer;
+
+            return itemRenderer;
+        }
+
+        // TBD: refactor the version of this in GridLayout so it doesn't
+        // have to be duplicated.
+
+        /**
+         *  @private
+         *  Size and position the visual element.
+         */
+        private function layoutGridElement(elt:IVisualElement,
+                                           x:Number, y:Number,
+                                           width:Number, height:Number):void
+        {
+            const validatingElt:IInvalidating = elt as IInvalidating;
+
+            if (!isNaN(width) || !isNaN(height))
+            {
+                if (validatingElt)
+                    validatingElt.validateNow();
+                elt.setLayoutBoundsSize(width, height);
+            }
+            if (validatingElt)
+                validatingElt.validateNow();
+            elt.setLayoutBoundsPosition(x, y);
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Event Handlers
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         *  Called when the mouse is clicked.
+         */
+        /*
+        private function item_clickHandler(event:MouseEvent):void
+        {
+            var newIndex:int;
+            if (event.currentTarget is IItemRenderer)
+                newIndex = IItemRenderer(event.currentTarget).itemIndex;
+            else
+                newIndex = dataGroup.getElementIndex(event.currentTarget as IVisualElement);
+
+            trace("item_clickHandler", newIndex);
+        }
+    ``` */
+
+        /**
+         *  @private
+         *  Called when contents within the dataProvider changes.
+         *
+         *  @param event The collection change event
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        /*
+        protected function dataProvider_collectionChangeHandler(event:Event):void
+        {
+            // ToDo: what should be done if columns change?
+
+            if (event is CollectionEvent)
+            {
+                var ce:CollectionEvent = CollectionEvent(event);
+
+                if (ce.kind == CollectionEventKind.ADD)
                 {
-                    var n:int = dataGroup.numElements;
-                    for (itemIndex = 0; itemIndex < n; itemIndex++)
+                }
+                else if (ce.kind == CollectionEventKind.REMOVE)
+                {
+                }
+                else if (ce.kind == CollectionEventKind.RESET)
+                {
+                }
+                else if (ce.kind == CollectionEventKind.REFRESH)
+                {
+                }
+                else if (ce.kind == CollectionEventKind.REPLACE ||
+                        ce.kind == CollectionEventKind.MOVE)
+                {
+                    //These cases are handled by the DataGroup skinpart
+                }
+            }
+        }
+        */
+
+        /**
+         *  @private
+         */
+        private function dataGroup_rendererAddHandler(event:RendererExistenceEvent):void
+        {
+            /*
+            const renderer:IItemRenderer = event.renderer as IItemRenderer;
+            if (renderer)
+            {
+                renderer.addEventListener(MouseEvent.CLICK, item_clickHandler);
+
+                // ToDo: deal with focus issues
+                //if (renderer is IFocusManagerComponent)
+                //    IFocusManagerComponent(renderer).focusEnabled = false;
+            }
+            */
+        }
+
+        /**
+         *  @private
+         */
+        private function dataGroup_rendererRemoveHandler(event:RendererExistenceEvent):void
+        {
+            /*
+            const renderer:IVisualElement = event.renderer;
+            if (renderer)
+                renderer.removeEventListener(MouseEvent.CLICK, item_clickHandler);
+            */
+        }
+
+        /**
+         *  @private
+         *  If the mouse is over the headerSeparator +/- the separatorAffordance,
+         *  return the index of the column to the left of the separator.
+         *  Otherwise return -1.
+         */
+        private function getHeaderSeparatorIndex(localPt:Point, columnIndex:int):int
+        {
+            // FIXME: For now assume header separator is 1 pixel wide and
+            // the columnGap is 0.
+            const bounds:Rectangle = grid.getColumnBounds(columnIndex);
+            if (bounds == null)
+                return -1;
+
+            if (localPt.x <= bounds.left + separatorAffordance)
+            {
+                if (columnIndex == 0)
+                    return -1;
+
+                return columnIndex - 1;
+            }
+            else if (localPt.x >= bounds.right - separatorAffordance)
+            {
+                return columnIndex;
+            }
+
+            return -1;
+        }
+
+        /**
+         *  @private
+         */
+        private function header_mouseDownHandler(event:GridEvent):void
+        {
+            if (!enabled)
+                return;
+         }
+
+        /**
+         *  @private
+         */
+        private function header_rollOverHandler(event:GridEvent):void
+        {
+            if (!enabled)
+                return;
+
+            //column:GridColumn = event.column;
+            //const columnIndex:int = event.columnIndex;
+        }
+
+        /**
+         *  @private
+         */
+        private function header_rollOutHandler(event:GridEvent):void
+        {
+            if (!enabled)
+                return;
+        }
+
+        /**
+         *  @private
+         */
+        private function sep_mouseDownHandler(event:GridEvent):void
+        {
+            if (!enabled || !grid.resizableColumns)
+                return;
+
+            var column:GridColumn = event.column;
+            if (!column.resizable)
+                return;
+
+            const bounds:Rectangle = grid.getColumnBounds(event.columnIndex);
+
+            // FIXME: handle columnResizeIndictor = null
+            var resizeGraphic:IVisualElement =
+                columnResizeIndicator.newInstance() as IVisualElement;
+
+            // TBD: size resize graphic and put in initial position
+         }
+
+        // FIXME: does this go in the skin somehow?
+        [Embed(source="Assets.swf",symbol="cursorStretch")]
+        private var stretchCursorClass:Class
+
+        /**
+         *  @private
+         */
+        private function sep_rollOverHandler(event:GridEvent):void
+        {
+            if (!enabled || !grid.resizableColumns)
+                return;
+
+            var column:GridColumn = event.column;
+
+            //trace("sep_rollOver", event.columnIndex);
+
+            if (!column.resizable)
+                return;
+
+            // Hide the mouse, attach and show the cursor
+            resizeCursorID = cursorManager.setCursor(
+                                    stretchCursorClass,
+                                    CursorManagerPriority.HIGH, 0, 0);
+        }
+
+        /**
+         *  @private
+         */
+        private function sep_rollOutHandler(event:GridEvent):void
+        {
+            if (!enabled)
+                return;
+
+            //trace("sep_rollOut", event.columnIndex);
+
+            cursorManager.removeCursor(resizeCursorID);
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  GridEvents
+        //
+        //--------------------------------------------------------------------------
+
+        private var rollColumnIndex:int = -1;
+        private var mouseDownColumnIndex:int = -1;
+        private var resizeColumnIndex:int = -1;
+        private var dragSeparator:Boolean;
+
+        /**
+         *  This method is called when a MOUSE_DOWN event occurs within the column header bar and
+         *  for all subsequent MOUSE_MOVE events until the button is released (even if the
+         *  mouse leaves the column header bar).  The last event in such a "down drag up" gesture is
+         *  always a MOUSE_UP.  By default this method dispatches GRID_MOUSE_DOWN,
+         *  GRID_MOUSE_DRAG, or a GRID_MOUSE_UP event in response to the the corresponding
+         *  mouse event on a column header or SEPARATOR_MOUSE_DOWN, SEPARATOR_MOUSE_DRAG,
+         *  or a SEPARATOR__MOUSE_UP event in response to the the corresponding
+         *  mouse event on a column header separator.
+         *
+         * .The GridEvent's columnIndex, column, item, and itemRenderer
+         *  properties correspond to the grid cell under the mouse.
+         *
+         *  @param event A MOUSE_DOWN, MOUSE_MOVE, or MOUSE_UP MouseEvent from a
+         *  down/move/up gesture initiated within the column header bar.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.0
+         *  @productversion Flex 4.5
+         */
+        protected function chb_mouseDownDragUpHandler(event:MouseEvent):void
+        {
+            const eventStageXY:Point = new Point(event.stageX, event.stageY);
+            const eventHeaderBarXY:Point = globalToLocal(eventStageXY);
+
+            const eventColumnIndex:int =
+                grid.getColumnIndexAt(eventHeaderBarXY.x, 0);
+
+            var gridEventType:String;
+            switch(event.type)
+            {
+                case MouseEvent.MOUSE_MOVE:
+                    if (dragSeparator)
+                        gridEventType = GridEvent.SEPARATOR_MOUSE_DRAG;
+                    else
+                        gridEventType = GridEvent.GRID_MOUSE_DRAG;
+                    break;
+                case MouseEvent.MOUSE_UP:
+                    if (dragSeparator)
+                        gridEventType = GridEvent.SEPARATOR_MOUSE_UP;
+                    else
+                        gridEventType = GridEvent.GRID_MOUSE_UP;
+                    break;
+                case MouseEvent.MOUSE_DOWN:
+                    // Is the mouseDown on a separator or a header?
+                    const headerIndex:int =
+                        getHeaderSeparatorIndex(eventHeaderBarXY, eventColumnIndex);
+                    dragSeparator = headerIndex != -1;
+                    if (dragSeparator)
                     {
-                        updateRendererLabelProperty(itemIndex);
+                        gridEventType = GridEvent.SEPARATOR_MOUSE_DOWN;
+                        mouseDownColumnIndex = headerIndex;
                     }
+                    else
+                    {
+                        gridEventType = GridEvent.GRID_MOUSE_DOWN;
+                        mouseDownColumnIndex = eventColumnIndex;
+                    }
+                    break;
+            }
+
+            dispatchGridEvent(event, gridEventType, eventHeaderBarXY, eventColumnIndex);
+        }
+
+        /**
+         *  This method is called whenever a MOUSE_MOVE occurs on either a
+         *  header in the column header bar or on one of the column header bar
+         *  separators without the button pressed.
+         *
+         *  By default it dispatches a GRID_ROLL_OVER for the first
+         *  MOUSE_MOVE GridEvent whose location is within a column header, and a
+         *  GRID_ROLL_OUT GridEvent when the mouse leaves the column_header and
+         *  it dispatches a SEPARATOR_ROLL_OVER for the first MOUSE_MOVE
+         *  GridEvent whose location is over a column header separator +/- the
+         *  column header separator affordance, and a SEPARATOR_ROLL_OUT
+         *  GridEvent when the mouse leaves the separator affordance.
+         *  Listeners are guaranteed to receive a GRID_ROLL_OUT event for every
+         *  GRID_ROLL_OVER event and to receive a SEPARATOR_ROLL_OUT event for
+         *  every SEPARATOR_ROLL_OVER event.
+         *
+         *  @param event A MOUSE_MOVE MouseEvent within the column header bar,
+         *  without the button pressed.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.0
+         *  @productversion Flex 4.5
+         */
+        protected function chb_mouseMoveHandler(event:MouseEvent):void
+        {
+            const eventStageXY:Point = new Point(event.stageX, event.stageY);
+            const eventHeaderBarXY:Point = globalToLocal(eventStageXY);
+            const eventColumnIndex:int = grid.getColumnIndexAt(eventHeaderBarXY.x, 0);
+
+            var headerIndex:int =
+                getHeaderSeparatorIndex(eventHeaderBarXY, eventColumnIndex);
+
+            // Figure out if this roll over is over one of the header separators
+            // or over the header itself.  The ends of the header that are
+            // within the separatorAffordance are considered part of the
+            // seperator, not part of the header.
+
+            if (headerIndex != -1)
+            {
+                if (rollColumnIndex != -1)
+                {
+                    dispatchGridEvent(event, GridEvent.GRID_ROLL_OUT, eventHeaderBarXY, rollColumnIndex);
+                    rollColumnIndex = -1;
+                }
+                if (headerIndex != resizeColumnIndex)
+                {
+                    if (resizeColumnIndex != -1 && headerIndex != resizeColumnIndex)
+                        dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OUT, eventHeaderBarXY, resizeColumnIndex);
+                    if (eventColumnIndex != resizeColumnIndex)
+                        dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OVER, eventHeaderBarXY, headerIndex);
+                    resizeColumnIndex = headerIndex;
                 }
             }
-
-            labelFieldOrFunctionChanged = false;
-        }
+            else
+            {
+                if (resizeColumnIndex != -1)
+                {
+                    dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OUT, eventHeaderBarXY, resizeColumnIndex);
+                    resizeColumnIndex = -1;
+                }
+                if (eventColumnIndex != rollColumnIndex)
+                {
+                    if (rollColumnIndex != -1)
+                        dispatchGridEvent(event, GridEvent.GRID_ROLL_OUT, eventHeaderBarXY, rollColumnIndex);
+                    if (eventColumnIndex != -1)
+                        dispatchGridEvent(event, GridEvent.GRID_ROLL_OVER, eventHeaderBarXY, eventColumnIndex);
+                    rollColumnIndex = eventColumnIndex;
+                }
+            }
+         }
+
+        /**
+         *  This method is called whenever a ROLL_OUT occurs on either a
+         *  header in the column header bar or on one of the column header bar
+         *  separators.
+         *
+         *  By default it dispatches either a GRID_ROLL_OUT or a
+         *  SEPARATOR_ROLL_OUT event.
+         *
+         *  @param event A ROLL_OUT MouseEvent from the column header bar.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.0
+         *  @productversion Flex 4.5
+         */
+        protected function chb_mouseRollOutHandler(event:MouseEvent):void
+        {
+            const eventStageXY:Point = new Point(event.stageX, event.stageY);
+            const eventHeaderBarXY:Point = globalToLocal(eventStageXY);
+
+            // Is the rollout for a column seperator or is it for the column?
+
+            if (resizeColumnIndex != -1)
+            {
+                dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OUT, eventHeaderBarXY, resizeColumnIndex);
+                resizeColumnIndex = -1;
+            }
+            else if (rollColumnIndex != -1)
+            {
+                dispatchGridEvent(event, GridEvent.GRID_ROLL_OUT, eventHeaderBarXY, rollColumnIndex);
+                rollColumnIndex = -1;
+            }
+        }
+
+        /**
+         *  This method is called whenever a CLICK MouseEvent occurs on the
+         *  column header bar if both the corresponding down and up events occur
+         *  within the same column header cell. By default it dispatches a
+         *  GRID_CLICK event.
+         *
+         *  @param event A CLICK MouseEvent from the column header bar.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.0
+         *  @productversion Flex 4.5
+         */
+        protected function chb_clickHandler(event:MouseEvent):void
+        {
+            const eventStageXY:Point = new Point(event.stageX, event.stageY);
+            const eventHeaderBarXY:Point = globalToLocal(eventStageXY);
+            const eventColumnIndex:int = grid.getColumnIndexAt(eventHeaderBarXY.x, 0);
+
+            var headerIndex:int =
+                getHeaderSeparatorIndex(eventHeaderBarXY, eventColumnIndex);
+
+            if (headerIndex != -1)
+            {
+                // Should be able to go down on one side of the separator and
+                // up on the other side even though this spans columns.
+                if (headerIndex == resizeColumnIndex)
+                    dispatchGridEvent(event, GridEvent.SEPARATOR_CLICK, eventHeaderBarXY, headerIndex);
+            }
+            else
+            {
+                if (eventColumnIndex == mouseDownColumnIndex)
+                    dispatchGridEvent(event, GridEvent.GRID_CLICK, eventHeaderBarXY, eventColumnIndex);
+            }
+        }
+
+        /**
+         *  This method is called whenever a DOUBLE_CLICK MouseEvent occurs on
+         *  the column header bar if the corresponding sequence of down and up
+         *  events occur within the same column header cell.
+         *  By default it dispatches a GRID_DOUBLE_CLICK event.
+         *
+         *  @param event A DOUBLE_CLICK MouseEvent from the column header bar.
+         *
+         *  @see flash.display.InteractiveObject#doubleClickEnabled
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.0
+         *  @productversion Flex 4.5
+         */
+        protected function chb_doubleClickHandler(event:MouseEvent):void
+        {
+            const eventStageXY:Point = new Point(event.stageX, event.stageY);
+            const eventHeaderBarXY:Point = globalToLocal(eventStageXY);
+            const gridDimensions:GridDimensions = dataGrid.grid.gridDimensions;
+            const eventColumnIndex:int = grid.getColumnIndexAt(eventHeaderBarXY.x, 0);
+
+            // This isn't stricly adequate, since the mouse might have been on a different cell for
+            // the first click.  It's not clear that the extra checking would be worthwhile.
+
+            // TBD: separator double click
+
+            if (eventColumnIndex == mouseDownColumnIndex)
+                dispatchGridEvent(event, GridEvent.GRID_DOUBLE_CLICK, eventHeaderBarXY, eventColumnIndex);
+        }
+
+        /**
+         *  @private
+         *  Return itemRenderer["excludedEventTargets"] contains event.target.id,
+         *  where itemRenderer is the item renderer ancestor of event.target.
+         */
+        private function isEventTargetExcluded(event:Event):Boolean
+        {
+            const eventTarget:UIComponent = event.target as UIComponent;
+            const eventTargetID:String = (eventTarget) ? eventTarget.id : null;
+            if (!eventTargetID)
+                return false;
+
+            // Find the eventTarget's ancestor whose parent is the Grid.  That's the
+            // item renderer.  If it has an excludedEventTargets array that contains
+            // event.target.id, then this event is to be excluded.
+
+            for (var elt:IVisualElement = eventTarget; elt && (elt != this); elt = elt.parent as IVisualElement)
+                if (elt.parent == this)  // then elt is an item renderer
+                {
+                    if ("excludedGridEventTargets" in Object(elt))
+                    {
+                        const excludedTargets:Array = Object(elt)["excludedGridEventTargets"] as Array;
+                        return excludedTargets.indexOf(eventTargetID) != -1;
+                    }
+                    return false;
+                }
+
+            return false;
+        }
+
+        /**
+         *  @private
+         */
+        private function dispatchGridEvent(mouseEvent:MouseEvent, type:String, gridXY:Point, columnIndex:int):void
+        {
+            //trace("dispatchGridEvent", mouseEvent.type, type, gridXY, columnIndex);
+
+            // ToDo: what is this?  what about the separators?  are they excluded?
+            if (isEventTargetExcluded(mouseEvent))
+                return;
+
+            const column:GridColumn = getDataProviderItem(columnIndex) as GridColumn;
+            const item:Object = column;
+            const itemRenderer:IVisualElement = dataGroup.getElementAt(columnIndex);
+            const bubbles:Boolean = mouseEvent.bubbles;
+            const cancelable:Boolean = mouseEvent.cancelable;
+            const ctrlKey:Boolean = mouseEvent.ctrlKey;
+            const altKey:Boolean = mouseEvent.altKey;
+            const shiftKey:Boolean = mouseEvent.shiftKey;
+            const buttonDown:Boolean = mouseEvent.buttonDown;
+            const delta:int = mouseEvent.delta;
+
+            const event:GridEvent = new GridEvent(
+                type, bubbles, cancelable,
+                gridXY.x, gridXY.y, 0, columnIndex, column, item, itemRenderer,
+                ctrlKey, altKey, shiftKey, buttonDown, delta);
+            dispatchEvent(event);
+        }
     }
-
-    /**
-     *  @private
-     */
-    override protected function measure():void
-    {
-        super.measure();
-        //trace("CHB.measure", measuredWidth, measuredHeight, "min", measuredMinWidth, measuredMinHeight);
-    }
-
-    /**
-     * @private
-     */
-    override protected function updateDisplayList(unscaledWidth:Number,
-                                                  unscaledHeight:Number):void
-    {
-        //trace("CHB.udl", unscaledWidth, unscaledHeight);
-        super.updateDisplayList(unscaledWidth, unscaledHeight);
-    }
-
-    /**
-     *  @private
-     */
-    override public function updateRenderer(renderer:IVisualElement, itemIndex:int, data:Object):void
-    {
-        // If the CHB has a height set on it, force all the headers to be
-        // that height.
-        if (!isNaN(explicitHeight))
-            renderer.height = explicitHeight;
-
-        super.updateRenderer(renderer, itemIndex, data);
-    }
-
-    /**
-     *  Given a data item, return the correct text a renderer
-     *  should display while taking the labelField
-     *  and labelFunction properties into account.
-     *
-     *  @param item A data item
-     *
-     *  @return String representing the text to display for the
-     *  data item in the  renderer.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    override public function itemToLabel(item:Object):String
-    {
-        return LabelUtil.itemToLabel(item, labelField, labelFunction);
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Private Methods
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     */
-    private function get dataGrid():DataGrid
-    {
-        return owner as DataGrid;
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Private Methods
-    //
-    //--------------------------------------------------------------------------
-
-    private function dispatchChangeEvent(type:String):void
-    {
-        if (hasEventListener(type))
-            dispatchEvent(new Event(type));
-    }
-
-    /**
-     *  @private
-     */
-    private function updateRendererLabelProperty(itemIndex:int):void
-    {
-        // grab the renderer at that index and re-compute it's label property
-        var renderer:IItemRenderer = dataGroup.getElementAt(itemIndex) as IItemRenderer;
-        if (renderer)
-            renderer.label = itemToLabel(renderer.data);
-    }
-
-    /**
-     *  @private
-     *  If the first column use the firstItemRenderer, if the last column use
-     *  the lastItemRenderer, otherwise use the itemRenderer.
-     */
-    private function defaultColumnHeaderBarItemRendererFunction(data:Object):IFactory
-    {
-        var column:GridColumn = GridColumn(data);
-
-        var columnIndex:int = column.columnIndex;
-
-        if (columnIndex == 0)
-            return firstItemRenderer;
-
-        if (columnIndex == dataProvider.length - 1)
-            return lastItemRenderer;
-
-        return itemRenderer;
-    }
-
-
-    //--------------------------------------------------------------------------
-    //
-    //  Event Handlers
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     *  Called when the mouse is clicked.
-     */
-    private function item_clickHandler(event:MouseEvent):void
-    {
-        var newIndex:int;
-        if (event.currentTarget is IItemRenderer)
-            newIndex = IItemRenderer(event.currentTarget).itemIndex;
-        else
-            newIndex = dataGroup.getElementIndex(event.currentTarget as IVisualElement);
-
-        trace("item_clickHandler", newIndex);
-    }
-
-    /**
-     *  @private
-     *  Called when contents within the dataProvider changes.
-     *
-     *  @param event The collection change event
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    /*
-    protected function dataProvider_collectionChangeHandler(event:Event):void
-    {
-        // ToDo: what should be done if columns change?
-
-        if (event is CollectionEvent)
-        {
-            var ce:CollectionEvent = CollectionEvent(event);
-
-            if (ce.kind == CollectionEventKind.ADD)
-            {
-            }
-            else if (ce.kind == CollectionEventKind.REMOVE)
-            {
-            }
-            else if (ce.kind == CollectionEventKind.RESET)
-            {
-            }
-            else if (ce.kind == CollectionEventKind.REFRESH)
-            {
-            }
-            else if (ce.kind == CollectionEventKind.REPLACE ||
-                    ce.kind == CollectionEventKind.MOVE)
-            {
-                //These cases are handled by the DataGroup skinpart
-            }
-        }
-    }
-    */
-
-    /**
-     *  @private
-     */
-    private function dataGroup_rendererAddHandler(event:RendererExistenceEvent):void
-    {
-        const renderer:IItemRenderer = event.renderer as IItemRenderer;
-        if (renderer)
-        {
-            renderer.addEventListener(MouseEvent.CLICK, item_clickHandler);
-
-            // ToDo: deal with focus issues
-            //if (renderer is IFocusManagerComponent)
-            //    IFocusManagerComponent(renderer).focusEnabled = false;
-        }
-    }
-
-    /**
-     *  @private
-     */
-    private function dataGroup_rendererRemoveHandler(event:RendererExistenceEvent):void
-    {
-        const renderer:IVisualElement = event.renderer;
-        if (renderer)
-            renderer.removeEventListener(MouseEvent.CLICK, item_clickHandler);
-    }
-
-    /**
-     *  This method is called when a MOUSE_DOWN event occurs within the
-     *  ColumnHeaderBar and for all subsequent MOUSE_MOVE events until the
-     *  button is released (even if the mouse leaves the chb).  The last event
-     *  in such a "down drag up" gesture is always a MOUSE_UP.  By default this
-     *  method dispatches GRID_MOUSE_DOWN, GRID_MOUSE_DRAG, or a
-     *  GRID_MOUSE_UP event in response to the the corresponding
-     *  mouse event.  The GridEvent's rowIndex, columnIndex, column, item, and itemRenderer
-     *  properties correspond to the grid cell under the mouse.
-     *
-     *  @param event A MOUSE_DOWN, MOUSE_MOVE, or MOUSE_UP MouseEvent from a
-     *  down/move/up gesture initiated within the ColumnHeaderBar.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 2.0
-     *  @productversion Flex 4.5
-     */
-    protected function mouseDownDragUpHandler(event:MouseEvent):void
-    {
-        const eventStageXY:Point = new Point(event.stageX, event.stageY);
-        const eventColumnHeaderBarXY:Point = globalToLocal(eventStageXY);
-
-        //const gridDimensions:GridDimensions = GridLayout(layout).gridDimensions;
-        //const eventRowIndex:int = gridDimensions.getRowIndexAt(eventColumnHeaderBarXY.x, eventColumnHeaderBarXY.y);
-        //const eventColumnIndex:int = gridDimensions.getColumnIndexAt(eventColumnHeaderBarXY.x, eventColumnHeaderBarXY.y);
-
-        trace("event type", event.type, "chb", eventColumnHeaderBarXY, "stage", eventStageXY);
-
-        var gridEventType:String;
-        switch(event.type)
-        {
-            case MouseEvent.MOUSE_MOVE:
-            {
-                //gridEventType = GridEvent.GRID_MOUSE_DRAG;
-                break;
-            }
-            case MouseEvent.MOUSE_UP:
-            {
-                //gridEventType = GridEvent.GRID_MOUSE_UP;
-                break;
-            }
-            case MouseEvent.MOUSE_DOWN:
-            {
-                //gridEventType = GridEvent.GRID_MOUSE_DOWN;
-                //mouseDownRowIndex = eventRowIndex;
-                //mouseDownColumnIndex = eventColumnIndex;
-                break;
-            }
-        }
-
-        //dispatchGridEvent(event, gridEventType, eventColumnHeaderBarXY, eventRowIndex, eventColumnIndex);
-    }
-
-    /**
-     *  @private
-     */
-    private function mouseDownHandler(event:MouseEvent):void
-    {
-        // ToDo: should there be dataGrid.resizableColumns so you don't have
-        // to set every column to false.
-        if (!enabled /*|| !dataGrid.resizableColumns*/)
-            return;
-
-        trace("mouseDown", event.target);
-
-        // ToDo: figure out which column or separator
-        //if (!column.resizable)
-        //   return;
-    }
-
-    /**
-     *  @private
-     */
-    private function mouseOverHandler(event:MouseEvent):void
-    {
-        // ToDo: should there be dataGrid.resizableColumns so you don't have
-        // to set every column to false.
-        if (!enabled /*|| !dataGrid.resizableColumns*/)
-            return;
-
-        trace("mouseOver", event.target);
-
-        // ToDo: figure out which column or separator
-        //if (!column.resizable)
-        //   return;
-
-        // This goes in columnResizeMouseOutHandler
-       // ToDo: should this be a property rather than a style?
-
-        // Hide the mouse, attach and show the cursor
-        /*
-        var stretchCursorClass:Class = getStyle("stretchCursor");
-        resizeCursorID = cursorManager.setCursor(
-                            stretchCursorClass,
-                            CursorManagerPriority.HIGH, 0, 0);
-        */
-    }
-
-    /**
-     *  @private
-     */
-    private function mouseOutHandler(event:MouseEvent):void
-    {
-        if (!enabled /*|| !dataGrid.resizableColumns*/)
-            return;
-
-        trace("mouseOut", event.target);
-
-        // ToDo: figure out which column or separator
-
-        // ToDo: is this check really right - should the cursor be restored?
-        //if (!column.resizable)
-        //    return;
-
-        // This goes in columnResizeMouseOutHandler
-        //cursorManager.removeCursor(resizeCursorID);
-    }
 }
-}


Code clean

Code clean

--- collect-client/src/main/flex/org/openforis/collect/presenter/HomePresenter.as
+++ collect-client/src/main/flex/org/openforis/collect/presenter/HomePresenter.as
@@ -38,7 +38,7 @@

 		override internal function initEventListeners():void {
 			super.initEventListeners();
-			_view.functionList.addEventListener(IndexChangeEvent.CHANGE, functionListChangeHandler);
+			_view.functionList.addEventListener(IndexChangeEvent.CHANGING, functionListChangingHandler);
 		}

 		protected function createFunctionsList():IList {
@@ -51,9 +51,10 @@
 			return result;
 		}

-		protected function functionListChangeHandler(event:IndexChangeEvent):void {
+		protected function functionListChangingHandler(event:IndexChangeEvent):void {
 			var items:IList = _view.functionList.dataProvider;
 			var item:Object = items.getItemAt(event.newIndex);
+			event.preventDefault();
 			switch (item) {
 				case DESIGNER_MENU_ITEM:
 					navigateToURL(new URLRequest(ApplicationConstants.DESIGNER_URL), "_self");
@@ -65,7 +66,6 @@
 					eventDispatcher.dispatchEvent(new UIEvent(UIEvent.SHOW_LIST_OF_RECORDS));
 					break;
 			}
-			_view.functionList.selectedItem = null;
 		}


Transferred from the Adobe Open Source Subversion Repository

Revision: 5067
Author:   smgilson@adobe.com
Date:     2009-02-25T16:21:22.849704Z

Log Message:
-----------
In preparation for adding ASDoc version tags for Flex, remove old tags from AIR files

QE Notes: None
Doc Notes: None
Bugs: -

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/Window.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/FlexNativeMenuEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/FlexHTMLLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemEnumerationMode.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowMinimizeButtonSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemHistoryButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowRestoreButtonSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowMaximizeButtonSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/StatusBarBackgroundSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemTree.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/HTML.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/IWindow.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/utils/DirectoryEnumeration.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemSizeDisplayMode.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/FlexNativeWindowBoundsEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemComboBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/utils/DirectoryEnumerationMode.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/AIREvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowBackground.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/windowClasses/TitleBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/windowClasses/StatusBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/FileEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/WindowExistenceEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemDataGrid.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowCloseButtonSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/ApplicationTitleBarBackgroundSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/WindowedApplication.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FlexNativeMenu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1249710 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/airframework/src/mx/controls/FileSystemSizeDisplayMode.as
+++ frameworks/projects/airframework/src/mx/controls/FileSystemSizeDisplayMode.as
@@ -19,7 +19,6 @@
  *
  *  @see mx.controls.FileSystemDataGrid#enumerationMode
  *
- *  @playerversion AIR 1.1
  */
 public final class FileSystemSizeDisplayMode
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 11171
Author:   egeorgie@adobe.com
Date:     2009-10-26T23:24:13.720443Z

Log Message:
-----------
Add overlay property to GroupBase. Note, names of class and APIs will change, since it's still in review.

QE notes: Ready testing, names will change after the APIs review.
Doc notes: None
Bugs: None
Reviewer: Deepa
Tests run: checkintests, mustella (all gumbo tests)
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/DisplayPlane.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/OverlayDepth.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/ViewStack.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Accordion.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/events/DisplayPlaneObjectExistenceEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Container.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DataGroup.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1282440 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/supportClasses/OverlayDepth.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/OverlayDepth.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.components.supportClasses
+{
+/**
+ *  The OverlayDepth class defines the default depth values for
+ *  various overlay elements.
+ *
+ *  @see spark.components.Group#overlay
+ *  @see spark.components.DataGroup#overlay
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public final class OverlayDepth
+{
+	/**
+	 *  The overlay depth for a drop indicator.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public static const DROP_INDICATOR_DEPTH:Number = 100;
+
+	/**
+	 *  The overlay depth for a mask object.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public static const MASK_DEPTH:Number = 200;
+
+	/**
+	 *  The overlay depth for a focus object.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public static const FOCUS_DEPTH:Number = 300;
+
+	/**
+	 *  The default top most overlay depth.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public static const TOPMOST:Number = 10000;
+}
+}


Proposed change to readObject().

Proposed change to readObject().

The purpose is to
- Ensure type checking for "fail-fast" detection of streaming errors.
- But simplify it so that callers don't have to cast themselves and
  potentially screw up by using "String(obj)" or "Array(obj)", or miss out
  on the fail-fastyness by using "obj as SomeType".
- But, at the same time, allow for the sveltest code possible.
    // first one is a bit shorter!
    _name = ins.readObject(Name);
    _name = Name(ins.readObject());

    // first one is a bit shorter!
    _state = ins.readObject(String);
    _state = ins.readObject() as String;

So, to sum up: the code is the shortest and doesn't require special-casing
if you are reading a String, Number, int, uint, Boolean, or Array.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@5984 542714f4-19e9-0310-aa3c-eee0fc999fb1

--- src/as/com/threerings/io/ObjectInputStream.as
+++ src/as/com/threerings/io/ObjectInputStream.as
@@ -62,13 +62,16 @@
     }

     /**
-     * Attempts to read the next object from the stream. If a type is passed and the read object's
-     * type doesn't match, a TypeError is thrown.
-     * @param type optional type to check the read object against
+     * Reads the next Object (or null) from the stream and returns it as * so that you may assign
+     * to any variable without casting. It is strongly recommended that you pass a 'checkType'
+     * parameter so that the type of the Object is verified to be what you believe it to be,
+     * thus helping you detect streaming errors as quickly as possible.
+     *
+     * @param checkType optional type to check the read object against
+     * @return the Object read, or null.
      * @throws TypeError if the object is read successfully but is the wrong type
-     * @return null if the object could not be read (or is actually null)
-     */
-    public function readObject (type :Class = null) :Object
+     */
+    public function readObject (checkType :Class = null) :*
         //throws IOError
     {
         var DEBUG_ID :String = "[" + (++_debugObjectCounter) + "] ";
@@ -121,9 +124,9 @@
             //log.debug("Reading object...");
             readBareObjectImpl(target, cmap.streamer);
             if (DEBUG) log.debug(DEBUG_ID + "Read object: " + target);
-            if (type != null && !(target is type)) {
+            if (checkType != null && !(target is checkType)) {
                 throw new TypeError(
-                    "Cannot convert " + ClassUtil.getClass(target) + " to " + type);
+                    "Cannot convert " + ClassUtil.getClass(target) + " to " + checkType);
             }
             return target;


Transferred from the Adobe Open Source Subversion Repository

Revision: 23246
Author:   cframpto@adobe.com
Date:     2011-12-20T17:40:08.069454Z

Log Message:
-----------
Rollback 23243.  If comment followed header it was stripped as well.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1252134 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/automation_spark/src/spark/automation/delegates/components/SparkListAutomationImpl.as
+++ frameworks/projects/automation_spark/src/spark/automation/delegates/components/SparkListAutomationImpl.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////

 package spark.automation.delegates.components
 {


Add 0x10 to 0x1F

Add 0x10 to 0x1F


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1258742 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/collections/SortField.as
+++ frameworks/projects/framework/src/mx/collections/SortField.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2005-2010 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1260644 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/events/FlexMouseEvent.as
+++ frameworks/projects/framework/src/mx/events/FlexMouseEvent.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2006 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

 package mx.events
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1261540 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/managers/FocusManager.as
+++ frameworks/projects/framework/src/mx/managers/FocusManager.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2003-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1262564 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/styles/IStyleManager2.as
+++ frameworks/projects/framework/src/mx/styles/IStyleManager2.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2007 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

 package mx.styles
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 3581
Author:   egeorgie@adobe.com
Date:     2008-10-10T23:52:26.296427Z

Log Message:
-----------
Fix for "http://bugs.adobe.com/jira/browse/SDK-15886 percentSize is not consistent between GraphicElement and UIComponent"

Reviewed by Chet

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemUIC.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/BasicLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/VerticalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/GraphicElement.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1285289 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/layouts/VerticalLayout.as
+++ frameworks/projects/spark/src/spark/layouts/VerticalLayout.as
@@ -41,7 +41,7 @@

     private static function calculatePercentWidth( layoutItem:ILayoutItem, width:Number ):Number
     {
-    	var percentWidth:Number = LayoutItemHelper.pinBetween( layoutItem.percentSize.x * width,
+    	var percentWidth:Number = LayoutItemHelper.pinBetween( layoutItem.percentSize.x * 0.01 * width,
     	                                                       layoutItem.minSize.x,
     	                                                       layoutItem.maxSize.x );
     	return percentWidth < width ? percentWidth : width;
@@ -935,7 +935,7 @@

                 childInfo = new LayoutItemFlexChildInfo();
                 childInfo.layoutItem = layoutItem;
-                childInfo.percent    = layoutItem.percentSize.y * 100;
+                childInfo.percent    = layoutItem.percentSize.y;
                 childInfo.min        = layoutItem.minSize.y;
                 childInfo.max        = layoutItem.maxSize.y;

@@ -955,7 +955,6 @@
         // Distribute the extra space among the flexible children
         if (totalPercentHeight)
         {
-            totalPercentHeight *= 100;
             spaceToDistribute = Flex.flexChildrenProportionally(height,
                                                                 spaceToDistribute,
                                                                 totalPercentHeight,