flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mkess...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-33665: Corrected the item edit coordinates to match it's renderer and not it's dataprovider. It also seems the added whitespace in the file has been removed.
Date Tue, 13 Aug 2013 02:20:49 GMT
Updated Branches:
  refs/heads/develop c6b5dc7a4 -> 412c07190


FLEX-33665: Corrected the item edit coordinates to match it's renderer and not it's dataprovider.  It also seems the added whitespace in the file has been removed.


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/412c0719
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/412c0719
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/412c0719

Branch: refs/heads/develop
Commit: 412c0719097cfe8dcedab5e28365f6c71087f651
Parents: c6b5dc7
Author: Mark Kessler <KesslerConsulting@gmail.com>
Authored: Mon Aug 12 22:17:48 2013 -0400
Committer: Mark Kessler <KesslerConsulting@gmail.com>
Committed: Mon Aug 12 22:19:45 2013 -0400

----------------------------------------------------------------------
 .../components/gridClasses/DataGridEditor.as    | 753 ++++++++++---------
 1 file changed, 387 insertions(+), 366 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/412c0719/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as b/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
index 06ee8d4..1a8cd96 100644
--- a/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
+++ b/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
@@ -59,13 +59,13 @@ use namespace mx_internal;
 [ExcludeClass]
 
 /**
- *  The DataGridEditor contains all the logic and event handling needed to 
- *  manage the life cycle of an item editor. 
- *  A DataGridEditor is owned by a 
+ *  The DataGridEditor contains all the logic and event handling needed to
+ *  manage the life cycle of an item editor.
+ *  A DataGridEditor is owned by a
  *  specified DataGrid. The owning DataGrid is responsible for calling
- *  initialize() to enable editing and uninitialize() when editing is no 
+ *  initialize() to enable editing and uninitialize() when editing is no
  *  longer needed.
- * 
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.5
@@ -73,7 +73,7 @@ use namespace mx_internal;
  */
 public class DataGridEditor
 {
-    include "../../core/Version.as";    
+    include "../../core/Version.as";
 
     //--------------------------------------------------------------------------
     //
@@ -83,7 +83,7 @@ public class DataGridEditor
 
     /**
      *  Constructor
-     * 
+     *
      *  @param dataGrid The owner of this editor.
      *
      *  @langversion 3.0
@@ -94,9 +94,9 @@ public class DataGridEditor
     public function DataGridEditor(dataGrid:DataGrid)
     {
         _dataGrid = dataGrid;
-        
+
     }
-    
+
     //--------------------------------------------------------------------------
     //
     //  Variables
@@ -107,7 +107,7 @@ public class DataGridEditor
      *  Timer used to cancel edits if a double click occurs.
      */
     private var doubleClickTimer:Timer;
-    
+
     /**
      *  @private
      *  True if we have received double click event since the last click.
@@ -119,7 +119,7 @@ public class DataGridEditor
      *  True if we have received a FlexEvent.ENTER.
      */
     private var gotFlexEnterEvent:Boolean;
-    
+
     /**
      *  @private
      */
@@ -130,22 +130,22 @@ public class DataGridEditor
      *  Position of the last item renderer that was clicked.
      */
     private var lastItemClickedPosition:Object;
-    
+
     /**
      *  @private
      *  Used to make sure the mouse up is on the same item
      *  renderer as the mouse down.
      */
     private var lastItemDown:IVisualElement;
-    
+
     /**
      *  @private
      *  the last editedItemPosition and the last
      *  position where editing was attempted if editing
-     *  was cancelled.  
+     *  was cancelled.
      */
     private var lastEditedItemPosition:*;
-    
+
     /**
      *  @private
      *  Determines if the hasFocusableChildren flags are restored when
@@ -161,7 +161,7 @@ public class DataGridEditor
      *  Used to restore the value of DataGrid's hasFocusableChildren.
      */
     private var saveDataGridHasFocusableChildren:Boolean;
-    
+
     /**
      *  @private
      *  Used to restore the value of scroller's hasFocusableChildren.
@@ -185,32 +185,32 @@ public class DataGridEditor
      */
     public function get dataGrid():DataGrid
     {
-        return _dataGrid;    
+        return _dataGrid;
     }
-    
+
     /**
      *  @private
      *  Convenience property to get the grid.
      */
     public function get grid():Grid
     {
-        return _dataGrid.grid;        
+        return _dataGrid.grid;
     }
 
     //----------------------------------
     //  editedItemPosition
     //----------------------------------
-    
+
     /**
      *  @private
      */
     private var _editedItemPosition:Object;
-    
+
     /**
      *  The column and row index of the item renderer for the
      *  data provider item being edited, if any.
      *
-     *  <p>This Object has two fields, <code>columnIndex</code> and 
+     *  <p>This Object has two fields, <code>columnIndex</code> and
      *  <code>rowIndex</code>,
      *  the zero-based column and row indexes of the item.
      *  For example: {columnIndex:2, rowIndex:3}</p>
@@ -220,7 +220,7 @@ public class DataGridEditor
      *  open an item editor on the specified item renderer.</p>
      *
      *  @default null
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -234,7 +234,7 @@ public class DataGridEditor
         else
             return _editedItemPosition;
     }
-    
+
     /**
      *  @private
      */
@@ -245,13 +245,13 @@ public class DataGridEditor
             setEditedItemPosition(null);
             return;
         }
-        
+
         var newValue:Object = {rowIndex: value.rowIndex,
             columnIndex: value.columnIndex};
-        
+
         setEditedItemPosition(newValue);
     }
-    
+
     /**
      *  @private
      */
@@ -259,10 +259,10 @@ public class DataGridEditor
     {
         if (!grid.enabled || !dataGrid.editable)
             return;
-        
+
         if (!grid.dataProvider || grid.dataProvider.length == 0)
             return;
-        
+
         // just give focus back to the itemEditorInstance
         if (itemEditorInstance && coord &&
             itemEditorInstance is IFocusManagerComponent &&
@@ -272,57 +272,66 @@ public class DataGridEditor
             IFocusManagerComponent(itemEditorInstance).setFocus();
             return;
         }
-        
+
         // dispose of any existing editor, saving away its data first
         if (itemEditorInstance)
         {
             if (!dataGrid.endItemEditorSession())
                 return;
         }
-        
+
         // store the value
         _editedItemPosition = coord;
-        
+
         // allow setting of undefined to dispose item editor instance
         if (!coord)
             return;
-        
+
         var rowIndex:int = coord.rowIndex;
         var columnIndex:int = coord.columnIndex;
-        
+
         dataGrid.ensureCellIsVisible(rowIndex, columnIndex);
-        
+
         createItemEditor(rowIndex, columnIndex);
-        
+
+
+        //If the item edit renderer is not setup abort the item editing.
+        if (_editedItemRenderer == null)
+        {
+            _editedItemPosition = null;
+            return;
+        }
+
+
         if (itemEditorInstance is IInvalidating)
             IInvalidating(itemEditorInstance).validateNow();
-        
+
         var column:GridColumn = dataGrid.columns.getItemAt(columnIndex) as GridColumn;
         if (itemEditorInstance is IIMESupport)
             IIMESupport(itemEditorInstance).imeMode =
                 (column.imeMode == null) ? dataGrid.imeMode : column.imeMode;
-        
+
         var fm:IFocusManager = grid.focusManager;
         if (itemEditorInstance is IFocusManagerComponent)
         {
             // Temporarily remove the FOCUS_OUT handler: if we give the editor the focus and
-            // it immediately vectors it to a non-editor descendant, like to the mobile soft 
+            // it immediately vectors it to a non-editor descendant, like to the mobile soft
             // keyboard, we don't want to end the editor session.
-            
-            itemEditorInstance.removeEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);            
+
+            itemEditorInstance.removeEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
             fm.setFocus(IFocusManagerComponent(itemEditorInstance));
-            itemEditorInstance.addEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);             
+            itemEditorInstance.addEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
         }
