You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/03/12 05:36:38 UTC

[4/7] git commit: [flex-asjs] [refs/heads/develop] - changes required to get BasicTests to pass on two simple tests

changes required to get BasicTests to pass on two simple tests


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

Branch: refs/heads/develop
Commit: 89002bb0e717c1b1cf2f3676b804b396294cdba8
Parents: dec3558
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 3 15:48:30 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 11 21:36:06 2014 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/core/Application.as     | 28 +++++++++++++++++++-
 .../src/org/apache/flex/core/ContainerBase.as   |  2 ++
 .../src/org/apache/flex/core/IFlexInfo.as       |  2 +-
 .../src/org/apache/flex/core/IParent.as         | 10 +++++++
 .../org/apache/flex/core/SimpleStatesImpl.as    | 20 +++++++++-----
 .../FlexJSUI/src/org/apache/flex/core/UIBase.as | 13 +++++++++
 .../src/org/apache/flex/createjs/Application.as |  2 +-
 .../org/apache/flex/createjs/core/ViewBase.as   |  4 +++
 .../apache/flex/utils/MXMLDataInterpreter.as    |  8 +++---
 .../src/org/apache/flex/utils/MixinManager.as   |  4 +--
 10 files changed, 78 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
index 57f658d..80e3961 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
@@ -92,6 +92,19 @@ package org.apache.flex.core
             loaderInfo.addEventListener(flash.events.Event.INIT, initHandler);
         }
 
+        
+        /**
+         *  The document property is used to provide
+         *  a property lookup context for non-display objects.
+         *  For Application, it points to itself.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public var document:Object = this;
+        
         private function initHandler(event:flash.events.Event):void
         {
             ValuesManager.valuesImpl = valuesImpl;
@@ -102,6 +115,7 @@ package org.apache.flex.core
             initialView.applicationModel =  model;
     	    this.addElement(initialView);
     	    dispatchEvent(new Event("viewChanged"));
+            dispatchEvent(new Event("applicationComplete"));
         }
 
         /**
@@ -275,7 +289,7 @@ package org.apache.flex.core
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-        public function get info():Object
+        public function info():Object
         {
             if (!_info)
             {
@@ -359,5 +373,17 @@ package org.apache.flex.core
                 removeChild(c as DisplayObject);
         }
         
+        /**
+         *  @copy org.apache.flex.core.IParent#numElements
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get numElements():int
+        {
+            return numChildren;
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/ContainerBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/ContainerBase.as
index f13cfc4..6c32cba 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/ContainerBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/ContainerBase.as
@@ -134,6 +134,8 @@ package org.apache.flex.core
         public function set states(value:Array):void
         {
             _states = value;
+            _currentState = _states[0].name;
+            
 			try{
 				if (getBeadByType(IStatesImpl) == null)
 					addBead(new (ValuesManager.valuesImpl.getValue(this, "iStatesImpl")) as IBead);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFlexInfo.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFlexInfo.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFlexInfo.as
index 984ec10..637918e 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFlexInfo.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFlexInfo.as
@@ -38,6 +38,6 @@ package org.apache.flex.core
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-		function get info():Object
+		function info():Object
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IParent.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IParent.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IParent.as
index 85f4663..864382a 100755
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IParent.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IParent.as
@@ -79,5 +79,15 @@ package org.apache.flex.core
          *  @productversion FlexJS 0.0
          */
        function removeElement(c:Object):void;
+       
+       /**
+        *  The number of elements in the parent.
+        * 
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion FlexJS 0.0
+        */
+       function get numElements():int;
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
index 72d838d..a228c16 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
@@ -104,7 +104,9 @@ package org.apache.flex.core
                     var ai:AddItems = AddItems(o);
                     for each (var item:DisplayObject in ai.items)
                     {
-                        var parent:IParent = ai.document[ai.destination] as IParent;
+                        var parent:IParent = ai.document as IParent;
+                        if (ai.destination != null)
+                            parent = parent[ai.destination] as IParent;
                         parent.removeElement(item);
                     }
                     if (parent is IContainer)
@@ -133,13 +135,19 @@ package org.apache.flex.core
                     }
                     for each (var item:DisplayObject in ai.items)
                     {
-                        var parent:IParent = ai.document[ai.destination] as IParent;
+                        var parent:IParent = ai.document as IParent;
+                        if (ai.destination != null)
+                            parent = parent[ai.destination] as IParent;
                         if (ai.relativeTo != null)
                         {
-                            var child:Object = ai.document[ai.relativeTo];
-                            var index:int = parent.getElementIndex(child);
-                            if (ai.position == "after")
-                                index++;
+                            var index:int = parent.numElements;
+                            if (ai.relativeTo != null)
+                            {
+                                var child:Object = ai.document[ai.relativeTo];
+                                index = parent.getElementIndex(child);
+                                if (ai.position == "after")
+                                    index++;
+                            }
                             parent.addElementAt(item, index);
                         }
                         else

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
index 2590735..59f9839 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
@@ -542,6 +542,19 @@ package org.apache.flex.core
         }
 		
         /**
+         *  @copy org.apache.flex.core.IParent#numElements
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get numElements():int
+        {
+            return numChildren;
+        }
+        
+        /**
          *  The method called when added to a parent.  This is a good
          *  time to set up beads.
          * 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/Application.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/Application.as
index 2214325..dd3ed37 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/Application.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/Application.as
@@ -127,7 +127,7 @@ package org.apache.flex.createjs
 			return null;
 		}
 		
-		public function get info():Object
+		public function info():Object
 		{
 			return {};           
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/core/ViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/core/ViewBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/core/ViewBase.as
index 195821f..40c1e14 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/core/ViewBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/createjs/core/ViewBase.as
@@ -81,6 +81,10 @@ package org.apache.flex.createjs.core
             removeChild(c as DisplayObject);
         }
         
+        public function get numElements():int
+        {
+            return numChildren;
+        }
 
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
index 40709c3..577690d 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
@@ -157,8 +157,8 @@ public class MXMLDataInterpreter
                     IStrand(comp).addBead(value as IBead);
             }
             var beadOffset:int = i + (m - 1) * 3;
-            if (beadOffset >= -1)
-                trace(beadOffset, data[beadOffset]);
+            //if (beadOffset >= -1)
+            //    trace(beadOffset, data[beadOffset]);
             if (m > 0 && data[beadOffset] == "beads")
             {
                 m--;
@@ -321,8 +321,8 @@ public class MXMLDataInterpreter
         
         m = data[i++]; // num props
         var beadOffset:int = i + (m - 1) * 3;
-        if (beadOffset >= -1)
-            trace(beadOffset, data[beadOffset]);
+        //if (beadOffset >= -1)
+        //      (beadOffset, data[beadOffset]);
         if (m > 0 && data[beadOffset] == "beads")
         {
             m--;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/89002bb0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MixinManager.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MixinManager.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MixinManager.as
index b61222e..bbac35e 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MixinManager.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MixinManager.as
@@ -67,8 +67,8 @@ public class MixinManager implements IBead
         var app:IFlexInfo = value as IFlexInfo;
         if (app)
         {
-            var mixins:Array = app.info.mixins;
-            var domain:ApplicationDomain = app.info.currentDomain;
+            var mixins:Array = app.info().mixins;
+            var domain:ApplicationDomain = app.info().currentDomain;
             for each (var mixin:String in mixins)
             {
                 var mixinClass:Object = domain.getDefinition(mixin);