flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mih...@apache.org
Subject [4/6] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34854 FLEX-34884 Mirror of commit 047017398a2ccea7ddb2b0300ec4a184ad7f9ab6 for the spark version of Sort.as.
Date Sun, 21 Jun 2015 21:16:02 GMT
FLEX-34854 FLEX-34884
Mirror of commit 047017398a2ccea7ddb2b0300ec4a184ad7f9ab6 for the spark version of Sort.as.


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

Branch: refs/heads/develop
Commit: 2ce42524d125c87bddd087a617d69b30effa872d
Parents: e2df7a7
Author: Mihai Chira <mihaic@apache.org>
Authored: Sun Jun 21 20:38:12 2015 +0100
Committer: Mihai Chira <mihaic@apache.org>
Committed: Sun Jun 21 20:38:12 2015 +0100

----------------------------------------------------------------------
 .../spark/src/spark/collections/Sort.as         | 40 +++++---------------
 1 file changed, 9 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2ce42524/frameworks/projects/spark/src/spark/collections/Sort.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/collections/Sort.as b/frameworks/projects/spark/src/spark/collections/Sort.as
index 8e9a8d5..807f121 100644
--- a/frameworks/projects/spark/src/spark/collections/Sort.as
+++ b/frameworks/projects/spark/src/spark/collections/Sort.as
@@ -341,10 +341,6 @@ public class Sort extends AdvancedStyleClient implements ISort
      */
     private var _fields:Array;
 
-    /**
-     *  @private
-     */
-    private var fieldList:Array = [];
 
     [Inspectable(category="General", arrayType="mx.collections.ISortField")]
     [Bindable("fieldsChanged")]
@@ -372,16 +368,7 @@ public class Sort extends AdvancedStyleClient implements ISort
     public function set fields(value:Array):void
     {
         _fields = value;
-        fieldList = [];
-        if (_fields)
-        {
-            var field:ISortField;
-            for (var i:int = 0; i<_fields.length; i++)
-            {
-                field = ISortField(_fields[i]);
-                fieldList.push(field.name);
-            }
-        }
+
         dispatchEvent(new Event("fieldsChanged"));
     }
 
@@ -542,39 +529,30 @@ public class Sort extends AdvancedStyleClient implements ISort
         {
             compareForFind = this.compareFunction;
             // configure the search criteria
-            if (values && fieldList.length > 0)
+            if (values && fields && fields.length > 0)
             {
                 fieldsForCompare = [];
                 //build up the fields we can compare, if we skip a field in the
                 //middle throw an error.  it is ok to not have all the fields
                 //though
-                var fieldName:String;
+                var field:ISortField;
                 var hadPreviousFieldName:Boolean = true;
-                for (var i:int = 0; i < fieldList.length; i++)
+                for (var i:int = 0; i < fields.length; i++)
                 {
-                    fieldName = fieldList[i];
-                    if (fieldName)
+                    field = fields[i] as ISortField;
+                    if (field.name)
                     {
-                        var hasFieldName:Boolean = false;
-                        
-						try
-                        {
-                            hasFieldName = values[fieldName] !== undefined;
-                        }
-                        catch(e:Error)
-                        {
-                        }
-                        if (hasFieldName)
+                        if (field.objectHasSortField(values))
                         {
                             if (!hadPreviousFieldName)
                             {
                                 message = resourceManager.getString(
-                                    "collections", "findCondition", [ fieldName ]);
+                                    "collections", "findCondition", [ field.name ]);
                                 throw new SortError(message);
                             }
                             else
                             {
-                                fieldsForCompare.push(fieldName);
+                                fieldsForCompare.push(field.name);
                             }
                         }
                         else


Mime
View raw message