-        
+
         lastEditedItemPosition = _editedItemPosition;
-        
+
         // Notify event that a new editor is starting.
         // Don't dispatch life cycle events for item renderers.
         var dataGridEvent:GridItemEditorEvent = null;
-        
+
         if (column.rendererIsEditable == false)
             dataGridEvent = new GridItemEditorEvent(GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_START);
-        
+
         if (dataGridEvent)
         {
             dataGridEvent.columnIndex = editedItemPosition.columnIndex;
@@ -338,17 +347,17 @@ public class DataGridEditor
      *  some timing issues with collection updates
      */
     private var inEndEdit:Boolean = false;
-    
+
     /**
-     *  A reference to the currently active instance of the item editor, 
+     *  A reference to the currently active instance of the item editor,
      *  if it exists.
      *
-     *  <p>To access the item editor instance and the new item value when an 
-     *  item is being edited, you use the <code>itemEditorInstance</code> 
+     *  <p>To access the item editor instance and the new item value when an
+     *  item is being edited, you use the <code>itemEditorInstance</code>
      *  property. The <code>itemEditorInstance</code> property
      *  is not valid until after the event listener for
      *  the <code>itemEditBegin</code> event executes. Therefore, you typically
-     *  only access the <code>itemEditorInstance</code> property from within 
+     *  only access the <code>itemEditorInstance</code> property from within
      *  the event listener for the <code>itemEditEnd</code> event.</p>
      *
      *  <p>The <code>DataGridColumn.itemEditor</code> property defines the
@@ -356,20 +365,20 @@ public class DataGridEditor
      *  and, therefore, the data type of the item editor instance.</p>
      *
      *  <p>You do not set this property in MXML.</p>
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
     public var itemEditorInstance:IGridItemEditor;
-    
-    
+
+
     /**
      *  @private
      */
     private var _editedItemRenderer:IVisualElement;
-    
+
     /**
      *  A reference to the item renderer
      *  in the DataGrid control whose item is currently being edited.
@@ -378,7 +387,7 @@ public class DataGridEditor
      *  and <code>itemEditEnd</code> events,
      *  you can access the current value of the item being edited
      *  using the <code>editedItemRenderer.data</code> property.</p>
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -388,17 +397,17 @@ public class DataGridEditor
     {
         return _editedItemRenderer;
     }
-    
+
     //----------------------------------
     //  editorColumnIndex
     //----------------------------------
-    
+
     /**
-     *  The zero-based column index of the cell that is being edited. The 
+     *  The zero-based column index of the cell that is being edited. The
      *  value is -1 if no cell is being edited.
-     * 
+     *
      *  @default -1
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -408,20 +417,20 @@ public class DataGridEditor
     {
         if (editedItemPosition)
             return editedItemPosition.columnIndex;
-        
+
         return -1;
     }
-    
+
     //----------------------------------
     //  editorRowIndex
     //----------------------------------
-    
+
     /**
-     *  The zero-based row index of the cell that is being edited. The 
+     *  The zero-based row index of the cell that is being edited. The
      *  value is -1 if no cell is being edited.
-     * 
+     *
      *  @default -1
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -431,7 +440,7 @@ public class DataGridEditor
     {
         if (editedItemPosition)
             return editedItemPosition.rowIndex;
-        
+
         return -1;
     }
 
@@ -440,50 +449,50 @@ public class DataGridEditor
     //  Methods
     //
     //--------------------------------------------------------------------------
-    
+
     /**
      *  @private
      *  Called by the data grid after construction to initialize the editor. No
      *  item editors can be created until after this method is called.
-     */  
+     */
     public function initialize():void
     {
         // add listeners to enable cell editing
         var grid:Grid = dataGrid.grid;
-        
+
         dataGrid.addEventListener(KeyboardEvent.KEY_DOWN, dataGrid_keyboardDownHandler);
-        
-        // Make sure we get first shot at mouse events before selection is changed. We use 
+
+        // Make sure we get first shot at mouse events before selection is changed. We use
         // this is test if you are clicking on a selected row or not.
         grid.addEventListener(GridEvent.GRID_MOUSE_DOWN, grid_gridMouseDownHandler, false, 1000);
         grid.addEventListener(GridEvent.GRID_MOUSE_UP, grid_gridMouseUpHandler, false, 1000);
         grid.addEventListener(GridEvent.GRID_DOUBLE_CLICK, grid_gridDoubleClickHandler);
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  The method is called to disable item editing on the data grid.
-     */ 
+     */
     public function uninitialize():void
     {
-        // remove listeners to disable cell editing   
-        
+        // remove listeners to disable cell editing
+
         grid.removeEventListener(KeyboardEvent.KEY_DOWN, dataGrid_keyboardDownHandler);
         grid.removeEventListener(GridEvent.GRID_MOUSE_DOWN, grid_gridMouseDownHandler);
         grid.removeEventListener(GridEvent.GRID_MOUSE_UP, grid_gridMouseUpHandler);
         grid.removeEventListener(GridEvent.GRID_DOUBLE_CLICK, grid_gridDoubleClickHandler);
     }
-    
+
     /**
      *  @private
-     *  
-     *  This method closes an item editor currently open on an item renderer. 
-     *  You typically only call this method from within the event listener 
+     *
+     *  This method closes an item editor currently open on an item renderer.
+     *  You typically only call this method from within the event listener
      *  for the <code>itemEditEnd</code> event, after
-     *  you have already called the <code>preventDefault()</code> method to 
+     *  you have already called the <code>preventDefault()</code> method to
      *  prevent the default event listener from executing.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -494,64 +503,64 @@ public class DataGridEditor
         // trace("destroyItemEditor");
         if (grid.root)
             grid.systemManager.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
-        
+
         grid.systemManager.getSandboxRoot().
             removeEventListener(MouseEvent.MOUSE_DOWN, sandBoxRoot_mouseDownHandler, true);
         grid.systemManager.getSandboxRoot().
             removeEventListener(SandboxMouseEvent.MOUSE_DOWN_SOMEWHERE, sandBoxRoot_mouseDownHandler);
         grid.systemManager.removeEventListener(Event.RESIZE, editorAncestorResizeHandler);
         dataGrid.removeEventListener(Event.RESIZE, editorAncestorResizeHandler);
-        
+
         if (itemEditorInstance || editedItemRenderer)
         {
             if (itemEditorInstance)
                 itemEditorInstance.discard();
-            
-            var o:IVisualElement = (itemEditorInstance ? 
+
+            var o:IVisualElement = (itemEditorInstance ?
                                     itemEditorInstance : editedItemRenderer);
-            
+
             o.removeEventListener(KeyboardEvent.KEY_DOWN, editor_keyDownHandler);
             o.removeEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
             o.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, editor_keyFocusChangeHandler);
             addRemoveFlexEventEnterListener(DisplayObject(o), false);
-            
+
             if (grid.focusManager)
                 grid.focusManager.defaultButtonEnabled = true;
-            
+
             // setfocus back to us so something on stage has focus
             dataGrid.setFocus();
-            
+
             // defer focus can cause focusOutHandler to destroy the editor
             // and make itemEditorInstance null
             if (itemEditorInstance)
                 grid.removeElement(itemEditorInstance);
             else
                 grid.invalidateDisplayList();   // force the editorIndicator to be redrawn
-            
+
             if (restoreFocusableChildren)
             {
                 restoreFocusableChildrenFlags();
             }
-            
+
             itemEditorInstance = null;
             _editedItemRenderer = null;
             _editedItemPosition = null;
         }
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Creates the item editor for the item renderer at the
      *  <code>editedItemPosition</code> using the editor
      *  specified by the <code>itemEditor</code> property.
      *
-     *  <p>This method sets the editor instance as the 
+     *  <p>This method sets the editor instance as the
      *  <code>itemEditorInstance</code> property.</p>
      *
      *  @param rowIndex The row index in the data provider of the item to be edited.
      *  @param columnIndex The column index in the data provider of the item to be edited.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -562,29 +571,41 @@ public class DataGridEditor
         // check for bad values
         if (columnIndex >= grid.columns.length)
             return;
-        
+
+
+        //Correction for the item editor positioning
+        var rendererColumnIndex:int = grid.getVisibleColumnIndices().indexOf(columnIndex);
+        var rendererRowIndex:int = grid.getVisibleRowIndices().indexOf(rowIndex);
+
+        //If the renderer row/column can't be found, cancel the item editor.
+        if (rendererColumnIndex == -1 || rendererRowIndex == -1)
+        {
+            return;
+        }
+
+
         var col:GridColumn = grid.columns.getItemAt(columnIndex) as GridColumn;
         var item:IGridItemRenderer = grid.getItemRendererAt(rowIndex, columnIndex);
-        var cellBounds:Rectangle = grid.getCellBounds(rowIndex,columnIndex);
+        var cellBounds:Rectangle = grid.getCellBounds(rendererRowIndex, rendererColumnIndex);
         var localCellOrigin:Point = cellBounds.topLeft;
-        
+
         _editedItemRenderer = item;
-        
+
        // Need to turn on focusable children flag so focus manager will
         // allow focus into the data grid's children.
         if (restoreFocusableChildren)
-            saveDataGridHasFocusableChildren = dataGrid.hasFocusableChildren; 
+            saveDataGridHasFocusableChildren = dataGrid.hasFocusableChildren;
         dataGrid.hasFocusableChildren = true;
-        
+
         if (dataGrid.scroller)
         {
             if (restoreFocusableChildren)
-                saveScrollerHasFocusableChildren = dataGrid.scroller.hasFocusableChildren; 
+                saveScrollerHasFocusableChildren = dataGrid.scroller.hasFocusableChildren;
             dataGrid.scroller.hasFocusableChildren = true;
         }
-        
+
         restoreFocusableChildren = true;
-        
+
         if (!col.rendererIsEditable)
         {
             // First use the column's itemEditor.
@@ -596,7 +617,7 @@ public class DataGridEditor
                 itemEditor = dataGrid.itemEditor;
             if (!itemEditor)
                 itemEditor = GridColumn.defaultItemEditorFactory;
-            
+
             if (itemEditor == GridColumn.defaultItemEditorFactory)
             {
                 // if it is the default factory, see if someone
@@ -607,7 +628,7 @@ public class DataGridEditor
                     itemEditor = col.itemEditor = new ClassFactory(c);
                 }
             }
-            
+
             itemEditorInstance = itemEditor.newInstance();
             itemEditorInstance.owner = dataGrid;
             itemEditorInstance.rowIndex = rowIndex;
@@ -616,25 +637,25 @@ public class DataGridEditor
 
             if (itemEditorInstance is ISimpleStyleClient)
                 ISimpleStyleClient(itemEditorInstance).styleName = item;
-            
+
             // Add the editor to the grid before setting the data so that
             // the editor's children will be created.
             grid.addElement(itemEditorInstance);
-            
+
             itemEditorInstance.data = item.data;
-            
-            // The editor will overlay the cell, covering the first pixel of the 
-            // cell separators. This is done so that a cell editor with borders 
+
+            // The editor will overlay the cell, covering the first pixel of the
+            // cell separators. This is done so that a cell editor with borders
             // will overlay the cell separators. It prevents the cell separators
             // from adding borders to the editor for the common case when the cell
             // separators are only 1 pixel wide.
             itemEditorInstance.width = cellBounds.width + 1;
             itemEditorInstance.height = cellBounds.height + 1;
             itemEditorInstance.setLayoutBoundsPosition(localCellOrigin.x, localCellOrigin.y);
-            
+
             if (itemEditorInstance is IInvalidating)
                 IInvalidating(itemEditorInstance).validateNow();
-            
+
             // Allow the user code to make any final adjustments and make the editor visible.
             itemEditorInstance.prepare();
             itemEditorInstance.visible = true;
@@ -643,29 +664,29 @@ public class DataGridEditor
         {
             setFocusInItemRenderer(item);
         }
-        
+
         if (itemEditorInstance || editedItemRenderer)
         {
             var editor:IEventDispatcher = itemEditorInstance ? itemEditorInstance : editedItemRenderer;
-            
+
             editor.addEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
-            
+
             // listen for keyStrokes on the itemEditorInstance (which lets the grid supervise for ESC/ENTER)
             editor.addEventListener(KeyboardEvent.KEY_DOWN, editor_keyDownHandler);
             editor.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, editor_keyFocusChangeHandler, false, 1000);
             addRemoveFlexEventEnterListener(DisplayObject(editor), true);
-            
+
         }
-        
+
         if (grid.focusManager)
             grid.focusManager.defaultButtonEnabled = false;
 
         // Invalidate the grid so the editor indicator will be shown.
         grid.invalidateDisplayList();
-        
+
         if (grid.root)
             grid.systemManager.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
-        
+
         // we disappear on any mouse down outside the editor
         grid.systemManager.getSandboxRoot().
             addEventListener(MouseEvent.MOUSE_DOWN, sandBoxRoot_mouseDownHandler, true, 0, true);
@@ -673,12 +694,12 @@ public class DataGridEditor
             addEventListener(SandboxMouseEvent.MOUSE_DOWN_SOMEWHERE, sandBoxRoot_mouseDownHandler, false, 0, true);
         // we disappear if stage or our grid is resized
         grid.systemManager.addEventListener(Event.RESIZE, editorAncestorResizeHandler);
-        grid.addEventListener(Event.RESIZE, editorAncestorResizeHandler);        
+        grid.addEventListener(Event.RESIZE, editorAncestorResizeHandler);
     }
-    
+
     /**
      *  @private
-     */ 
+     */
     private function setFocusInItemRenderer(item:IGridItemRenderer):void
     {
         // if the item renderer is editable then set focus
@@ -689,14 +710,14 @@ public class DataGridEditor
             var o:DisplayObject = item as DisplayObject;
             var firstComponent:DisplayObject = null;
             var found:Boolean = false;
-            
+
             // find the first component to take focus inside the renderer.
             do
             {
                 fm.fauxFocus = o;
                 o = fm.getNextFocusManagerComponent(false) as DisplayObject;
-                if (o == item || 
-                    item is DisplayObjectContainer && 
+                if (o == item ||
+                    item is DisplayObjectContainer &&
                     DisplayObjectContainer(item).contains(o))
                 {
                     found = true;
@@ -708,9 +729,9 @@ public class DataGridEditor
                     firstComponent = o;
                 else if (firstComponent == o)
                     break;
-                
+
             } while (o && dataGrid.contains(o));
-            
+
             // if we are moving backward then put focus on the last
             // item in the renderer instead of the first.
             if (found && wasLastEventMovingBackward())
@@ -723,23 +744,23 @@ public class DataGridEditor
                     lastItem = o;
                     o = fm.getNextFocusManagerComponent(false) as DisplayObject;
                 } while (o && DisplayObjectContainer(item).contains(o));
-                
+
                 o = lastItem;
             }
-            
+
             fm.fauxFocus = null;
-            
+
             if (found)
             {
                 fm.setFocus(IFocusManagerComponent(o));
-                
+
                 // Since we may have gotton here with the F2 key show the focus
                 // indicator to make it obvious which control has focus.
                 fm.showFocus();
             }
         }
     }
-    
+
     /**
      *  @private
      */
@@ -753,51 +774,51 @@ public class DataGridEditor
             {
                 return true;
             }
-            
+
             // Last event was Shift+TAB
-            if (lastEvent.type == KeyboardEvent.KEY_DOWN && 
+            if (lastEvent.type == KeyboardEvent.KEY_DOWN &&
                 KeyboardEvent(lastEvent).keyCode == Keyboard.TAB &&
                 KeyboardEvent(lastEvent).shiftKey)
             {
                 return true;
             }
         }
-        
+
         return false;
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Start editing a cell for a specified row and column index.
-     *  
+     *
      *  Dispatches a <code>GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING
-     *  </code> event. 
-     * 
+     *  </code> event.
+     *
      *  @param rowIndex The zero-based row index of the cell to edit.
-     * 
+     *
      *  @param columnIndex The zero-based column index of the cell to edit.
      */
     public function startItemEditorSession(rowIndex:int, columnIndex:int):Boolean
     {
-        
+
         // validate row and column index
         if (!isValidCellPosition(rowIndex, columnIndex))
             return false;
-            
+
         dataGrid.addEventListener(GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING,
                                   dataGrid_gridItemEditorSessionStartingHandler,
                                   false, EventPriority.DEFAULT_HANDLER);
-        
+
         var column:GridColumn = grid.columns.getItemAt(columnIndex) as GridColumn;
-        
+
         if (!column || !column.visible)
             return false;
-        
+
         // The START_GRID_ITEM_EDITOR_SESSION event is cancelable
         var dataGridEvent:GridItemEditorEvent = new GridItemEditorEvent(
-                                                        GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING, 
-                                                        false, true); 
+                                                        GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING,
+                                                        false, true);
         dataGridEvent.rowIndex = Math.min(rowIndex, grid.dataProvider.length - 1);
         dataGridEvent.columnIndex = Math.min(columnIndex, grid.columns.length - 1);
         dataGridEvent.column = column;
@@ -809,43 +830,43 @@ public class DataGridEditor
             dataGrid_gridItemEditorSessionStartingHandler(dataGridEvent);   // start editor session without the option to cancel
             editorStarted = true;
         }
