flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject git commit: [flex-asjs] [refs/heads/refactor-sprite] - refactor batch 5
Date Wed, 27 Jul 2016 19:00:10 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/refactor-sprite 46616874b -> f508d7dc9


refactor batch 5


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

Branch: refs/heads/refactor-sprite
Commit: f508d7dc9a90814f4d7a5cc1bd9cf8b20825d282
Parents: 4661687
Author: Harbs <harbs@in-tools.com>
Authored: Wed Jul 27 22:00:03 2016 +0300
Committer: Harbs <harbs@in-tools.com>
Committed: Wed Jul 27 22:00:03 2016 +0300

----------------------------------------------------------------------
 .../charts/supportClasses/ChartAxisGroup.as     |  8 ++-
 .../flex/org/apache/flex/core/Application.as    | 70 +++++++++++++-------
 .../flex/html/beads/FormatableTextInputView.as  |  2 +-
 3 files changed, 51 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f508d7dc/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
index 670130c..5c6e966 100644
--- a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
+++ b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
@@ -60,11 +60,13 @@ package org.apache.flex.charts.supportClasses
 		 */
 		public function removeAllElements():void
 		{
-			COMPILE::SWF {
-				this.removeChildren(0);
+			COMPILE::SWF
+			{
+				sprite.removeChildren(0);
 			}
 			
-			COMPILE::JS {
+			COMPILE::JS
+			{
 				var svg:Object = this.element;
 				while (svg.lastChild) {
 					svg.removeChild(svg.lastChild);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f508d7dc/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as
index ff6e5a6..657c9f8 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as
@@ -407,6 +407,8 @@ package org.apache.flex.core
             return null;
         }
 
+        private var _elements:Array;
+
         /**
          *  @copy org.apache.flex.core.IParent#addElement()
          *
@@ -417,14 +419,17 @@ package org.apache.flex.core
          */
         public function addElement(c:Object, dispatchEvent:Boolean = true):void
         {
-            COMPILE::SWF {
+            COMPILE::SWF
+            {
+                if(_elements == null)
+                    _elements = [];
+                _elements[_elements.length] = c;
+                this.addChild(c.sprite);
+                c.parent = this;
                 if (c is IUIBase)
                 {
-                    addChild(IUIBase(c).element as DisplayObject);
                     IUIBase(c).addedToParent();
                 }
-                else
-                    addChild(c as DisplayObject);
             }
             COMPILE::JS {
                 this.element.appendChild(c.element);
@@ -442,14 +447,19 @@ package org.apache.flex.core
          */
         public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
         {
-            COMPILE::SWF {
+            COMPILE::SWF
+            {
+                if(_elements == null)
+                    _elements = [];
+                _elements.splice(index,0,c);
+
+                this.addChildAt(c.sprite,index);
+                c.parent = this;
+
                 if (c is IUIBase)
                 {
-                    addChildAt(IUIBase(c).element as DisplayObject, index);
                     IUIBase(c).addedToParent();
                 }
-                else
-                    addChildAt(c as DisplayObject, index);
             }
             COMPILE::JS {
                 var children:NodeList = internalChildren();
@@ -475,10 +485,14 @@ package org.apache.flex.core
          */
         public function getElementAt(index:int):Object
         {
-            COMPILE::SWF {
-                return getChildAt(index);
+            COMPILE::SWF
+            {
+                if(_elements == null)
+                    return null;
+                return _elements[index];
             }
-            COMPILE::JS {
+            COMPILE::JS
+            {
                 var children:NodeList = internalChildren();
                 return children[index].flexjs_wrapper;
             }
@@ -494,11 +508,11 @@ package org.apache.flex.core
          */
         public function getElementIndex(c:Object):int
         {
-            COMPILE::SWF {
-                if (c is IUIBase)
-                    return getChildIndex(IUIBase(c).element as DisplayObject);
-
-                return getChildIndex(c as DisplayObject);
+            COMPILE::SWF
+            {
+                if(_elements == null)
+                    return -1;
+                return _elements.indexOf(c);
             }
             COMPILE::JS {
                 var children:NodeList = internalChildren();
@@ -522,15 +536,19 @@ package org.apache.flex.core
          */
         public function removeElement(c:Object, dispatchEvent:Boolean = true):void
         {
-            COMPILE::SWF {
-                if (c is IUIBase)
+            COMPILE::SWF
+            {
+                if(_elements)
                 {
-                    removeChild(IUIBase(c).element as DisplayObject);
+                    var idx:int = _elements.indexOf(c);
+                    if(idx>=0)
+                        _elements.splice(idx,1);
+                    c.parent = null;
                 }
-                else
-                    removeChild(c as DisplayObject);
+                this.removeChild(c.sprite as DisplayObject);
             }
-            COMPILE::JS {
+            COMPILE::JS
+            {
                 element.removeChild(c.element);
             }
         }
@@ -545,10 +563,12 @@ package org.apache.flex.core
          */
         public function get numElements():int
         {
-            COMPILE::SWF {
-                return numChildren;
+            COMPILE::SWF
+            {
+                return _elements ? _elements.length : 0;
             }
-            COMPILE::JS {
+            COMPILE::JS
+            {
                 var children:NodeList = internalChildren();
                 return children.length;
             }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f508d7dc/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/beads/FormatableTextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/beads/FormatableTextInputView.as
b/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/beads/FormatableTextInputView.as
index 926253c..36b1bf2 100644
--- a/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/beads/FormatableTextInputView.as
+++ b/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/beads/FormatableTextInputView.as
@@ -85,7 +85,7 @@ package org.apache.flex.html.beads
 			
 			// move the cursor to the end
 			var l:int = this.textField.text.length;
-			this.textField.setSelection(l,l);
+			this.textField.textField.setSelection(l,l);
 		}
 	}
 }


Mime
View raw message