flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [11/50] git commit: [flex-asjs] [refs/heads/master] - fix up containers after last refactor
Date Wed, 16 Dec 2015 21:35:57 GMT
fix up containers after last refactor


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

Branch: refs/heads/master
Commit: 72c84c8d32ebf3f82223911584da4ab3856f55c4
Parents: d07030f
Author: Alex Harui <aharui@apache.org>
Authored: Thu Sep 24 16:37:25 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Sep 24 16:37:25 2015 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/core/ContainerBase.as   | 38 ++++----------------
 .../as/src/org/apache/flex/core/IContainer.as   | 11 ------
 .../src/org/apache/flex/core/ContainerBase.js   | 12 +++----
 .../js/src/org/apache/flex/core/IContainer.js   |  6 ----
 .../html/beads/ControlBarMeasurementBead.as     |  6 ++--
 .../html/beads/layouts/VerticalColumnLayout.as  |  7 ++--
 .../js/src/org/apache/flex/html/Container.js    | 15 --------
 7 files changed, 18 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c84c8d/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
index 050f018..a847b01 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
@@ -122,11 +122,11 @@ package org.apache.flex.core
 			var contentView:IParent = view as IParent;
 			if (contentView != null) {
 				contentView.addElement(c, dispatchEvent);
+                if (dispatchEvent)
+                    this.dispatchEvent(new Event("childrenAdded"));
 			}
 			else {
 				addChild(c as DisplayObject);
-				if (dispatchEvent)
-					this.dispatchEvent(new Event("childrenAdded"));
 			}
         }
         
@@ -138,11 +138,11 @@ package org.apache.flex.core
 			var contentView:IParent = view as IParent;
 			if (contentView != null) {
 				contentView.addElementAt(c, index, dispatchEvent);
+                if (dispatchEvent)
+                    this.dispatchEvent(new Event("childrenAdded"));
 			}
 			else {
 				addChildAt(c as DisplayObject, index);
-				if (dispatchEvent)
-					this.dispatchEvent(new Event("childrenAdded"));
 			}
         }
         
@@ -154,41 +154,15 @@ package org.apache.flex.core
 			var contentView:IParent = view as IParent;
 			if (contentView != null) {
 				contentView.removeElement(c, dispatchEvent);
+                if (dispatchEvent)
+                    this.dispatchEvent(new Event("childrenRemoved"));
 			}
 			else {
 				removeChild(c as DisplayObject);
-				if (dispatchEvent)
-					this.dispatchEvent(new Event("childrenRemoved"));
 			}
         }
         
         /**
-         *  Get the array of children.  To change the children use
-         *  addElement, removeElement.
-         */
-        public function getChildren():Array
-        {
-			var contentView:IParent = view as IParent;
-			var children:Array = [];
-			var n:int = 0;
-			var i:int = 0;
-			
-			if (contentView != null) {
-				n = contentView.numElements;
-				for (i=0; i < n; i++) {
-					children.push(contentView.getElementAt(i));
-				}
-			}
-			else {
-	            for (i = 0; i < n; i++) {
-	                children.push(getChildAt(i));
-				}
-			}
-			
-			return children;
-        }
-        
-        /**
          *  @private
          */
         public function childrenAdded():void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c84c8d/frameworks/projects/Core/as/src/org/apache/flex/core/IContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IContainer.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IContainer.as