-        else 
+        else
         {
-            editorStarted = dataGrid.dispatchEvent(dataGridEvent);         
+            editorStarted = dataGrid.dispatchEvent(dataGridEvent);
         }
-            
-        if (editorStarted) 
+
+        if (editorStarted)
         {
             lastEditedItemPosition = { columnIndex: columnIndex, rowIndex: rowIndex };
-            
+
             dataGrid.grid.caretRowIndex = rowIndex;
             dataGrid.grid.caretColumnIndex = columnIndex;
         }
-        
+
         restoreFocusableChildren = true;
         dataGrid.removeEventListener(GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING,
                                      dataGrid_gridItemEditorSessionStartingHandler);
-        
+
         return editorStarted;
     }
-    
+
     /**
      *  Closes the currently active editor and optionally saves the editor's value
      *  by calling the item editor's save() method.  If the cancel parameter is true,
      *  then the editor's cancel() method is called instead.
-     * 
-     *  @param cancel if true then the data in the editor is discarded, 
+     *
+     *  @param cancel if true then the data in the editor is discarded,
      *  otherwise it's saved.
-     * 
+     *
      *  @return true if the data in the editor was saved, false otherwise.
-     * 
+     *
      *  @see spark.components.IGridItemEditor
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.0
      *  @productversion Flex 4.5
-     */ 
+     */
     public function endItemEditorSession(cancel:Boolean = false):Boolean
     {
         if (cancel)
@@ -858,10 +879,10 @@ public class DataGridEditor
             return endEdit();
         }
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Close the item editor without saving the data.
      */
     mx_internal function cancelEdit():Boolean
