flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [13/13] git commit: [flex-asjs] [refs/heads/develop] - fix states in release mode on JS
Date Tue, 16 Jul 2013 07:56:30 GMT
fix states in release mode on JS


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/2052b633
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/2052b633
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/2052b633

Branch: refs/heads/develop
Commit: 2052b633ff17c77aea3b16b7f81ee5cb1553acd2
Parents: 012ef5d
Author: Alex Harui <aharui@apache.org>
Authored: Tue Jul 16 00:33:31 2013 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Tue Jul 16 00:33:31 2013 -0700

----------------------------------------------------------------------
 .../org/apache/flex/core/SimpleStatesImpl.js    | 47 ++++++++++++++++----
 1 file changed, 39 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2052b633/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js
index 5817de4..4d3aec6 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js
@@ -70,7 +70,7 @@ org.apache.flex.core.SimpleStatesImpl.prototype.stateChangeHandler =
     s = arr[p];
     if (s.name == event.newValue)
     {
-      this.apply(s);
+      this.applyState(s);
       break;
     }
   }
@@ -92,7 +92,11 @@ org.apache.flex.core.SimpleStatesImpl.prototype.revert = function(s) {
       for (var q in o.items)
       {
         var item = o.items[q];
-        var parent = o.document[o.destination];
+        var parent;
+        if (typeof(o.document['get_' + o.destination]) == 'function')
+            parent = o.document['get_' + o.destination]();
+        else
+            parent = o.document[o.destination];
         item.removeFromParent(parent);
         parent.dispatchEvent(
             new org.apache.flex.events.Event('childrenAdded'));
@@ -100,7 +104,15 @@ org.apache.flex.core.SimpleStatesImpl.prototype.revert = function(s)
{
     }
     else if (o.type == 'SetProperty')
     {
-      o.document[o.target][o.name] = o.previousValue;
+      var target;
+      if (typeof(o.document['get_' + o.target]) == 'function')
+        target = o.document['get_' + o.target]();
+      else
+        target = o.document[o.target];
+      if (typeof(target['set_' + o.name]) == 'function')
+        target['set_' + o.name](o.previousValue);
+      else
+        target[o.name] = o.previousValue;
     }
   }
 };
@@ -110,7 +122,7 @@ org.apache.flex.core.SimpleStatesImpl.prototype.revert = function(s) {
  * @this {org.apache.flex.core.SimpleStatesImpl}
  * @param {Object} s The State to apply.
  */
-org.apache.flex.core.SimpleStatesImpl.prototype.apply = function(s) {
+org.apache.flex.core.SimpleStatesImpl.prototype.applyState = function(s) {
   var o, p;
   var arr = s.overrides;
   for (p in arr)
@@ -129,10 +141,18 @@ org.apache.flex.core.SimpleStatesImpl.prototype.apply = function(s)
{
       for (var q in o.items)
       {
         var item = o.items[q];
-        var parent = o.document[o.destination];
+        var parent;
+        if (typeof(o.document['get_' + o.destination]) == 'function')
+            parent = o.document['get_' + o.destination]();
+        else
+            parent = o.document[o.destination];
         if (o.relativeTo != null)
         {
-            var child = o.document[o.relativeTo];
+            var child;
+            if (typeof(o.document['get_' + o.relativeTo]) == 'function')
+                child = o.document['get_' + o.relativeTo]();
+            else
+                child = o.document[o.relativeTo];
             var index = child.getIndexInParent(parent);
             if (o.position == 'after')
                 index++;
@@ -148,8 +168,19 @@ org.apache.flex.core.SimpleStatesImpl.prototype.apply = function(s) {
     }
     else if (o.type == 'SetProperty')
     {
-      o.previousValue = o.document[o.target][o.name];
-      o.document[o.target][o.name] = o.value;
+      var target;
+      if (typeof(o.document['get_' + o.target]) == 'function')
+        target = o.document['get_' + o.target]();
+      else
+        target = o.document[o.target];
+      if (typeof(target['get_' + o.name]) == 'function')
+        o.previousValue = target['get_' + o.name]();
+      else
+        o.previousValue = target[o.name]
+      if (typeof(target['set_' + o.name]) == 'function')
+        target['set_' + o.name](o.value);
+      else
+        target[o.name] = o.value;
     }
   }
 };


Mime
View raw message