incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cframp...@apache.org
Subject svn commit: r1370028 [29/43] - in /incubator/flex/whiteboard/cframpton/adobe.next: ./ frameworks/ frameworks/projects/advancedgrids/src/mx/collections/ frameworks/projects/advancedgrids/src/mx/controls/ frameworks/projects/airframework/src/mx/managers/...
Date Mon, 06 Aug 2012 21:26:02 GMT
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/GridColumnHeaderGroup.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/GridColumnHeaderGroup.as?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/GridColumnHeaderGroup.as
(original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/GridColumnHeaderGroup.as
Mon Aug  6 21:25:54 2012
@@ -30,8 +30,13 @@ import mx.core.IFactory;
 import mx.core.mx_internal;
 import mx.events.PropertyChangeEvent;
 
+import spark.components.gridClasses.CellPosition;
 import spark.components.gridClasses.GridColumn;
-import spark.components.gridClasses.GridColumnHeaderGroupLayout;
+import spark.components.gridClasses.GridDimensionsView;
+import spark.components.gridClasses.GridHeaderLayout;
+import spark.components.gridClasses.GridHeaderViewLayout;
+import spark.components.gridClasses.GridLayout;
+import spark.components.gridClasses.GridView;
 import spark.components.gridClasses.IDataGridElement;
 import spark.components.gridClasses.IGridItemRenderer;
 import spark.events.GridEvent;
@@ -303,7 +308,9 @@ use namespace mx_internal;
  *    dataGrid="null"  
  *    downColumnIndex="-1"  
  *    headerRenderer="null"  
- *    hoverColumnIndex="-1"  
+ *    hoverColumnIndex="-1" 
+ *    selectedColumnIndex="-1"  
+ *    highlightSelectedColumn="false" 
  *    visibleSortIndicatorIndices="<i>empty Vector.&lt;int&gt<i>"
  * 
  *    <strong>Styles</strong>
@@ -340,8 +347,8 @@ use namespace mx_internal;
 public class GridColumnHeaderGroup extends Group implements IDataGridElement
 {
     include "../core/Version.as";
-    
-    /**
+	
+	/**
      *  Constructor.
      *  
      *  @langversion 3.0
@@ -353,8 +360,7 @@ public class GridColumnHeaderGroup exten
     {
         super();
         
-        layout = new GridColumnHeaderGroupLayout();
-        layout.clipAndEnableScrolling = true;
+		layout = new GridHeaderLayout();
 
         // Event handlers that dispatch GridEvents
         
@@ -425,6 +431,7 @@ public class GridColumnHeaderGroup exten
     //----------------------------------
     
     private var _dataGrid:DataGrid = null;
+	private var lockedColumnCountChanged:Boolean = false;
     
     [Bindable("dataGridChanged")]
     
@@ -453,17 +460,26 @@ public class GridColumnHeaderGroup exten
     {
         if (_dataGrid == value)
             return;
-        
+		
         if (_dataGrid && _dataGrid.grid)
-            _dataGrid.grid.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, grid_changeEventHandler);
+		{
+            _dataGrid.grid.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, grid_propertyChangeHandler);
+			_dataGrid.grid.removeEventListener("columnsChanged", grid_propertyChangeHandler);				
+			_dataGrid.grid.removeEventListener("lockedColumnCountChanged", grid_propertyChangeHandler);
		
+		}
         
         _dataGrid = value;
 
         if (_dataGrid && _dataGrid.grid)
-            _dataGrid.grid.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, grid_changeEventHandler);
+		{
+            _dataGrid.grid.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, grid_propertyChangeHandler);
+			_dataGrid.grid.addEventListener("columnsChanged", grid_propertyChangeHandler);				
+			_dataGrid.grid.addEventListener("lockedColumnCountChanged", grid_propertyChangeHandler);

+		}
         
         layout.clearVirtualLayoutCache();
-        invalidateSize();
+
+		invalidateSize();
         invalidateDisplayList();
         
         dispatchChangeEvent("dataGridChanged");
@@ -472,12 +488,19 @@ public class GridColumnHeaderGroup exten
     /**
      *  @private
      */
-    private function grid_changeEventHandler(event:PropertyChangeEvent):void
+    private function grid_propertyChangeHandler(event:Event):void
     {
-        if (event.property == "horizontalScrollPosition")
-            horizontalScrollPosition = Number(event.newValue);
+        const ghl:GridHeaderLayout = layout as GridHeaderLayout;
+        if (!ghl)
+            return;
+        
+		const pce:PropertyChangeEvent = event as PropertyChangeEvent;
+		if (pce && (pce.property ==  "horizontalScrollPosition"))
+			ghl.centerGridColumnHeaderView.horizontalScrollPosition = Number(pce.newValue);
+		else if ((event.type == "columnsChanged") || (event.type == "lockedColumnCountChanged"))
+			invalidateProperties();
     }
-    
+	
     //----------------------------------
     //  downColumnIndex
     //----------------------------------
@@ -539,7 +562,7 @@ public class GridColumnHeaderGroup exten
      */
     public function get headerRenderer():IFactory
     {
-        return _headerRenderer;
+        return _headerRenderer;  // TODO: find a way to make it possible to specify this
with DataGrid...
     }
     
     /**
@@ -558,7 +581,7 @@ public class GridColumnHeaderGroup exten
         
         dispatchChangeEvent("headerRendererChanged");
     }
-    
+	
     //----------------------------------
     //  hoverColumnIndex 
     //----------------------------------
@@ -601,6 +624,103 @@ public class GridColumnHeaderGroup exten
     }
     
     //----------------------------------
+    //  selectedColumnIndex 
+    //----------------------------------
+    
+    private var _selectedColumnIndex:int = -1;
+    
+    [Bindable("selectedColumnIndexChanged")]
+    
+    /**
+     *  Specifies the column index of the header renderer currently selected by the user.
+     *  The selected property of the header renderer for selectedColumnIndex will be true

+     *  and false for all other header renderers.
+     *  
+     *  <p>Setting selectedColumnIndex to -1, the default, means that no column is
selected and 
+     *  selected property for all header renderers will be false.</p>
+
+     * 
+     *  @default -1
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5 
+     */
+    public function get selectedColumnIndex():int
+    {
+        return _selectedColumnIndex;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set selectedColumnIndex(value:int):void
+    {
+        if (_selectedColumnIndex == value)
+            return;
+        
+        _selectedColumnIndex = value;
+        invalidateDisplayList();
+        dispatchChangeEvent("selectedColumnIndexChanged");
+    }
+        
+    //----------------------------------
+    //  highlightSelectedColumn 
+    //----------------------------------
+    
+    private var _highlightSelectedColumn:Boolean = false;
+    
+    [Bindable("highlightSelectedColumnChanged")]
+    
+    /**
+     *  The DefaultGridHeaderRenderer only highlights the selected column when selectedColumnIndex
is
+     *  valid and highlightSelectedColumn is true.  If this property is set to true and 
+     *  the selectedColumnIndex is -1, then the selectedColumnIndex is set to the hoverColumnIndex,
+     *  and if that's -1, then the first visible column.
+     * 
+     *  @default false
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5 
+     */
+    public function get highlightSelectedColumn():Boolean
+    {
+        return _highlightSelectedColumn;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set highlightSelectedColumn(value:Boolean):void
+    {
+        if (_highlightSelectedColumn == value)
+            return;
+        
+        // If this property's value is being changed to true, make sure that the 
+        // initial value of selectedColumnIndex corresponds to a visible column.
+        // Tabbing to the DataGrid header shouldn't cause the DataGrid to scroll.
+        
+        if (value)
+        {
+            if ((selectedColumnIndex == -1) && (hoverColumnIndex != 1))
+                selectedColumnIndex = hoverColumnIndex;
+            
+            if (dataGrid.grid && !dataGrid.grid.isCellVisible(-1, selectedColumnIndex))
+            {
+                const visibleColumnIndices:Vector.<int> = dataGrid.grid.getVisibleColumnIndices();
+                selectedColumnIndex = (visibleColumnIndices.length > 0) ? visibleColumnIndices[0]
: -1;
+            }
+        }
+
+        _highlightSelectedColumn = value;
+        invalidateDisplayList();
+        dispatchChangeEvent("highlightSelectedColumnChanged");
+    }
+        
+    //----------------------------------
     //  visibleSortIndicatorIndices
     //----------------------------------
     
@@ -665,8 +785,51 @@ public class GridColumnHeaderGroup exten
     //  Methods 
     //
     //--------------------------------------------------------------------------
-    
-    /**
+	
+	private function createGridColumnHeaderView():Group
+	{
+		const viewLayout:GridHeaderViewLayout = new GridHeaderViewLayout();
+		viewLayout.clipAndEnableScrolling = true;
+		viewLayout.gridColumnHeaderGroup = this;
+		
+		const view:Group = new Group();
+		view.layout = viewLayout;
+		addElement(view);
+
+		return view;
+	}
+	
+	/**
+	 *  Create and/or configure the GridColumnHeaderViews.  We're assuming that the
+	 *  DataGrid's GridViews have already been created.
+	 */
+	public function configureGridColumnHeaderViews():void
+	{
+        const ghl:GridHeaderLayout = layout as GridHeaderLayout;
+        if (!ghl)
+            return;
+        
+		if (ghl.centerGridColumnHeaderView == null)
+			ghl.centerGridColumnHeaderView = createGridColumnHeaderView();
+		
+		if (dataGrid.lockedColumnCount > 0)
+		{
+			ghl.leftGridColumnHeaderView = createGridColumnHeaderView();
+		}
+		else if (ghl.leftGridColumnHeaderView)
+		{
+			removeElement(ghl.leftGridColumnHeaderView);
+			ghl.leftGridColumnHeaderView = null;
+		}
+		
+		const gridLayout:GridLayout = dataGrid.grid.layout as GridLayout;
+
+		GridHeaderViewLayout(ghl.centerGridColumnHeaderView.layout).gridView = gridLayout.centerGridView;
+		if (ghl.leftGridColumnHeaderView)
+			GridHeaderViewLayout(ghl.leftGridColumnHeaderView.layout).gridView = gridLayout.leftGridView;
+	}
+	
+	/**
      *  Returns the column index corresponding to the specified coordinates,
      *  or -1 if the coordinates are out of bounds. The coordinates are 
      *  resolved with respect to the GridColumnHeaderGroup layout target.
@@ -688,7 +851,9 @@ public class GridColumnHeaderGroup exten
      */
     public function getHeaderIndexAt(x:Number, y:Number):int
     {
-        return GridColumnHeaderGroupLayout(layout).getHeaderIndexAt(x, y);
+        // TODO: fix this: x coordinate has to be adjusted
+		const view:Group = getColumnHeaderViewAtX(x);
+        return GridHeaderViewLayout(view.layout).getHeaderIndexAt(x, y);
     }
     
     /**
@@ -723,7 +888,9 @@ public class GridColumnHeaderGroup exten
      */
     public function getSeparatorIndexAt(x:Number, y:Number):int
     {
-        return GridColumnHeaderGroupLayout(layout).getSeparatorIndexAt(x, y);
+        // TODO: fix this: x coordinate has to be adjusted        
+		const view:Group = getColumnHeaderViewAtX(x);		
+        return GridHeaderViewLayout(view.layout).getSeparatorIndexAt(x, y);
     }    
         
     /**
@@ -750,7 +917,9 @@ public class GridColumnHeaderGroup exten
      */
     public function getHeaderRendererAt(columnIndex:int):IGridItemRenderer
     {
-        return GridColumnHeaderGroupLayout(layout).getHeaderRendererAt(columnIndex);
+        // TODO: fix this: do the work here, rather than the layout            
+		const view:Group = getColumnHeaderViewAtIndex(columnIndex);	
+        return GridHeaderViewLayout(view.layout).getHeaderRendererAt(columnIndex);
     }
     
     /**
@@ -771,9 +940,47 @@ public class GridColumnHeaderGroup exten
      */  
     public function getHeaderBounds(columnIndex:int):Rectangle
     {
-        return GridColumnHeaderGroupLayout(layout).getHeaderBounds(columnIndex);
-    }
-    
+        // TODO: fix this: do the work here, rather than the layout         
+		const view:Group = getColumnHeaderViewAtIndex(columnIndex);		
+        return GridHeaderViewLayout(view.layout).getHeaderBounds(columnIndex);
+    }
+	
+	/**
+	 *  @private
+	 */
+	override public function invalidateSize():void
+	{
+		super.invalidateSize();
+		
+        const ghl:GridHeaderLayout = layout as GridHeaderLayout;
+        if (!ghl)
+            return;
+        
+		if (ghl.leftGridColumnHeaderView)
+			ghl.leftGridColumnHeaderView.invalidateSize();
+		
+		if (ghl.centerGridColumnHeaderView)
+			ghl.centerGridColumnHeaderView.invalidateSize();
+	}
+	
+	/**
+	 *  @private
+	 */
+	override public function invalidateDisplayList():void
+	{
+		super.invalidateDisplayList();
+        
+        const ghl:GridHeaderLayout = layout as GridHeaderLayout; 
+        if (!ghl)
+            return;
+
+		if (ghl.leftGridColumnHeaderView)
+			ghl.leftGridColumnHeaderView.invalidateDisplayList();
+		
+		if (ghl.centerGridColumnHeaderView)
+			ghl.centerGridColumnHeaderView.invalidateDisplayList();		
+	}
+		
     //--------------------------------------------------------------------------
     //
     //  GridEvent dispatching
@@ -789,6 +996,47 @@ public class GridColumnHeaderGroup exten
     private var pressSeparatorIndex:int = -1;   // separator button press occurred on
     
     /**
+     *  Return the "header view" Group that contains the mouse.  
+     *  TODO: this algorithm isn't reliable.  See Grid/mouseEventGridView().
+     */
+    private function mouseEventHeaderView(event:MouseEvent):Group
+    {
+        const thisNestLevel:int = nestLevel;
+        for(var elt:Object = event.target; elt; elt = elt.parent)
+        {
+            var view:Group = elt as Group;
+            if (view && (view.layout is GridHeaderViewLayout))
+                return view;
+            if (elt.nestLevel <= thisNestLevel)
+                break;
+        }
+        
+        return null;
+    }
+
+    // TODO: apologize for stashing the separatorIndex in headerCP.rowIndex
+    private function eventToHeaderLocations(event:MouseEvent, headerCP:CellPosition, headerXY:Point):Boolean
+    {
+        const view:Group = mouseEventHeaderView(event);
+        if (!view)
+            return false;
+        
+        const stageXY:Point = new Point(event.stageX, event.stageY);
+        const viewXY:Point = view.globalToLocal(stageXY);
+        const viewLayout:GridHeaderViewLayout = view.layout as GridHeaderViewLayout;
+        const gdv:GridDimensionsView = viewLayout.gridView.gridViewLayout.gridDimensionsView;
+        const separatorIndex:int = viewLayout.getSeparatorIndexAt(viewXY.x, 0);
+        
+        headerCP.rowIndex = (separatorIndex != -1) ? separatorIndex + gdv.viewColumnIndex
: -1;
+        headerCP.columnIndex = (separatorIndex == -1) ? viewLayout.getHeaderIndexAt(viewXY.x,
0) + gdv.viewColumnIndex : -1;
+        
+        headerXY.x = viewXY.x + gdv.viewOriginX;
+        headerXY.y = viewXY.y;
+        
+        return true;
+    }
+    
+    /**
      *  @private
      * 
      *  This method is called when a MOUSE_DOWN event occurs within the column header group
and 
@@ -813,11 +1061,13 @@ public class GridColumnHeaderGroup exten
      */    
     protected function gchg_mouseDownDragUpHandler(event:MouseEvent):void
     {
-        const eventStageXY:Point = new Point(event.stageX, event.stageY);
-        const eventHeaderGroupXY:Point = globalToLocal(eventStageXY);
-        const eventSeparatorIndex:int = getSeparatorIndexAt(eventHeaderGroupXY.x, 0);
-        const eventColumnIndex:int = 
-            (eventSeparatorIndex == -1) ? getHeaderIndexAt(eventHeaderGroupXY.x, 0) : -1;
+        const eventHeaderCP:CellPosition = new CellPosition();
+        const eventHeaderXY:Point = new Point();
+        if (!eventToHeaderLocations(event, eventHeaderCP, eventHeaderXY))
+            return;
+        
+        const eventSeparatorIndex:int = eventHeaderCP.rowIndex;
+        const eventColumnIndex:int = (eventSeparatorIndex == -1) ? eventHeaderCP.columnIndex
: -1;
         
         var gridEventType:String;
         switch(event.type)
@@ -855,8 +1105,8 @@ public class GridColumnHeaderGroup exten
             }
         }
         
-        const columnIndex:int = (eventSeparatorIndex != -1) ? eventSeparatorIndex : eventColumnIndex;
-        dispatchGridEvent(event, gridEventType, eventHeaderGroupXY, columnIndex);
+        const columnIndex:int = (pressSeparatorIndex != -1) ? pressSeparatorIndex : eventColumnIndex;
+        dispatchGridEvent(event, gridEventType, eventHeaderXY, columnIndex);
     }
     
     /**
@@ -884,33 +1134,32 @@ public class GridColumnHeaderGroup exten
      */    
     protected function gchg_mouseMoveHandler(event:MouseEvent):void
     {
-        const eventStageXY:Point = new Point(event.stageX, event.stageY);
-        const eventHeaderGroupXY:Point = globalToLocal(eventStageXY);
-        const eventSeparatorIndex:int = getSeparatorIndexAt(eventHeaderGroupXY.x, 0);
-        const eventColumnIndex:int = 
-            (eventSeparatorIndex == -1) ? getHeaderIndexAt(eventHeaderGroupXY.x, 0) : -1;
+        const eventHeaderCP:CellPosition = new CellPosition();
+        const eventHeaderXY:Point = new Point();
+        if (!eventToHeaderLocations(event, eventHeaderCP, eventHeaderXY))
+            return;
+        
+        const eventSeparatorIndex:int = eventHeaderCP.rowIndex;
+        const eventColumnIndex:int = (eventSeparatorIndex == -1) ? eventHeaderCP.columnIndex
: -1;        
         
         if (eventSeparatorIndex != rollSeparatorIndex)
         {
             if (rollSeparatorIndex != -1)
-                dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OUT, eventHeaderGroupXY,
rollSeparatorIndex);
+                dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OUT, eventHeaderXY, rollSeparatorIndex);
             if (eventSeparatorIndex != -1)
-                dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OVER, eventHeaderGroupXY,
eventSeparatorIndex);
+                dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OVER, eventHeaderXY, eventSeparatorIndex);
         } 
         
         if (eventColumnIndex != rollColumnIndex)
         {
             if (rollColumnIndex != -1)
-                dispatchGridEvent(event, GridEvent.GRID_ROLL_OUT, eventHeaderGroupXY, rollColumnIndex);
+                dispatchGridEvent(event, GridEvent.GRID_ROLL_OUT, eventHeaderXY, rollColumnIndex);
             if (eventColumnIndex != -1)
-                dispatchGridEvent(event, GridEvent.GRID_ROLL_OVER, eventHeaderGroupXY, eventColumnIndex);
+                dispatchGridEvent(event, GridEvent.GRID_ROLL_OVER, eventHeaderXY, eventColumnIndex);
         } 
         
         rollColumnIndex = eventColumnIndex;
         rollSeparatorIndex = eventSeparatorIndex;