@@ -885,14 +906,14 @@ public class DataGridEditor
             destroyItemEditor();
         }
 
-        return true;                   
+        return true;
 
     }
 
-    
+
     /**
      *  @private
-     * 
+     *
      *  Notify event that the editor session is cancelled.
      *  This event cannot be cancelled.
      */
@@ -900,19 +921,19 @@ public class DataGridEditor
     {
         var dataGridEvent:GridItemEditorEvent =
             new GridItemEditorEvent(GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_CANCEL);
-        
+
         dataGridEvent.columnIndex = editedItemPosition.columnIndex;
         dataGridEvent.column = itemEditorInstance.column;
         dataGridEvent.rowIndex = editedItemPosition.rowIndex;
         dataGrid.dispatchEvent(dataGridEvent);
     }
-    
+
     /**
      *  @private
-     * 
-     *  When the user finished editing an item, this method is called to close 
+     *
+     *  When the user finished editing an item, this method is called to close
      *  the editor and save the data.
-     *  
+     *
      */
     private function endEdit():Boolean
     {
@@ -924,13 +945,13 @@ public class DataGridEditor
             inEndEdit = false;
             return true;
         }
-        
+
         // this happens if the renderer is removed asynchronously ususally with FDS
         if (!itemEditorInstance)
             return false;