index 1091bad..889a888 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/IContainer.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IContainer.as
@@ -32,17 +32,6 @@ package org.apache.flex.core
      */
     public interface IContainer extends IParent
 	{
-		/**
-		 *  This method returns an array of the content children
-		 *  of the container.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		function getChildren():Array;
-		
         /**
          *  This method is called after children have been
          *  added to the container so the container doesn't

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c84c8d/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js
index 1441721..4d409e4 100644
--- a/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js
+++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js
@@ -159,6 +159,8 @@ org.apache.flex.core.ContainerBase.prototype.addElement = function(c,
opt_dispat
   var contentView = this.view;
   if (contentView != null) {
     contentView.addElement(c, opt_dispatchEvent);
+    if (opt_dispatchEvent)
+      this.dispatchEvent('childrenAdded');
   }
   else {
     this.$addElement(c, opt_dispatchEvent);
@@ -179,6 +181,8 @@ org.apache.flex.core.ContainerBase.prototype.addElementAt = function(c,
index, o
   var contentView = this.view;
   if (contentView != null) {
     contentView.addElementAt(c, index, opt_dispatchEvent);
+    if (opt_dispatchEvent)
+      this.dispatchEvent('childrenAdded');
   }
   else {
     this.$addElementAt(c, index, opt_dispatchEvent);
@@ -208,6 +212,8 @@ org.apache.flex.core.ContainerBase.prototype.removeElement = function(c,
opt_dis
   var contentView = this.view;
   if (contentView != null) {
     contentView.removeElement(c, opt_dispatchEvent);
+    if (opt_dispatchEvent)
+      this.dispatchEvent('childrenRemoved');
   } else {
     this.$removeElement(c, opt_dispatchEvent);
   }
@@ -246,8 +252,6 @@ org.apache.flex.core.ContainerBase.prototype.$addElement = function(c,
opt_dispa
     opt_dispatchEvent = true;
   this.element.appendChild(c.positioner);
   c.addedToParent();
-  if (opt_dispatchEvent)
-     this.dispatchEvent('childrenAdded');
 };
 
 
@@ -268,8 +272,6 @@ org.apache.flex.core.ContainerBase.prototype.$addElementAt = function(c,
index,
         children1[index]);
     c.addedToParent();
   }
-  if (opt_dispatchEvent)
-     this.dispatchEvent('childrenAdded');
 };
 
 
@@ -280,8 +282,6 @@ org.apache.flex.core.ContainerBase.prototype.$addElementAt = function(c,
index,
  */
 org.apache.flex.core.ContainerBase.prototype.$removeElement = function(c, opt_dispatchEvent)
{
   this.element.removeChild(c.element);
-  if (opt_dispatchEvent)
-     this.dispatchEvent('childrenRemoved');
 };
 
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c84c8d/frameworks/projects/Core/js/src/org/apache/flex/core/IContainer.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IContainer.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IContainer.js
index 50cfcc7..6df12dc 100644
--- a/frameworks/projects/Core/js/src/org/apache/flex/core/IContainer.js
+++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IContainer.js
@@ -35,12 +35,6 @@ org.apache.flex.core.IContainer = function() {
 
 
 /**
- * @return {Array} All of the children of the container.
- */
-org.apache.flex.core.IContainer.prototype.getChildren = function() {};
-
-
-/**
  * Called after all of the children have been added to the container.
  * @return {void}
  */

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c84c8d/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
index 97b24b5..18d19dd 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
@@ -62,10 +62,10 @@ package org.apache.flex.html.beads
 			// since it would know the arrangement of the items and how far apart they are and if
 			// there are margins and paddings and gaps involved.
 			var mwidth:Number = 0;
-			var children:Array = Container(_strand).getChildren();
-			var n:int = children.length;
+            var container:Container = Container(_strand);
+			var n:int = container.numElements;
 			for(var i:int=0; i < n; i++) {
-				var child:IUIBase = children[i] as IUIBase;
+				var child:IUIBase = container.getElementAt(i) as IUIBase;
 				if( child == null ) continue;
 				var childMeasure:IMeasurementBead = child.getBeadByType(IMeasurementBead) as IMeasurementBead;
                 if (childMeasure)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c84c8d/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
index 885eb80..d32777d 100644
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
@@ -124,13 +124,12 @@ package org.apache.flex.html.beads.layouts
             var mr:Number;
             var mt:Number;
             var mb:Number;
-			var children:Array = IContainer(_strand).getChildren();
-			var n:int = children.length;
+			var n:int = contentView.numElements;
             var rowData:Object = { rowHeight: 0 };
 			
 			// determine max widths of columns
 			for (i = 0; i < n; i++) {
-				e = children[i];
+				e = contentView.getElementAt(i) as IUIBase;
                 margin = ValuesManager.valuesImpl.getValue(e, "margin");
                 marginLeft = ValuesManager.valuesImpl.getValue(e, "margin-left");
                 marginTop = ValuesManager.valuesImpl.getValue(e, "margin-top");
@@ -172,7 +171,7 @@ package org.apache.flex.html.beads.layouts
 			col = 0;
 			for (i = 0; i < n; i++) 
             {
-				e = children[i];
+				e = contentView.getElementAt(i) as IUIBase;
 				e.x = curx + ml;
 				e.y = cury + data[i].mt;
 				curx += columns[col++];

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c84c8d/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
index c363807..b7d628a 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
@@ -121,18 +121,3 @@ org.apache.flex.html.Container.prototype.internalChildren =
   return this.element.children;
 };
 
-
-/**
- * @return {Array} All of the children of the container.
- */
-org.apache.flex.html.Container.prototype.getChildren = function() {
-  var arr = this.element.children;
-  var comparr = [];
-  var n = arr.length;
-  for (var i = 0; i < n; i++)
-  {
-    comparr.push(arr[i].flexjs_wrapper);
-  }
-  return comparr;
-};
-


Mime
View raw message