flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Modified Container beads and changed the order of when the MXML children were added to the strand, making that happen after addedToParent() was called. Added new UIUtils class with static function to center
Date Fri, 14 Mar 2014 20:06:18 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 594963123 -> 24e96cfc2


Modified Container beads and changed the order of when the MXML children were added to the
strand, making that happen after addedToParent() was called. Added new UIUtils class with
static function to center components.


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

Branch: refs/heads/develop
Commit: 24e96cfc2c264853defd34104a2650a06be52031
Parents: 5949631
Author: Peter Ent <pent@apache.org>
Authored: Fri Mar 14 16:06:08 2014 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Fri Mar 14 16:06:08 2014 -0400

----------------------------------------------------------------------
 .../as/projects/FlexJSUI/src/FlexJSUIClasses.as |  2 +
 .../src/org/apache/flex/core/ContainerBase.as   |  7 +-
 .../html/staticControls/beads/ContainerView.as  | 70 +++++++++++++++-----
 .../flex/html/staticControls/beads/PanelView.as | 17 ++++-
 .../beads/layouts/NonVirtualVerticalLayout.as   |  1 +
 5 files changed, 75 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24e96cfc/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index 3091f39..96767b0 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -56,6 +56,7 @@ internal class FlexJSUIClasses
 	import org.apache.flex.html.staticControls.beads.SliderView; SliderView;
 	import org.apache.flex.html.staticControls.beads.SliderThumbView; SliderThumbView;
 	import org.apache.flex.html.staticControls.beads.SliderTrackView; SliderTrackView;
+	import org.apache.flex.html.staticControls.beads.SolidBackgroundBead; SolidBackgroundBead;
     import org.apache.flex.html.staticControls.beads.SpinnerView; SpinnerView;
     import org.apache.flex.html.staticControls.beads.TextButtonMeasurementBead; TextButtonMeasurementBead;
 	import org.apache.flex.html.staticControls.beads.TextFieldLabelMeasurementBead; TextFieldLabelMeasurementBead;
@@ -99,6 +100,7 @@ internal class FlexJSUIClasses
 	import org.apache.flex.events.CustomEvent; CustomEvent;
 	import org.apache.flex.events.Event; Event;
 	import org.apache.flex.utils.Timer; Timer;
+	import org.apache.flex.utils.UIUtils; UIUtils;
     import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl;
     
 	import mx.core.ClassFactory; ClassFactory;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24e96cfc/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 1360531..9284fa8 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
@@ -67,12 +67,13 @@ package org.apache.flex.core
 			ValuesManager.valuesImpl.init(this);
 			
 			MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
+			
+			super.addedToParent();
+			
 			MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
 			
-            super.addedToParent();
-            
 			dispatchEvent(new Event("initComplete"))
-			dispatchEvent( new Event("childrenAdded") );
+			dispatchEvent(new Event("childrenAdded"));
 		}
 		
         /**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24e96cfc/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ContainerView.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ContainerView.as
index 8a776c8..67f1458 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ContainerView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ContainerView.as
@@ -25,10 +25,11 @@ package org.apache.flex.html.staticControls.beads
 	import org.apache.flex.core.IBeadView;
 	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.html.staticControls.Container;
 	import org.apache.flex.html.staticControls.supportClasses.Border;
-    import org.apache.flex.html.staticControls.supportClasses.ContainerContentArea;
+	import org.apache.flex.html.staticControls.supportClasses.ContainerContentArea;
 	import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
 	
     /**
@@ -104,9 +105,39 @@ package org.apache.flex.html.staticControls.beads
 					value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);

 			}
 			
+			var padding:Object = determinePadding();
+			
+			if (contentAreaNeeded())
+			{
+				actualParent = new ContainerContentArea();
+				DisplayObjectContainer(value).addChild(actualParent);
+				Container(value).setActualParent(actualParent);
+				actualParent.x = padding.paddingLeft;
+				actualParent.y = padding.paddingTop;
+			}
+			else
+			{
+				actualParent = value as UIBase;
+			}
+		}
+		
+		/**
+		 *  Determines the top and left padding values, if any, as set by
+		 *  padding style values. This includes "padding" for all padding values
+		 *  as well as "padding-left" and "padding-top".
+		 * 
+		 *  Returns an object with paddingLeft and paddingTop properties.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		protected function determinePadding():Object
+		{
 			var paddingLeft:Object;
 			var paddingTop:Object;
-			var padding:Object = ValuesManager.valuesImpl.getValue(value, "padding");
+			var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding");
 			if (padding is Array)
 			{
 				if (padding.length == 1)
@@ -124,8 +155,8 @@ package org.apache.flex.html.staticControls.beads
 			}
 			else if (padding == null)
 			{
-				paddingLeft = ValuesManager.valuesImpl.getValue(value, "padding-left");
-				paddingTop = ValuesManager.valuesImpl.getValue(value, "padding-top");
+				paddingLeft = ValuesManager.valuesImpl.getValue(_strand, "padding-left");
+				paddingTop = ValuesManager.valuesImpl.getValue(_strand, "padding-top");
 			}
 			else
 			{
@@ -133,19 +164,24 @@ package org.apache.flex.html.staticControls.beads
 			}
 			var pl:Number = Number(paddingLeft);
 			var pt:Number = Number(paddingTop);
-			if ((!isNaN(pl) && pl > 0 ||
-				!isNaN(pt) && pt > 0))
-			{
-				actualParent = new ContainerContentArea();
-				DisplayObjectContainer(value).addChild(actualParent);
-				Container(value).setActualParent(actualParent);
-				actualParent.x = pl;
-				actualParent.y = pt;
-			}
-			else
-			{
-				actualParent = value as DisplayObjectContainer;
-			}
+			
+			return {paddingLeft:pl, paddingTop:pt};
+		}
+		
+		/**
+		 *  Returns true if container to create a separate ContainerContentArea.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		protected function contentAreaNeeded():Boolean
+		{
+			var padding:Object = determinePadding();
+			
+			return (!isNaN(padding.paddingLeft) && padding.paddingLeft > 0 ||
+				    !isNaN(padding.paddingTop) && padding.paddingTop > 0);
 		}
 		
         /**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24e96cfc/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/PanelView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/PanelView.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/PanelView.as
index 0846b11..2108ea1 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/PanelView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/PanelView.as
@@ -121,8 +121,21 @@ package org.apache.flex.html.staticControls.beads
 				Container(_strand).addElement(controlBar);
 			}
 			
-			IEventDispatcher(_strand).addEventListener("childrenAdded", changeHandler);
-            
+			IEventDispatcher(_strand).addEventListener("childrenAdded", changeHandler);          
 
+		}
+		
+		/**
+		 *  Always returns true because Panel's content is separate from its chrome
+		 *  elements such as the title bar and optional control bar.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		override protected function contentAreaNeeded():Boolean
+		{
+			return true;
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/24e96cfc/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
index 5b6afe7..33f48e8 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
@@ -69,6 +69,7 @@ package org.apache.flex.html.staticControls.beads.layouts
 			IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
 			IEventDispatcher(value).addEventListener("childrenAdded", changeHandler);
 			IEventDispatcher(value).addEventListener("itemsCreated", changeHandler);
+			IEventDispatcher(value).addEventListener("beadsAdded", changeHandler);
 		}
 	
 		private function changeHandler(event:Event):void


Mime
View raw message