-        
+
         inEndEdit = true;
-        
+
         var itemPosition:Object = editedItemPosition;
         if (!saveItemEditorSession())
         {
@@ -938,14 +959,14 @@ public class DataGridEditor
             // If it can then dispatch a cancel event.
             if (itemEditorInstance.cancel())
                 dispatchCancelEvent();
-            
+
             inEndEdit = false;
             return false;
         }
-        
+
         var dataGridEvent:GridItemEditorEvent =
             new GridItemEditorEvent(GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_SAVE);
-        
+
         // GRID_ITEM_EDITOR_SESSION_SAVE events are NOT cancelable
         dataGridEvent.columnIndex = itemPosition.columnIndex;
         dataGridEvent.column = dataGrid.columns.getItemAt(itemPosition.columnIndex) as GridColumn;
@@ -953,69 +974,69 @@ public class DataGridEditor
         dataGrid.dispatchEvent(dataGridEvent);
 
         inEndEdit = false;
-        
+
         return true;
     }
-    
+
     /**
      *  @private
-     *  Save the editor session. The developer can still cancel out so the 
+     *  Save the editor session. The developer can still cancel out so the
      *  data may not be saved.
-     * 
+     *
      *  @return true if the data is saved, false otherwise.
      */
     private function saveItemEditorSession():Boolean
     {
         var dataSaved:Boolean = false;
-        
+
         if (itemEditorInstance)
         {
             dataSaved = itemEditorInstance.save();
-            
+
             if (dataSaved)
                 destroyItemEditor();
         }
-        
+
         return dataSaved;
     }
-    
+
     /**
      *  @private
-     *  Start an editor session in the next editable cell. 
+     *  Start an editor session in the next editable cell.
      *
      *  @param rowIndex zero-based row index to start search from, inclusive.
-     *  @param columnIndex zero-based column index to start search from, not inclusive. 
+     *  @param columnIndex zero-based column index to start search from, not inclusive.
      *  @param backward - if true move backward column by column and then row by row.
      *  If false, then move forward column by column, row by row.
-     * 
+     *
      *  @return true if an editor was opened, false otherwise.
-     * 
+     *
      */
     private function openEditorInNextEditableCell(rowIndex:int, columnIndex:int, backward:Boolean):Boolean
     {
         var nextCell:Point = new Point(rowIndex, columnIndex);
         var openedEditor:Boolean = false;
-        
+
         do
         {
             nextCell = getNextEditableCell(nextCell.x, nextCell.y, backward);
-            
+
             if (nextCell)
-                openedEditor = dataGrid.startItemEditorSession(nextCell.x, nextCell.y);                
+                openedEditor = dataGrid.startItemEditorSession(nextCell.x, nextCell.y);
         } while (nextCell && !openedEditor);
-        
+
         return openedEditor;
     }
