flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [20/30] git commit: [flex-asjs] [refs/heads/develop] - handle ILayoutChild in layouts so we don't lock in sizes
Date Sat, 18 Oct 2014 05:43:37 GMT
handle ILayoutChild in layouts so we don't lock in sizes


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

Branch: refs/heads/develop
Commit: df4ba1c83ce2336bd1d2a1ad774628ed3ec7ab6e
Parents: 4c19580
Author: Alex Harui <aharui@apache.org>
Authored: Tue Oct 14 22:15:01 2014 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Oct 17 22:38:46 2014 -0700

----------------------------------------------------------------------
 .../html/beads/layouts/NonVirtualBasicLayout.as | 20 ++++++++++++----
 .../NonVirtualVerticalScrollingLayout.as        | 24 +++++++++++++++++---
 2 files changed, 36 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/df4ba1c8/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.as
index 73af2e8..eaa58e5 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.as
@@ -85,7 +85,7 @@ package org.apache.flex.html.beads.layouts
 			var n:int = contentView.numElements;
 			for (var i:int = 0; i < n; i++)
 			{
-				var child:ILayoutChild = contentView.getElementAt(i) as ILayoutChild;
+				var child:IUIBase = contentView.getElementAt(i) as IUIBase;
                 var left:Number = ValuesManager.valuesImpl.getValue(child, "left");
                 var right:Number = ValuesManager.valuesImpl.getValue(child, "right");
                 var top:Number = ValuesManager.valuesImpl.getValue(child, "top");
@@ -103,8 +103,8 @@ package org.apache.flex.html.beads.layouts
                     child.y = top;
                     hh -= top;
                 }
-                var ilc:ILayoutChild;
-                if (child is ILayoutChild)
+                var ilc:ILayoutChild = child as ILayoutChild;
+                if (ilc)
                 {
                     ilc = child as ILayoutChild;
                     if (!isNaN(ilc.percentWidth))
@@ -113,7 +113,12 @@ package org.apache.flex.html.beads.layouts
                 if (!isNaN(right))
                 {
                     if (!isNaN(left))
-                        child.width = ww - right;
+                    {
+                        if (ilc)
+                            ilc.setWidth(ww - right);
+                        else
+                            child.width = ww - right;
+                    }
                     else
                         child.x = w - right - child.width;
                 }
@@ -126,7 +131,12 @@ package org.apache.flex.html.beads.layouts
                 if (!isNaN(bottom))
                 {
                     if (!isNaN(top))
-                        child.height = hh - bottom;
+                    {
+                        if (ilc)
+                            ilc.setHeight(hh - bottom);
+                        else
+                            child.height = hh - bottom;
+                    }
                     else
                         child.y = h - bottom - child.height;
                 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/df4ba1c8/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as
index 42dfdec..46cd298 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as
@@ -23,6 +23,7 @@ package org.apache.flex.html.beads.layouts
 	
 	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IBorderModel;
+    import org.apache.flex.core.ILayoutChild;
 	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IParentIUIBase;
 	import org.apache.flex.core.IScrollBarModel;
@@ -88,6 +89,11 @@ package org.apache.flex.html.beads.layouts
             var layoutParent:IScrollingLayoutParent = 
                 _strand.getBeadByType(IScrollingLayoutParent) as IScrollingLayoutParent;
             var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+            if (!contentView)
+                return;
+            IEventDispatcher(contentView).addEventListener("childrenAdded", changeHandler);
+            IEventDispatcher(contentView).addEventListener("layoutNeeded", changeHandler);
+            
 			var border:Border = layoutParent.border;
    			var borderModel:IBorderModel;
             if (border)
@@ -100,8 +106,17 @@ package org.apache.flex.html.beads.layouts
                 border.height = hh;
             }
             
-			contentView.width = ww - ((border) ? borderModel.offsets.left + borderModel.offsets.right
: 0);
-			contentView.height = hh - ((border) ? borderModel.offsets.top - borderModel.offsets.bottom
: 0);
+            var ilc:ILayoutChild = contentView as ILayoutChild;
+            if (ilc)
+            {
+                ilc.setWidth(ww - ((border) ? borderModel.offsets.left + borderModel.offsets.right
: 0));
+                ilc.setHeight(hh - ((border) ? borderModel.offsets.top - borderModel.offsets.bottom
: 0));                
+            }
+            else
+            {
+                contentView.width = ww - ((border) ? borderModel.offsets.left + borderModel.offsets.right
: 0);
+                contentView.height = hh - ((border) ? borderModel.offsets.top - borderModel.offsets.bottom
: 0);                
+            }
 			contentView.x = (border) ? borderModel.offsets.left : 0;
 			contentView.y = (border) ? borderModel.offsets.top : 0;
 			
@@ -118,7 +133,10 @@ package org.apache.flex.html.beads.layouts
 			if (yy > contentView.height)
 			{
 				vScrollBar = layoutParent.vScrollBar;
-				contentView.width -= vScrollBar.width;
+                if (ilc)
+    				ilc.setWidth(contentView.width - vScrollBar.width);
+                else
+                    contentView.width -= vScrollBar.width;
 				IScrollBarModel(vScrollBar.model).maximum = yy;
 				IScrollBarModel(vScrollBar.model).pageSize = contentView.height;
 				IScrollBarModel(vScrollBar.model).pageStepSize = contentView.height;


Mime
View raw message