-        
-        // update renderer property
-        hoverColumnIndex = eventColumnIndex;
     }
     
     /**
@@ -929,19 +1178,15 @@ public class GridColumnHeaderGroup exten
      */       
     protected function gchg_mouseRollOutHandler(event:MouseEvent):void
     {
-        const eventStageXY:Point = new Point(event.stageX, event.stageY);
-        const eventHeaderGroupXY:Point = globalToLocal(eventStageXY);
+        const eventHeaderXY:Point = globalToLocal(new Point(event.stageX, event.stageY));
     
         
         if (rollSeparatorIndex != -1)
-            dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OUT, eventHeaderGroupXY, rollSeparatorIndex);
+            dispatchGridEvent(event, GridEvent.SEPARATOR_ROLL_OUT, eventHeaderXY, rollSeparatorIndex);
         else if (rollColumnIndex != -1)
-            dispatchGridEvent(event, GridEvent.GRID_ROLL_OUT, eventHeaderGroupXY, rollColumnIndex);
+            dispatchGridEvent(event, GridEvent.GRID_ROLL_OUT, eventHeaderXY, rollColumnIndex);
 
         rollColumnIndex = -1;
         rollSeparatorIndex = -1;
-        
-        // update renderer property
-        hoverColumnIndex = -1;
     }
     
     /**
@@ -961,16 +1206,18 @@ public class GridColumnHeaderGroup exten
      */       
     protected function gchg_clickHandler(event:MouseEvent):void 
     {
-        const eventStageXY:Point = new Point(event.stageX, event.stageY);
-        const eventHeaderGroupXY:Point = globalToLocal(eventStageXY);
-        const eventSeparatorIndex:int = getSeparatorIndexAt(eventHeaderGroupXY.x, 0);
-        const eventColumnIndex:int = 
-            (eventSeparatorIndex == -1) ? getHeaderIndexAt(eventHeaderGroupXY.x, 0) : -1;
+        const eventHeaderCP:CellPosition = new CellPosition();
+        const eventHeaderXY:Point = new Point();
+        if (!eventToHeaderLocations(event, eventHeaderCP, eventHeaderXY))
+            return;
+        
+        const eventSeparatorIndex:int = eventHeaderCP.rowIndex;
+        const eventColumnIndex:int = (eventSeparatorIndex == -1) ? eventHeaderCP.columnIndex
: -1;              
         
         if ((eventSeparatorIndex != -1) && (pressSeparatorIndex == eventSeparatorIndex))
-            dispatchGridEvent(event, GridEvent.SEPARATOR_CLICK, eventHeaderGroupXY, eventSeparatorIndex);
+            dispatchGridEvent(event, GridEvent.SEPARATOR_CLICK, eventHeaderXY, eventSeparatorIndex);
         else if ((eventColumnIndex != -1) && (pressColumnIndex == eventColumnIndex))
-            dispatchGridEvent(event, GridEvent.GRID_CLICK, eventHeaderGroupXY, eventColumnIndex);
+            dispatchGridEvent(event, GridEvent.GRID_CLICK, eventHeaderXY, eventColumnIndex);
     }
     
     /**
@@ -991,16 +1238,18 @@ public class GridColumnHeaderGroup exten
      */       
     protected function gchg_doubleClickHandler(event:MouseEvent):void 
     {
-        const eventStageXY:Point = new Point(event.stageX, event.stageY);
-        const eventHeaderGroupXY:Point = globalToLocal(eventStageXY);
-        const eventSeparatorIndex:int = getSeparatorIndexAt(eventHeaderGroupXY.x, 0);
-        const eventColumnIndex:int = 
-            (eventSeparatorIndex == -1) ? getHeaderIndexAt(eventHeaderGroupXY.x, 0) : -1;
+        const eventHeaderCP:CellPosition = new CellPosition();
+        const eventHeaderXY:Point = new Point();
+        if (!eventToHeaderLocations(event, eventHeaderCP, eventHeaderXY))
+            return;
+        
+        const eventSeparatorIndex:int = eventHeaderCP.rowIndex;
+        const eventColumnIndex:int = (eventSeparatorIndex == -1) ? eventHeaderCP.columnIndex
: -1;             
         
         if ((eventSeparatorIndex != -1) && (pressSeparatorIndex == eventSeparatorIndex))
-            dispatchGridEvent(event, GridEvent.SEPARATOR_DOUBLE_CLICK, eventHeaderGroupXY,
eventSeparatorIndex);
+            dispatchGridEvent(event, GridEvent.SEPARATOR_DOUBLE_CLICK, eventHeaderXY, eventSeparatorIndex);
         else if ((eventColumnIndex != -1) && (pressColumnIndex == eventColumnIndex))
-            dispatchGridEvent(event, GridEvent.GRID_DOUBLE_CLICK, eventHeaderGroupXY, eventColumnIndex);
+            dispatchGridEvent(event, GridEvent.GRID_DOUBLE_CLICK, eventHeaderXY, eventColumnIndex);
     }    
     
     /**
@@ -1046,5 +1295,32 @@ public class GridColumnHeaderGroup exten
         const columns:IList = grid.columns;
         return ((columnIndex >= 0) && (columnIndex < columns.length)) ? columns.getItemAt(columnIndex)
as GridColumn : null;
     }
+	
+	/**
+	 *  @private
+	 */
+	private function getColumnHeaderViewAtX(x:Number):Group
+	{
+        const ghl:GridHeaderLayout = layout as GridHeaderLayout;
+        
+		if (ghl.leftGridColumnHeaderView && (x < ghl.centerGridColumnHeaderView.getLayoutBoundsX()))
+			return ghl.leftGridColumnHeaderView;
+		
+		return ghl.centerGridColumnHeaderView;
+	}
+
+	/**
+	 *  @private
+	 */
+	private function getColumnHeaderViewAtIndex(columnIndex:int):Group
+	{
+        const ghl:GridHeaderLayout = layout as GridHeaderLayout;
+        
+		if (ghl.leftGridColumnHeaderView && (columnIndex < dataGrid.lockedColumnCount))
+			return ghl.leftGridColumnHeaderView;
+		
+		return ghl.centerGridColumnHeaderView;
+	}
+	
 }    
 }