-    
+
     /**
      *  @private
-     *  Find the next editable cell. 
-     * 
+     *  Find the next editable cell.
+     *
      *  @param rowIndex zero-based row index to start search from, inclusive.
-     *  @param columnIndex zero-based column index to start search from, not inclusive. 
+     *  @param columnIndex zero-based column index to start search from, not inclusive.
      *  @param backward - if true move backward column by column and then row by row.
      *  If false, then move forward column by column, row by row.
-     * 
+     *
      *  @return If an editable cell was found then return a Point with the x property
      *  containing the rowIndex and the y property containing the column index. If no
      *  editable cell was found then null is returned.
@@ -1032,7 +1053,7 @@ public class DataGridEditor
             var nextColumn:int = columnIndex + increment;
             if (nextColumn >= 0 && nextColumn < dataGrid.columns.length)
             {
-                columnIndex += increment;    
+                columnIndex += increment;
             }
             else
             {
@@ -1045,29 +1066,29 @@ public class DataGridEditor
                     return null;
             }
         } while (!canEditColumn(columnIndex));
-        
+
         return new Point(rowIndex, columnIndex);
     }
-    
-    
+
+
     /**
      *  @private
-     * 
+     *
      *  @param columnIndex
-     * 
+     *
      *  @return true if the column can be edited, false otherwise.
-     */ 
+     */
     private function canEditColumn(columnIndex:int):Boolean
     {
-        var column:GridColumn = grid.columns.getItemAt(columnIndex) as GridColumn; 
-        return (dataGrid.editable && 
+        var column:GridColumn = grid.columns.getItemAt(columnIndex) as GridColumn;
+        return (dataGrid.editable &&
                 column.editable &&
                 column.visible);
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Test if the cell was selected at the last selection snapshot.
      */
     private function wasCellPreviouslySelected(rowIndex:int, columnIndex:int):Boolean
@@ -1076,7 +1097,7 @@ public class DataGridEditor
             return dataGrid.selectionContainsIndex(rowIndex);
         else if (dataGrid.isCellSelectionMode())
             return dataGrid.selectionContainsCell(rowIndex, columnIndex);
-        
+
         return false;
     }
 
@@ -1084,25 +1105,25 @@ public class DataGridEditor
      *  @private
      *
      *  Determine if a cell position is valid.
-     * 
-     *  @return true if valid, false otherwise.  
+     *
+     *  @return true if valid, false otherwise.
      */
     private function isValidCellPosition(rowIndex:int, cellIndex:int):Boolean
     {
         if (rowIndex >= 0 && rowIndex < dataGrid.dataProvider.length &&
             cellIndex >= 0 && cellIndex < dataGrid.columns.length)
-        { 
+        {
             return true;
         }
-        
+
         return false;
     }
-    
+
     /**
      *  @private
-     *  
+     *
      *  Add a FlexEvent.ENTER listener to all child IVisualElements.
-     * 
+     *
      *  @param element add listener to element and its children.
      *  @param addListener if true add a listener, otherwise remove a listener.
      */
@@ -1112,7 +1133,7 @@ public class DataGridEditor
             element.addEventListener(FlexEvent.ENTER, editor_enterHandler);
         else
             element.removeEventListener(FlexEvent.ENTER, editor_enterHandler);
-        
+
         if (element is DisplayObjectContainer)
         {
             var container:DisplayObjectContainer = DisplayObjectContainer(element);
@@ -1120,7 +1141,7 @@ public class DataGridEditor
             for (var i:int = 0; i < n; i++)
             {
                 var child:DisplayObject = container.getChildAt(i);
-                
+
                 if (child is DisplayObjectContainer)
                 {
                     addRemoveFlexEventEnterListener(child, addListener);
@@ -1134,17 +1155,17 @@ public class DataGridEditor
                 }
             }
         }
-        
+
     }
-    
+
     /**
      *  @private
      *  Check if a mouse click occured within the editor.
-     * 
+     *
      *  @param event A MouseEvent or a SandboxMouseEvent
-     * 
+     *
      *  @return true if the target is within the editor, false otherwise.
-     */ 
+     */
     private function editorOwnsClick(event:Event):Boolean
     {
         if (event is MouseEvent)
@@ -1156,98 +1177,98 @@ public class DataGridEditor
 
         return false;
     }
-    
+
     /**
      *  @private
      *  Check if a child is contained within the editor using the owns() method.
      *  The editor can be either editedItemRenderer or itemEditorInstance.
-     * 
+     *
      *  @param child child to test.
      *  @return true if the child is owned by the editor.
-     */ 
+     */
     private function editorOwns(child:IUIComponent):Boolean
     {
         return (itemEditorInstance &&
-                (itemEditorInstance == child || 
+                (itemEditorInstance == child ||
                     IUIComponent(itemEditorInstance).owns(DisplayObject(child))) ||
             (editedItemRenderer &&
-                (editedItemRenderer == child || 
+                (editedItemRenderer == child ||
                      IUIComponent(editedItemRenderer).owns(DisplayObject(child)))));
     }
- 
+
     /**
      *  @private
      *  The IUIComponent related to a given object. If the object is not a IUIComponent
-     *  then work up the display list until we find a IUIComponent. 
+     *  then work up the display list until we find a IUIComponent.
      *  @param  displayObject The object to get a IUIComponet from.
-     *  @return returns the displayObject if it is a display object or its 
-     *  closest parent that is a display object. 
-     */ 
+     *  @return returns the displayObject if it is a display object or its
+     *  closest parent that is a display object.
+     */
     private function getIUIComponent(displayObject:DisplayObject):IUIComponent
     {
         if (displayObject is IUIComponent)
             return IUIComponent(displayObject);
-        
+
         var current:DisplayObject = displayObject.parent;
         while (current)
         {
             if (current is IUIComponent)
                 return IUIComponent(current);
-            
+
             current = current.parent;
         }
-        
+
         return null;
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Restore the focusable children flags.
-     */ 
+     */
     private function restoreFocusableChildrenFlags():void
     {
         dataGrid.hasFocusableChildren = saveDataGridHasFocusableChildren;
-        
+
         if (dataGrid.scroller)
             dataGrid.scroller.hasFocusableChildren = saveScrollerHasFocusableChildren;
 
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Get the effective mouse event that activates an editor.
      *  If the column has a setting, then use it. Otherwise use the setting on
      *  the data grid.
-     */ 
+     */
     private function getEditorActivationMouseEvent(columnIndex:int):String
     {
         var editorActivationMouseEvent:String = null;
-        
+
         if (columnIndex >= 0 && columnIndex < dataGrid.columns.length)
         {
-            var column:GridColumn = grid.columns.getItemAt(columnIndex) as GridColumn; 
-            editorActivationMouseEvent = column.editorActivationMouseEvent;    
+            var column:GridColumn = grid.columns.getItemAt(columnIndex) as GridColumn;
+            editorActivationMouseEvent = column.editorActivationMouseEvent;
         }
-        
+
         if (!editorActivationMouseEvent)
             editorActivationMouseEvent = dataGrid.editorActivationMouseEvent;
-        
+
         return editorActivationMouseEvent;
     }
-    
+
     //--------------------------------------------------------------------------
     //
     //  Event handlers
     //
     //--------------------------------------------------------------------------
-    
+
     /**
      *  @private
-     * 
+     *
      *  Default handler for the startItemEditorSession event.
-     * 
+     *
      */
     private function dataGrid_gridItemEditorSessionStartingHandler(event:GridItemEditorEvent):void
     {
@@ -1259,55 +1280,55 @@ public class DataGridEditor
         else if (!itemEditorInstance)
         {
             _editedItemPosition = null;
-            
+
             // return focus to the grid w/o selecting an item
             dataGrid.setFocus();
         }
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Handle the F2 key to start editing a cell.
      */
     private function dataGrid_keyboardDownHandler(event:KeyboardEvent):void
     {
         if (!dataGrid.editable || dataGrid.selectionMode == GridSelectionMode.NONE)
             return;
-        
+
         if (event.isDefaultPrevented())
             return;
-        
+
         lastEvent = event;
-        
+
         if (event.keyCode == dataGrid.editKey)
         {
             // ignore F2 if we are already editing a cell or the column is not
             // editable
             if (itemEditorInstance)
                 return;
-            
-            // Edit the last column edited. If no last column then try to 
+
+            // Edit the last column edited. If no last column then try to
             // edit the first column.
             var nextCell:Point = null;
             if (dataGrid.isRowSelectionMode())
             {
                 var lastColumn:int = lastEditedItemPosition ? lastEditedItemPosition.columnIndex : 0;
-                openEditorInNextEditableCell(dataGrid.grid.caretRowIndex, 
+                openEditorInNextEditableCell(dataGrid.grid.caretRowIndex,
                                                         lastColumn - 1,
                                                         false);
                 return;
             }
             else if (canEditColumn(grid.caretColumnIndex))
             {
-                dataGrid.startItemEditorSession(grid.caretRowIndex, grid.caretColumnIndex);                
+                dataGrid.startItemEditorSession(grid.caretRowIndex, grid.caretColumnIndex);
             }
-        }            
+        }
     }
-    
+
     /**
      *  @private
-     * 
+     *
      */
     private function grid_gridMouseDownHandler(event:GridEvent):void
     {
@@ -1321,24 +1342,24 @@ public class DataGridEditor
 
         if (!isValidCellPosition(event.rowIndex, event.columnIndex))
             return;
-        
+
         lastEvent = event;
-        
+
         const rowIndex:int = event.rowIndex;
         const columnIndex:int = event.columnIndex;
-        
+
         //trace("grid_gridMouseDownHandler: (rowIndex, columnIndex) = (" + rowIndex + "," + columnIndex + ")");
-        
+
         // item editor handling
         var r:IGridItemRenderer = event.itemRenderer;
-        
+
         lastItemDown = null;
-        
+
         // if selection is being modified with shift or ctrl keys then
         // don't start up an editor session.
         if (event.shiftKey || event.ctrlKey)
             return;
-        
+
         // if an editor is already up, close it without starting a new editor.
         if (itemEditorInstance)
         {
@@ -1350,68 +1371,68 @@ public class DataGridEditor
             }
             return;
         }
-        
+
         var editorActivationMouseEvent:String = getEditorActivationMouseEvent(columnIndex);
-        if (editorActivationMouseEvent != GridItemEditorActivationMouseEvent.SINGLE_CLICK && 
+        if (editorActivationMouseEvent != GridItemEditorActivationMouseEvent.SINGLE_CLICK &&
             editorActivationMouseEvent != GridItemEditorActivationMouseEvent.SINGLE_CLICK_ON_SELECTED_CELL)
         {
             return;     // not allowed to start editor on a single click
         }
-        
-        // Don't open and editor if the click was not on a previously selected 
-        // cell, unless that cell is an item renderer. We don't want to stop 
+
+        // Don't open and editor if the click was not on a previously selected
+        // cell, unless that cell is an item renderer. We don't want to stop
         // the item renderer from getting focus so start an edit session.
         const column:GridColumn = dataGrid.columns.getItemAt(columnIndex) as GridColumn;
-        if (r && 
-            (column.rendererIsEditable || 
-             (wasCellPreviouslySelected(rowIndex, columnIndex) && 
+        if (r &&
+            (column.rendererIsEditable ||
+             (wasCellPreviouslySelected(rowIndex, columnIndex) &&
                  editorActivationMouseEvent == GridItemEditorActivationMouseEvent.SINGLE_CLICK_ON_SELECTED_CELL) ||
              editorActivationMouseEvent == GridItemEditorActivationMouseEvent.SINGLE_CLICK))
         {
-            //trace("cell was previously selected: (" + rowIndex + "," + columnIndex + ")");  
+            //trace("cell was previously selected: (" + rowIndex + "," + columnIndex + ")");
             lastItemDown = r;
         }
-        
+
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  If clicked on a the same cell as mouse down then start editing the cell.
      */
     private function grid_gridMouseUpHandler(event:GridEvent):void
     {
         //trace("grid_gridMouseUpHandler");
-        
+
         if (!dataGrid.editable)
             return;
 
         if (!isValidCellPosition(event.rowIndex, event.columnIndex))
             return;
-        
+
         lastEvent = event;
-        
+
         const eventRowIndex:int = event.rowIndex;
         const eventColumnIndex:int = event.columnIndex;
-        
+
         // Only start an edit if the row is the only selected row.
         // Only start editing when one row is selected.
         if (dataGrid.selectionLength != 1)
             return;
-        
+
         const rowIndex:int = eventRowIndex;
         var columnIndex:int = eventColumnIndex;
-        
+
         var editorActivationMouseEvent:String = getEditorActivationMouseEvent(columnIndex);
-        if (editorActivationMouseEvent != GridItemEditorActivationMouseEvent.SINGLE_CLICK && 
+        if (editorActivationMouseEvent != GridItemEditorActivationMouseEvent.SINGLE_CLICK &&
             editorActivationMouseEvent != GridItemEditorActivationMouseEvent.SINGLE_CLICK_ON_SELECTED_CELL)
         {
             return;     // not allowed to start editor on a single click
         }
-        
+
         var r:IVisualElement = event.itemRenderer;
-        //trace("grid_gridMouseUpHandler: itemRenderer = " + event.itemRenderer);  
-        if (r && r != editedItemRenderer && 
+        //trace("grid_gridMouseUpHandler: itemRenderer = " + event.itemRenderer);
+        if (r && r != editedItemRenderer &&
             lastItemDown && lastItemDown == r)
         {
             if (columnIndex >= 0)
@@ -1424,81 +1445,81 @@ public class DataGridEditor
                         if (rowIndex == lastItemClickedPosition.rowIndex &&
                             columnIndex == lastItemClickedPosition.columnIndex)
                         {
-                            // Clicked on the same item again and we 
+                            // Clicked on the same item again and we
                             // already have a timer. Wait on the existing timer.
                             lastItemDown == null;
                             return;
                         }
-                        else 
+                        else
                         {
                             // Clicked on a different item. Stop the timer and start a new one
                             doubleClickTimer.stop();
                             doubleClickTimer = null;
                         }
                     }
-                    
+
                     lastItemClickedPosition = { columnIndex: columnIndex, rowIndex: rowIndex};
-                    
+
                     // If double click is not enabled or we want a double click to open an
                     // editor, then open the editor directly now. Otherwise start a timer
                     // and wait to see if a double click comes in that will cancel the edit.
-                    if (dataGrid.editOnDoubleClick || 
+                    if (dataGrid.editOnDoubleClick ||
                         InteractiveObject(lastItemDown).doubleClickEnabled == false)
                     {
                         // we don't need to wait on the time since editing double click is ok.
                         dataGrid.startItemEditorSession(rowIndex, columnIndex);
                     }
-                    else 
+                    else
                     {
                         doubleClickTimer = new Timer(dataGrid.doubleClickTime, 1);
                         doubleClickTimer.addEventListener(TimerEvent.TIMER, doubleClickTimerHandler);
-                        doubleClickTimer.start();                        
+                        doubleClickTimer.start();
                     }
                 }
             }
         }
-        
-        lastItemDown = null;            
+
+        lastItemDown = null;
     }
 
     /**
      *  @private
-     * 
+     *
      *  If clicked on a the same cell as mouse down then start editing the cell.
      */
     private function grid_gridDoubleClickHandler(event:GridEvent):void
     {
         //trace("grid_gridDoubleClickHandler: got double click");
-        
+
         if (!dataGrid.editable)
             return;
-        
+
         if (!isValidCellPosition(event.rowIndex, event.columnIndex))
             return;
-        
+
         lastEvent = event;
-        
+
         gotDoubleClickEvent = true;
-        
+
         // If double-click editing is enabled then start up and editor session.
         var editorActivationMouseEvent:String = getEditorActivationMouseEvent(event.columnIndex);
         if (editorActivationMouseEvent == GridItemEditorActivationMouseEvent.DOUBLE_CLICK)
             dataGrid.startItemEditorSession(event.rowIndex, event.columnIndex);
-            
+
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Timer for double click events.
      */
     private function doubleClickTimerHandler(event:TimerEvent):void
     {
         //trace("doubleClickTimerHandler");
-        
+
         doubleClickTimer.removeEventListener(TimerEvent.TIMER, doubleClickTimerHandler);
         doubleClickTimer = null;
-        
+
         if (!gotDoubleClickEvent)
         {
             dataGrid.startItemEditorSession(lastItemClickedPosition.rowIndex, lastItemClickedPosition.columnIndex);
@@ -1506,8 +1527,8 @@ public class DataGridEditor
 
         gotDoubleClickEvent = false;
     }
-    
-    
+
+
     /**
      *  @private
      */
@@ -1517,7 +1538,7 @@ public class DataGridEditor
         // focus back to the dataGrid.
         if (itemEditorInstance || editedItemRenderer)
         {
-            // If we can't save the data, say, because the data was invalid, 
+            // If we can't save the data, say, because the data was invalid,
             // then cancel the save.
             if (!dataGrid.endItemEditorSession())
             {
@@ -1526,7 +1547,7 @@ public class DataGridEditor
             dataGrid.setFocus();
         }
     }
-    
+
     /**
      *  @private
      *  Closes the itemEditorInstance if the focus is outside of the data grid.
@@ -1534,31 +1555,31 @@ public class DataGridEditor
     private function editor_focusOutHandler(event:FocusEvent):void
     {
         //trace("editor_focusOutHandler " + event.relatedObject);
-        
-        // If the focus goes to a component that is owned by the editor, 
+
+        // If the focus goes to a component that is owned by the editor,
         // then don't end the editor session.
         if (event.relatedObject)
         {
             var component:IUIComponent = getIUIComponent(event.relatedObject);
             if (component && editorOwns(component))
-                return;                
+                return;
         }
-        
+
         // ignore textfields losing focus on mousedowns
         if (!event.relatedObject)
             return;
-        
+
         if (itemEditorInstance || editedItemRenderer)
         {
-            // If we can't save the data, say, because the data was invalid, 
+            // If we can't save the data, say, because the data was invalid,
             // then cancel the save.
             if (!dataGrid.endItemEditorSession())
             {
                 dataGrid.endItemEditorSession(true);
             }
-        }        
+        }
     }
-    
+
     /**
      *  @private
      *  Special case for TextArea control. See editor_keyDownHandler.
@@ -1571,10 +1592,10 @@ public class DataGridEditor
         if (event is FlexEvent)
             gotFlexEnterEvent = true;
     }
-    
+
     /**
      *  @private
-     * 
+     *
      *  Handle keys on the editor to stop the editing session.
      */
     private function editor_keyDownHandler(event:KeyboardEvent):void
@@ -1582,9 +1603,9 @@ public class DataGridEditor
         //trace("keyboard event = " + event);
         if (event.isDefaultPrevented())
         {
-            // Special case the ENTER key since TextArea cancels the ENTER when it 
+            // Special case the ENTER key since TextArea cancels the ENTER when it
             // doesn't use it but instead it dispatches an FlexEvent.ENTER.
-            // The problem is the ENTER event does not have the control and 
+            // The problem is the ENTER event does not have the control and
             // shift key flags we need.
             if (!(event.charCode == Keyboard.ENTER && gotFlexEnterEvent))
             {
@@ -1592,9 +1613,9 @@ public class DataGridEditor
                 return;
             }
         }
-     
+
         gotFlexEnterEvent = false;
-        
+
         // ESC just kills the editor, no new data
         if (event.keyCode == Keyboard.ESCAPE)
         {
@@ -1608,13 +1629,13 @@ public class DataGridEditor
         {
             if (!_editedItemPosition)
                 return;
-            
-            // If the ctrl or ctrl and shift keys are down then set a flag to 
-            // avoid changing the focusable children flag becaue 
+
+            // If the ctrl or ctrl and shift keys are down then set a flag to
+            // avoid changing the focusable children flag becaue
             // need to be redone when starting up the editor again.
             if (event.ctrlKey || (event.ctrlKey && event.shiftKey))
                 restoreFocusableChildren = false;
-            
+
             // Enter closes the editor.
             // The 229 keyCode is for IME compatability. When entering an IME expression,
             // the enter key is down, but the keyCode is 229 instead of the enter key code.
@@ -1623,17 +1644,17 @@ public class DataGridEditor
             {
                 if (grid.focusManager)
                     grid.focusManager.defaultButtonEnabled = false;
-                
+
                 if (event.ctrlKey || (event.ctrlKey && event.shiftKey))
                 {
                     var lastRow:int = lastEditedItemPosition ? lastEditedItemPosition.rowIndex : 0;
                     var lastColumn:int = lastEditedItemPosition ? lastEditedItemPosition.columnIndex : 0;
-                    
+
                     if (event.shiftKey)
                         lastRow -= 1;
                     else
                         lastRow += 1;
-                    
+
                     // If we have a valid next row, then start another editor.
                     if (lastRow >= 0 && lastRow < dataGrid.dataProvider.length)
                     {
@@ -1644,17 +1665,17 @@ public class DataGridEditor
                             restoreFocusableChildren = true;
                             restoreFocusableChildrenFlags();
                         }
-                    }                        
+                    }
                 }
             }
         }
-        
-        // Prevent the DataGrid from processing any keystrokes that were 
-        // received by the editor. We don't cancel the keystokes here 
+
+        // Prevent the DataGrid from processing any keystrokes that were
+        // received by the editor. We don't cancel the keystokes here
         // because on AIR that cancels text input into the text field.
         event.stopPropagation();
     }
-    
+
     /**
      *  @private
      *  handle focus changes generated from keyboard keys.
@@ -1666,24 +1687,24 @@ public class DataGridEditor
         // next cell.
         //trace("editor_editor_keyFocusChangeHandler");
         lastEvent = event;
-        
+
         if (itemEditorInstance || editedItemRenderer)
         {
             if (event.isDefaultPrevented())
                 return;
-            
+
             var nextObject:IFocusManagerComponent = grid.focusManager.getNextFocusManagerComponent(event.shiftKey);
             if (nextObject == itemEditorInstance ||
                 (itemEditorInstance && !DisplayObjectContainer(itemEditorInstance).contains(DisplayObject(nextObject))) ||
-                (!itemEditorInstance && 
+                (!itemEditorInstance &&
                     (nextObject == editedItemRenderer ||
                     (editedItemRenderer && !DisplayObjectContainer(editedItemRenderer).contains(DisplayObject(nextObject))))))
             {
                 event.preventDefault();
-                
+
                 restoreFocusableChildren = false;
                 dataGrid.endItemEditorSession();
-                
+
                 if (!openEditorInNextEditableCell(lastEditedItemPosition.rowIndex,
                                                   lastEditedItemPosition.columnIndex,
                                                   event.shiftKey))
@@ -1691,7 +1712,7 @@ public class DataGridEditor
                     // We didn't start an editor so restore the data grid's
                     // focusable chidlren flags.
                     restoreFocusableChildren = true;
-                    restoreFocusableChildrenFlags();                    
+                    restoreFocusableChildrenFlags();
                 }
             }
         }
@@ -1702,14 +1723,14 @@ public class DataGridEditor
      */
     private function editorAncestorResizeHandler(event:Event):void
     {
-        // If we can't save the data, say, because the data was invalid, 
+        // If we can't save the data, say, because the data was invalid,
         // then cancel the save.
         if (!dataGrid.endItemEditorSession())
         {
             dataGrid.endItemEditorSession(true);
         }
     }
-    
+
     /**
      *  @private
      */
@@ -1719,27 +1740,27 @@ public class DataGridEditor
         {
             return;
         }
-        
+
         // If clicked on the scroll bars then keep the editor up
-        if (dataGrid.scroller && 
+        if (dataGrid.scroller &&
             dataGrid.scroller.contains(DisplayObject(event.target)) &&
             !grid.contains(DisplayObject(event.target)))
         {
             return;
         }
-        
-        // If we can't save the data, say, because the data was invalid, 
+
+        // If we can't save the data, say, because the data was invalid,
         // then cancel the save.
         if (!dataGrid.endItemEditorSession())
         {
             dataGrid.endItemEditorSession(true);
         }
-        
-        // If the item editor was destroyed then set focus back to the grid 
-        // so grid logic will deal if focus doesn't end up somewhere else. 
+
+        // If the item editor was destroyed then set focus back to the grid
+        // so grid logic will deal if focus doesn't end up somewhere else.
         if (!itemEditorInstance)
             dataGrid.setFocus();
     }
-   
+
 }
 }
\ No newline at end of file


Mime
View raw message