Updated Branches:
  refs/heads/develop 531f7f2fe -> 774cdd7b6

FLEX-33498:  Adding new feature for dataProvider/selectedIndex supporting 
components.  This covers; Grid, DataGrid, ListBase, ComboBox, DropDownList, 
List, ButtonBar, TabBar, ButtonBarBase


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

Branch: refs/heads/develop
Commit: 774cdd7b68759fcc93b40f8854de86824c6e4a97
Parents: 531f7f2
Author: Mark Kessler <[email protected]>
Authored: Tue Apr 16 21:23:40 2013 -0400
Committer: Mark Kessler <[email protected]>
Committed: Fri Apr 19 21:32:53 2013 -0400

----------------------------------------------------------------------
 .../spark/src/spark/components/DataGrid.as         |  181 +++++++++++-
 .../projects/spark/src/spark/components/Grid.as    |  233 ++++++++++++++-
 .../supportClasses/IDataProviderEnhance.as         |  150 +++++++++
 .../spark/components/supportClasses/ListBase.as    |  232 ++++++++++++++-
 .../components/supportClasses/RegExPatterns.as     |  221 ++++++++++++++
 5 files changed, 993 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/774cdd7b/frameworks/projects/spark/src/spark/components/DataGrid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/DataGrid.as 
b/frameworks/projects/spark/src/spark/components/DataGrid.as
index 85032f0..9eede5e 100644
--- a/frameworks/projects/spark/src/spark/components/DataGrid.as
+++ b/frameworks/projects/spark/src/spark/components/DataGrid.as
@@ -73,6 +73,8 @@ import spark.components.gridClasses.GridSortField;
 import spark.components.gridClasses.GridView;
 import spark.components.gridClasses.IDataGridElement;
 import spark.components.gridClasses.IGridItemEditor;
+import spark.components.supportClasses.IDataProviderEnhance;
+import spark.components.supportClasses.RegExPatterns;
 import spark.components.supportClasses.SkinnableContainerBase;
 import spark.core.NavigationUnit;
 import spark.events.GridCaretEvent;
@@ -763,7 +765,7 @@ include "../styles/metadata/BasicInheritingTextStyles.as"
  *  @productversion Flex 4.5
  */  
 public class DataGrid extends SkinnableContainerBase 