\ No newline at end of file

Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Group.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Group.as?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Group.as
(original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Group.as
Mon Aug  6 21:25:54 2012
@@ -23,9 +23,9 @@ package spark.components 
 import flash.display.BlendMode;
 import flash.display.DisplayObject;
 import flash.geom.Rectangle;
+import flash.utils.Dictionary;
 
 import mx.core.FlexVersion;
-import mx.styles.IAdvancedStyleClient;
 import mx.core.IFlexModule;
 import mx.core.IFontContextComponent;
 import mx.core.IUIComponent;
@@ -43,6 +43,8 @@ import mx.graphics.shaderClasses.HueShad
 import mx.graphics.shaderClasses.LuminosityShader;
 import mx.graphics.shaderClasses.SaturationShader;
 import mx.graphics.shaderClasses.SoftLightShader;
+import mx.styles.AdvancedStyleClient;
+import mx.styles.IAdvancedStyleClient;
 import mx.styles.ISimpleStyleClient;
 import mx.styles.IStyleClient;
 import mx.styles.StyleProtoChain;
@@ -239,6 +241,7 @@ public class Group extends GroupBase imp
     private var needsDisplayObjectAssignment:Boolean = false;
     private var layeringMode:uint = ITEM_ORDERED_LAYERING;
     private var numGraphicElements:uint = 0;
+    private var deferredStyleClients:Dictionary = null;  // of IAdvancedStyleClient
     
     private static const ITEM_ORDERED_LAYERING:uint = 0;
     private static const SPARSE_LAYERING:uint = 1;    
@@ -841,6 +844,37 @@ public class Group extends GroupBase imp
     
     /**
      *  @private
+     *  Defer adding IAdvancedStyleClients until createChildren() time.  The AdvancedStyleClient's
+     *  styleName might be a component's show inclusion in the IVisualElement hierarchy was
also
+     *  deferred.
+     */ 
+    override public function addStyleClient(styleClient:IAdvancedStyleClient):void    
+    {
+        if (!createChildrenCalled)
+        {
+            if (!deferredStyleClients)
+                deferredStyleClients = new Dictionary(true);
+            deferredStyleClients[styleClient] = true;
+        }
+        else 
+        {
+            super.addStyleClient(styleClient);
+        }
+    }
+    
+    /**
+     *  @private
+     */     
+    override public function removeStyleClient(styleClient:IAdvancedStyleClient):void
+    {
+        if (deferredStyleClients && !createChildrenCalled)
+            delete deferredStyleClients[styleClient];
+        else
+            super.removeStyleClient(styleClient);
+    }
+    
+    /**
+     *  @private
      *  Whether createChildren() has been called or not.
      *  We use this in the setter for mxmlContent to know 
      *  whether to validate the value immediately, or just 
@@ -862,6 +896,17 @@ public class Group extends GroupBase imp
             mxmlContentChanged = false;
             setMXMLContent(_mxmlContent);
         }
+        
+        if (deferredStyleClients)
+        {
+            for (var obj:Object in deferredStyleClients)
+            {
+                var styleClient:IAdvancedStyleClient = obj as IAdvancedStyleClient;
+                if (styleClient)
+                    super.addStyleClient(styleClient);
+            }
+            deferredStyleClients = null;
+        }        
     }
     
     /**

Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Label.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Label.as?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Label.as
(original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/components/Label.as
Mon Aug  6 21:25:54 2012
@@ -188,9 +188,6 @@ include "../styles/metadata/BasicNonInhe
  *
  *  <pre>
  *  &lt;s:Label 
- *    <strong>Properties</strong>
- *    fontContext=""
- * 
  *    <strong>Styles</strong>
  *    alignmentBaseline="baseline"
  *    baselineShift="0"



Mime
View raw message