-    implements IFocusManagerComponent, IIMESupport
+    implements IDataProviderEnhance, IFocusManagerComponent, IIMESupport
 {
     include "../core/Version.as";
     
@@ -1572,9 +1574,9 @@ public class DataGrid extends SkinnableContainerBase
     *  @see spark.components.gridClasses.GridDoubleClickMode
     * 
     *  @langversion 3.0
-    *  @playerversion Flash 11.1
-    *  @playerversion AIR 3.4
-    *  @productversion Flex 4.10
+    *  @playerversion Flash 10
+    *  @playerversion AIR 2.5
+    *  @productversion Flex 4.5
     */
 
     public function get doubleClickMode():String
@@ -1784,7 +1786,60 @@ public class DataGrid extends SkinnableContainerBase
     {
         return false;
     }
-    
+
+
+    //----------------------------------
+    //  isFirstRow
+    //----------------------------------
+
+    /**
+    *  @copy spark.components.Grid#isFirstRow
+    *  If a <code>grid</code> is not assigned, will always return false;
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function get isFirstRow():Boolean
+    {
+        if (grid)
+        {
+            return grid.isFirstRow;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    //----------------------------------
+    //  isLastRow
+    //----------------------------------
+
+    /**
+    *  @copy spark.components.Grid#isLastRow
+    *  If a <code>grid</code> is not assigned, will always return false;
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function get isLastRow():Boolean
+    {
+        if (grid)
+        {
+            return grid.isLastRow;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
     //----------------------------------
     //  multiColumnSortingEnabled
     //----------------------------------
@@ -3905,7 +3960,28 @@ public class DataGrid extends SkinnableContainerBase
     //  Public Methods
     //
     
//--------------------------------------------------------------------------
-    
+
+    /**
+    *  @copy spark.components.Grid#findRowIndex()
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function findRowIndex(field:String, value:String, startingIndex:int 
= 0, patternType:String = RegExPatterns.EXACT):int
+    {
+        if (grid)
+        {
+            return grid.findRowIndex(field, value, startingIndex, patternType);
+        }
+        else
+        {
+            return -1;
+        }
+    }
+
+
     /**
      *  @copy spark.components.Grid#invalidateCell()
      *  
@@ -3919,7 +3995,98 @@ public class DataGrid extends SkinnableContainerBase
         if (grid)
             grid.invalidateCell(rowIndex, columnIndex);
     }
-    
+
+
+    /**
+    *  @copy spark.components.Grid#moveIndexFindRow()
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    *
+    */
+    public function moveIndexFindRow(field:String, value:String, 
startingIndex:int = 0, patternType:String = RegExPatterns.EXACT):Boolean
+    {
+        if (grid)
+        {
+            return grid.moveIndexFindRow(field, value, startingIndex, 
patternType);
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+    *  @copy spark.components.Grid#moveIndexFirstRow()
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexFirstRow():void
+    {
+        if (grid)
+        {
+            grid.moveIndexFirstRow();
+        }
+    }
+
+
+    /**
+    *  @copy spark.components.Grid#moveIndexLastRow()
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexLastRow():void
+    {
+        if (grid)
+        {
+            grid.moveIndexLastRow();
+        }
+    }
+
+
+    /**
+    *  @copy spark.components.Grid#moveIndexNextRow()
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexNextRow():void
+    {
+        if (grid)
+        {
+            grid.moveIndexNextRow();
+        }
+    }
+
+
+    /**
+    *  @copy spark.components.Grid#moveIndexPreviousRow()
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexPreviousRow():void
+    {
+        if (grid)
+        {
+            grid.moveIndexPreviousRow();
+        }
+    }
+
+
     /**
      *  @copy spark.components.Grid#selectAll()
      *  

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/774cdd7b/frameworks/projects/spark/src/spark/components/Grid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/Grid.as 
b/frameworks/projects/spark/src/spark/components/Grid.as
index 02c71b3..320a34f 100644
--- a/frameworks/projects/spark/src/spark/components/Grid.as
+++ b/frameworks/projects/spark/src/spark/components/Grid.as
@@ -54,6 +54,8 @@ import spark.components.gridClasses.GridViewLayout;
 import spark.components.gridClasses.IDataGridElement;
 import spark.components.gridClasses.IGridItemRenderer;
 import spark.components.supportClasses.GroupBase;
+import spark.components.supportClasses.IDataProviderEnhance;
+import spark.components.supportClasses.RegExPatterns;
 import spark.events.GridCaretEvent;
 import spark.events.GridEvent;
 import spark.layouts.VerticalLayout;
@@ -192,7 +194,7 @@ use namespace mx_internal;
  *  overhead to a minimum, pooled and recycled.</p>
  *
  *  <p>The Grid control supports a doubleClick event, according the 
<code>doubleClickMode</code>
- *  property.</p>  
+ *  property.  
  * 
  *  <p>The Grid control supports selection, according the 
<code>selectionMode</code>
  *  property.  The set of selected row or cell indices can be modified or
@@ -210,7 +212,7 @@ use namespace mx_internal;
  *  <p>The Grid control supports smooth scrolling.  
  *  Their vertical and horizontal scroll positions define the pixel origin 
  *  of the visible part of the grid and the grid's layout only displays 
- *  as many cell item renderers as are needed to fill the available space.</p>
+ *  as many cell item renderers as are needed to fill the available space.  
</p>
  *
  *  <p>The Grid control supports variable height rows that automatically 
compute 
  *  their height based on the item renderers' contents.  
@@ -242,7 +244,7 @@ use namespace mx_internal;
  *  @playerversion AIR 2.5
  *  @productversion Flex 4.5
  */
-public class Grid extends Group implements IDataGridElement
+public class Grid extends Group implements IDataGridElement, 
IDataProviderEnhance
 {
     include "../core/Version.as";
        
@@ -743,7 +745,72 @@ public class Grid extends Group implements IDataGridElement
                 
         _horizontalScrollPosition = value;
     }
-    
+
+
+    //----------------------------------
+    //  isFirstRow
+    //----------------------------------
+
+    /**
+    *  Returns if the selectedIndex is equal to the first row.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function get isFirstRow():Boolean
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            if (selectedIndex == 0)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return false
+        }
+    }
+
+
+    //----------------------------------
+    //  isLastRow
+    //----------------------------------
+
+    /**
+    *  Returns if the selectedIndex is equal to the last row.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function get isLastRow():Boolean
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            if (selectedIndex == dataProvider.length - 1)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
     //----------------------------------
     //  verticalScrollPosition (private override)
     //----------------------------------
@@ -1212,9 +1279,9 @@ public class Grid extends Group implements 
IDataGridElement
      *  @see spark.components.gridClasses.GridDoubleClickMode
      * 
      *  @langversion 3.0
-     *  @playerversion Flash 11.1
-     *  @playerversion AIR 3.4
-     *  @productversion Flex 4.10
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
      */
     public function get doubleClickMode():String
     {
@@ -2271,7 +2338,7 @@ public class Grid extends Group implements 
IDataGridElement
      *  <p> This property is intended to be used to initialize or bind to the
      *  selection in MXML markup.  The setSelectedCell() method should be used
      *  for programatic selection updates, for example when writing a keyboard
-     *  or mouse event handler. </p>
+     *  or mouse event handler. </p> > 
      *
      *  <p>The default value is an empty <code>Vector.&lt;int&gt;</code></p>
      * 
@@ -4694,6 +4761,156 @@ public class Grid extends Group implements 
IDataGridElement
         return new GridSelection();    
     }
 
+
+    /**
+    *  This will search through a dataprovider checking the given field and 
for the given value and return the index for the match.
+    *  It can start the find from a given startingIndex;
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function findRowIndex(field:String, value:String, startingIndex:int 
= 0, patternType:String = RegExPatterns.EXACT):int
+    {
+        var pattern:RegExp; 
+        var currentObject:Object = null;
+        var dataProviderTotal:int = 0;
+        var loopingIndex:int = startingIndex;
+
+        
+        pattern = RegExPatterns.createRegExp(value, patternType);
+
+
+        if (dataProvider && dataProvider.length > 0)
+        {
+            dataProviderTotal = dataProvider.length;
+
+            if (startingIndex >= dataProviderTotal)
+            {
+                return -1;
+            }
+
+
+            for (loopingIndex; loopingIndex < dataProviderTotal; 
loopingIndex++)
+            {
+                currentObject = dataProvider.getItemAt(loopingIndex);
+
+                if (currentObject.hasOwnProperty(field) == true && 
currentObject[field].search(pattern) != -1)
+                {
+                    return loopingIndex;
+                }
+            }
+
+        }
+
+        return -1;
+    }
+
+
+    /**
+    *  This will search through a dataprovider checking the given field and 
will set the selectedIndex to a matching value.
+    *  It can start the search from the startingIndex;
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    *
+    */
+    public function moveIndexFindRow(field:String, value:String, 
startingIndex:int = 0, patternType:String = RegExPatterns.EXACT):Boolean
+    {
+        var indexFound:int = -1;
+
+        indexFound = findRowIndex(field, value, startingIndex, patternType);
+
+        if (indexFound != -1)
+        {
+            selectedIndex = indexFound;
+
+            return true;
+        }
+
+        return false;
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the first row of the dataProvider.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexFirstRow():void
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            selectedIndex = 0;
+        }
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the last row of the dataProvider.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexLastRow():void
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            selectedIndex = dataProvider.length - 1;
+        }
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the next row of the dataProvider.  If 
there isn't a current selectedIndex, it silently returns.
+    *  If the selectedIndex is on the first row, it does not wrap around.  
However the <code>isFirstRow</code> property returns true.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexNextRow():void
+    {
+        if (dataProvider && dataProvider.length > 0 && selectedIndex >= 0)
+        {
+            if (isLastRow == false)
+            {
+                selectedIndex += 1;
+            }
+        }
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the previous row of the dataProvider.  If 
there isn't a current selectedIndex, it silently returns.
+    *  If the selectedIndex is on the last row, it does not wrap around.  
However the <code>isLastRow</code> property returns true.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexPreviousRow():void
+    {
+        if (dataProvider && dataProvider.length > 0 && selectedIndex >= 0)
+        {
+            if (isFirstRow == false)
+            {
+                selectedIndex -= 1;
+            }
+        }
+    }
+
+
     
//--------------------------------------------------------------------------
     //
     //  Methods: Internal Grid Access

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/774cdd7b/frameworks/projects/spark/src/spark/components/supportClasses/IDataProviderEnhance.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/spark/src/spark/components/supportClasses/IDataProviderEnhance.as
 
b/frameworks/projects/spark/src/spark/components/supportClasses/IDataProviderEnhance.as
new file mode 100644
index 0000000..45dba4f
--- /dev/null
+++ 
b/frameworks/projects/spark/src/spark/components/supportClasses/IDataProviderEnhance.as
@@ -0,0 +1,150 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.components.supportClasses
+{
+
+    import flash.events.IEventDispatcher;
+    import mx.collections.IList;
+    import spark.components.supportClasses.RegExPatterns;
+
+
+    /**
+    *  Adds functionality to list driven components.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public interface IDataProviderEnhance extends IEventDispatcher
+    {
+        
//--------------------------------------------------------------------------------
+        //
+        //  Variables
+        //
+        
//--------------------------------------------------------------------------------
+
+
+        
//--------------------------------------------------------------------------------
+        //
+        //  Getters / Setters
+        //
+        
//--------------------------------------------------------------------------------
+
+        /**
+        *  Returns if the selectedIndex is equal to the first row.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        function get isFirstRow():Boolean;
+
+
+        /**
+        *  Returns if the selectedIndex is equal to the last row.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        function get isLastRow():Boolean;
+
+
+        
//--------------------------------------------------------------------------------
+        //
+        //  Methods
+        //
+        
//--------------------------------------------------------------------------------
+
+        /**
+        *  This will search through a dataprovider checking the given field 
and for the given value and return the index for the match.
+        *  It can start the find from a given startingIndex;
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        function findRowIndex(field:String, value:String, startingIndex:int = 
0, patternType:String = RegExPatterns.EXACT):int;
+
+
+        /**
+        *  Changes the selectedIndex to the first row of the dataProvider.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        function moveIndexFirstRow():void;
+
+
+        /**
+        *  Changes the selectedIndex to the last row of the dataProvider.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        function moveIndexLastRow():void;
+
+
+        /**
+        *  Changes the selectedIndex to the next row of the dataProvider.  If 
there isn't a current selectedIndex, it silently returns.
+        *  If the selectedIndex is on the first row, it does not wrap around.  
However the <code>isFirstRow</code> property returns true.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        function moveIndexNextRow():void;
+
+
+        /**
+        *  Changes the selectedIndex to the previous row of the dataProvider.  
If there isn't a current selectedIndex, it silently returns.
+        *  If the selectedIndex is on the last row, it does not wrap around.  
However the <code>isLastRow</code> property returns true.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        function moveIndexPreviousRow():void;
+
+
+        /**
+        *  This will search through a dataprovider checking the given field 
and will set the selectedIndex to a matching value.
+        *  It can start the search from the startingIndex;
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        *
+        */
+        function moveIndexFindRow(field:String, value:String, 
startingIndex:int = 0, patternType:String = RegExPatterns.EXACT):Boolean;
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/774cdd7b/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as 
b/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
index ac85f89..fa391ba 100644
--- a/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
+++ b/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
@@ -35,6 +35,8 @@ import mx.events.FlexEvent;
 import spark.components.IItemRenderer;
 import spark.components.IItemRendererOwner;
 import spark.components.SkinnableDataContainer;
+import spark.components.supportClasses.IDataProviderEnhance;
+import spark.components.supportClasses.RegExPatterns;
 import spark.events.IndexChangeEvent;
 import spark.events.ListEvent;
 import spark.events.RendererExistenceEvent;
@@ -163,7 +165,7 @@ use namespace mx_internal;  //ListBase and List share 
selection properties that
  *  @playerversion AIR 1.5
  *  @productversion Flex 4
  */
-public class ListBase extends SkinnableDataContainer 
+public class ListBase extends SkinnableDataContainer implements 
IDataProviderEnhance
 {
     include "../../core/Version.as";
 
@@ -456,7 +458,72 @@ public class ListBase extends SkinnableDataContainer
      *  selection/caret stability after a dataProvider refresh.
      */
     mx_internal var caretItem:* = undefined;
-    
+
+
+    //----------------------------------
+    //  isFirstRow
+    //----------------------------------
+
+    /**
+    *  Returns if the selectedIndex is equal to the first row.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function get isFirstRow():Boolean
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            if (selectedIndex == 0)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return false
+        }
+    }
+
+
+    //----------------------------------
+    //  isLastRow
+    //----------------------------------
+
+    /**
+    *  Returns if the selectedIndex is equal to the last row.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function get isLastRow():Boolean
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            if (selectedIndex == dataProvider.length - 1)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
     //----------------------------------
     //  labelField
     //----------------------------------
@@ -722,9 +789,9 @@ public class ListBase extends SkinnableDataContainer
      *  this method.  If false, caretIndex won't change.
      *
      *  @langversion 3.0
-     *  @playerversion Flash 11.1
-     *  @playerversion AIR 3.4
-     *  @productversion Flex 4.10
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
      */
     public function setSelectedIndex(rowIndex:int, dispatchChangeEvent:Boolean 
= false, changeCaret:Boolean = true):void
     {
@@ -1157,6 +1224,52 @@ public class ListBase extends SkinnableDataContainer
     
//--------------------------------------------------------------------------
 
     /**
+    *  This will search through a dataprovider checking the given field and 
for the given value and return the index for the match.
+    *  It can start the find from a given startingIndex;
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function findRowIndex(field:String, value:String, startingIndex:int 
= 0, patternType:String = RegExPatterns.EXACT):int
+    {
+        var pattern:RegExp; 
+        var currentObject:Object = null;
+        var dataProviderTotal:int = 0;
+        var loopingIndex:int = startingIndex;
+
+
+        pattern = RegExPatterns.createRegExp(value, patternType);
+
+
+        if (dataProvider && dataProvider.length > 0)
+        {
+            dataProviderTotal = dataProvider.length;
+
+            if (startingIndex >= dataProviderTotal)
+            {
+                return -1;
+            }
+
+
+            for (loopingIndex; loopingIndex < dataProviderTotal; 
loopingIndex++)
+            {
+                currentObject = dataProvider.getItemAt(loopingIndex);
+
+                if (currentObject.hasOwnProperty(field) == true && 
currentObject[field].search(pattern) != -1)
+                {
+                    return loopingIndex;
+                }
+            }
+
+        }
+
+        return -1;
+    }
+
+
+    /**
      *  Called when an item is selected or deselected. 
      *  Subclasses must override this method to display the selection.
      *
@@ -1243,7 +1356,111 @@ public class ListBase extends SkinnableDataContainer
     {        
         return index == caretIndex;
     }
-    
+
+
+    /**
+    *  This will search through a dataprovider checking the given field and 
will set the selectedIndex to a matching value.
+    *  It can start the search from the startingIndex;
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    *
+    */
+    public function moveIndexFindRow(field:String, value:String, 
startingIndex:int = 0, patternType:String = RegExPatterns.EXACT):Boolean
+    {
+        var indexFound:int = -1;
+
+        indexFound = findRowIndex(field, value, startingIndex, patternType);
+
+        if (indexFound != -1)
+        {
+            selectedIndex = indexFound;
+
+            return true;
+        }
+
+        return false;
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the first row of the dataProvider.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexFirstRow():void
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            selectedIndex = 0;
+        }
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the last row of the dataProvider.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexLastRow():void
+    {
+        if (dataProvider && dataProvider.length > 0)
+        {
+            selectedIndex = dataProvider.length - 1;
+        }
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the next row of the dataProvider.  If 
there isn't a current selectedIndex, it silently returns.
+    *  If the selectedIndex is on the first row, it does not wrap around.  
However the <code>isFirstRow</code> property returns true.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexNextRow():void
+    {
+        if (dataProvider && dataProvider.length > 0 && selectedIndex >= 0)
+        {
+            if (isLastRow == false)
+            {
+                selectedIndex += 1;
+            }
+        }
+    }
+
+
+    /**
+    *  Changes the selectedIndex to the previous row of the dataProvider.  If 
there isn't a current selectedIndex, it silently returns.
+    *  If the selectedIndex is on the last row, it does not wrap around.  
However the <code>isLastRow</code> property returns true.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function moveIndexPreviousRow():void
+    {
+        if (dataProvider && dataProvider.length > 0 && selectedIndex >= 0)
+        {
+            if (isFirstRow == false)
+            {
+                selectedIndex -= 1;
+            }
+        }
+    }
+
+
     /**
      *  @private
      *  Set current caret index. This function takes the item that was
@@ -1322,10 +1539,7 @@ public class ListBase extends SkinnableDataContainer
                 // The event was cancelled. Cancel the selection change and 
return.
                 itemSelected(_proposedSelectedIndex, false);
                 _proposedSelectedIndex = NO_PROPOSED_SELECTION;
-
-                //Reset back to false to resolve selectedIndex
                 dispatchChangeAfterSelection = false;
-
                 return false;
             }
         }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/774cdd7b/frameworks/projects/spark/src/spark/components/supportClasses/RegExPatterns.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/spark/src/spark/components/supportClasses/RegExPatterns.as
 
b/frameworks/projects/spark/src/spark/components/supportClasses/RegExPatterns.as
new file mode 100644
index 0000000..5a3a429
--- /dev/null
+++ 
b/frameworks/projects/spark/src/spark/components/supportClasses/RegExPatterns.as
@@ -0,0 +1,221 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.components.supportClasses
+{
+    /**
+    *  This provides a means to standardize certain common regex patterns and 
functionality.
+    *  
+    *  <p>Use the constants in ActionsScript, as the following example shows: 
</p>
+    *  <pre>
+    *    createRegExp("my search value", RegExPatterns.CONTAINS):RegExp
+    *  </pre>
+    *  
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public final class RegExPatterns
+    {
+        /**
+        *  Constructor.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        public function RegExPatterns()
+        {
+        }
+
+
+        
//--------------------------------------------------------------------------------
+        //
+        //  Static Const Variables
+        //
+        
//--------------------------------------------------------------------------------
+
+        /**
+        *  Specifies the use of a regex pattern matching the end with a given 
value.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        public static const CONTAINS:String = "contains";
+
+
+        /**
+        *  Specifies the use of a regex pattern matching the end with a given 
value.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        public static const ENDS_WITH:String = "endsWith";
+
+
+        /**
+        *  Specifies the use of a regex pattern matching exacly to a given 
value.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        public static const EXACT:String = "exact";
+
+
+        /**
+        *  Specifies the use of a regex pattern match that does not contain a 
given value.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        public static const NOT:String = "not";
+
+
+        /**
+        *  Specifies the use of a regex pattern match that specifies must have 
at least 1 character matching.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        public static const NOT_EMPTY:String = "notEmpty";
+
+
+        /**
+        *  Specifies the use of a regex pattern matching the beginging with a 
given value.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        public static const STARTS_WITH:String = "startsWith";
+
+
+        
//--------------------------------------------------------------------------------
+        //
+        //  Static Methods
+        //
+        
//--------------------------------------------------------------------------------
+
+        /**
+        *  Creates a new RegEx pattern based on a given value and a selected 
pattern Type.
+        *
+        *  @param patternValue Is the value that will be assembled into the 
RegEx type.
+        *  @param patternType Is the type of regen pattern matching to be 
performed.
+        *
+        *  @return Returns a <code>RegExp</code> with a formatted RegEx 
pattern.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        static public function createRegExp(patternValue:String, 
patternType:String = CONTAINS):RegExp
+        {
+            return new RegExp(createPatternString(patternValue, patternType), 
"i");
+        }
+
+
+        /**
+        *  Creates a new string based RegEx pattern based on a given value and 
a selected pattern Type.
+        *
+        *  @param patternValue Is the value that will be assembled into the 
RegEx type.
+        *  @param patternType Is the type of regen pattern matching to be 
performed.
+        *
+        *  @return Returns a string with a formatted RegEx pattern.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 11.1
+        *  @playerversion AIR 3.4
+        *  @productversion Flex 4.10
+        */
+        static public function createPatternString(patternValue:String, 
patternType:String = CONTAINS):String
+        {
+            var combinedPattern:String = "";
+
+            switch (patternType)
+            {
+                case ENDS_WITH:
+                {
+                    combinedPattern = "" + patternValue + "$";
+
+                    break;
+                }
+
+
+                case EXACT:
+                {
+                    combinedPattern = "^" + patternValue + "$";
+
+                    break;
+                }
+
+
+                case NOT:
+                {
+                    combinedPattern = "^((?!" + patternValue + ").)*$";
+
+                    break;
+                }
+
+
+                case NOT_EMPTY:
+                {
+                    combinedPattern = "^." + patternValue + "{1,}$";
+
+                    break;
+                }
+
+
+                case STARTS_WITH:
+                {
+                    combinedPattern = "^" + patternValue + "";
+
+                    break;
+                }
+
+
+                //Default pattern will be contains to catch all invalid 
patternTypes.
+                case CONTAINS:
+                default:
+                {
+                    combinedPattern = "" + patternValue + "";
+
+                    break;
+                }
+            }
+
+
+            return combinedPattern;
+        }
+
+    }
+}
\ No newline at end of file

Reply via email to