add maxWidth/maxHeight to layout.  Also switch flexibleChild to id to save 
binding


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

Branch: refs/heads/develop
Commit: 1fc77cb01c5ef2a2fcd287fa703e8afb64fc2c3a
Parents: 6d9672c
Author: Alex Harui <[email protected]>
Authored: Fri May 22 15:24:08 2015 -0700
Committer: Alex Harui <[email protected]>
Committed: Fri May 22 16:04:10 2015 -0700

----------------------------------------------------------------------
 .../FlexibleFirstChildHorizontalLayout.as       | 48 ++++++++++++-
 .../layouts/OneFlexibleChildHorizontalLayout.as | 72 +++++++++++++++++--
 .../layouts/OneFlexibleChildVerticalLayout.as   | 75 ++++++++++++++++++--
 3 files changed, 181 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1fc77cb0/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
 
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
index f374fb8..ead1dc6 100644
--- 
a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
+++ 
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
@@ -74,6 +74,52 @@ package org.apache.flex.html.beads.layouts
             host = value as ILayoutChild;
                }
        
+        private var _maxWidth:Number;
+        
+        /**
+         *  @copy org.apache.flex.core.IBead#maxWidth
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get maxWidth():Number
+        {
+            return _maxWidth;
+        }
+        
+        /**
+         *  @private 
+         */
+        public function set maxWidth(value:Number):void
+        {
+            _maxWidth = value;
+        }
+        
+        private var _maxHeight:Number;
+        
+        /**
+         *  @copy org.apache.flex.core.IBead#maxHeight
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get maxHeight():Number
+        {
+            return _maxHeight;
+        }
+        
+        /**
+         *  @private 
+         */
+        public function set maxHeight(value:Number):void
+        {
+            _maxHeight = value;
+        }
+        
         /**
          * @copy org.apache.flex.core.IBeadLayout#layout
          */
@@ -89,7 +135,7 @@ package org.apache.flex.html.beads.layouts
                        var marginTop:Object;
                        var marginBottom:Object;
                        var margin:Object;
-                       var maxHeight:Number = 0;
+                       maxHeight = 0;
                        var verticalMargins:Array = [];
                        
             var xx:Number = layoutParent.resizableView.width;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1fc77cb0/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
 
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
index 761f36e..8ba9a96 100644
--- 
a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
+++ 
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
@@ -19,6 +19,7 @@
 package org.apache.flex.html.beads.layouts
 {
        import org.apache.flex.core.IBeadLayout;
+    import org.apache.flex.core.IDocument;
        import org.apache.flex.core.ILayoutChild;
     import org.apache.flex.core.ILayoutParent;
        import org.apache.flex.core.IStrand;
@@ -42,7 +43,7 @@ package org.apache.flex.html.beads.layouts
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-       public class OneFlexibleChildHorizontalLayout implements IBeadLayout
+       public class OneFlexibleChildHorizontalLayout implements IBeadLayout, 
IDocument
        {
         /**
          *  Constructor.
@@ -58,14 +59,16 @@ package org.apache.flex.html.beads.layouts
                
         
         /**
-         *  The flexible child
+         *  The id of the flexible child
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-        public var flexibleChild:IUIBase;
+        public var flexibleChild:String;
+        
+        private var actualChild:ILayoutChild;
         
         // the strand/host container is also an ILayoutChild because
         // can have its size dictated by the host's parent which is
@@ -73,6 +76,12 @@ package org.apache.flex.html.beads.layouts
         private var host:ILayoutChild;
                
         /**
+         *  @private
+         *  The document.
+         */
+        private var document:Object;
+        
+        /**
          *  @copy org.apache.flex.core.IBead#strand
          *  
          *  @langversion 3.0
@@ -85,6 +94,52 @@ package org.apache.flex.html.beads.layouts
             host = value as ILayoutChild;
                }
        
+        private var _maxWidth:Number;
+        
+        /**
+         *  @copy org.apache.flex.core.IBead#maxWidth
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get maxWidth():Number
+        {
+            return _maxWidth;
+        }
+        
+        /**
+         *  @private 
+         */
+        public function set maxWidth(value:Number):void
+        {
+            _maxWidth = value;
+        }
+        
+        private var _maxHeight:Number;
+        
+        /**
+         *  @copy org.apache.flex.core.IBead#maxHeight
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get maxHeight():Number
+        {
+            return _maxHeight;
+        }
+        
+        /**
+         *  @private 
+         */
+        public function set maxHeight(value:Number):void
+        {
+            _maxHeight = value;
+        }
+        
         /**
          * @copy org.apache.flex.core.IBeadLayout#layout
          */
@@ -92,7 +147,8 @@ package org.apache.flex.html.beads.layouts
                {
             var layoutParent:ILayoutParent = host.getBeadByType(ILayoutParent) 
as ILayoutParent;
             var contentView:IParentIUIBase = layoutParent ? 
layoutParent.contentView : IParentIUIBase(host);
-                       
+            actualChild = document[flexibleChild];
+
             var ilc:ILayoutChild;
                        var n:int = contentView.numElements;
                        var marginLeft:Object;
@@ -100,7 +156,7 @@ package org.apache.flex.html.beads.layouts
                        var marginTop:Object;
                        var marginBottom:Object;
                        var margin:Object;
-                       var maxHeight:Number = 0;
+                       maxHeight = 0;
                        var verticalMargins:Array = new Array(n);
                        
             var ww:Number = layoutParent.resizableView.width;
@@ -121,7 +177,7 @@ package org.apache.flex.html.beads.layouts
             for (var i:int = 0; i < n; i++)
             {
                 var child:IUIBase = contentView.getElementAt(i) as IUIBase;
-                if (child == flexibleChild)
+                if (child == actualChild)
                 {
                     flexChildIndex = i;
                     break;
@@ -401,6 +457,10 @@ package org.apache.flex.html.beads.layouts
             return {paddingLeft:pl, paddingTop:pt, paddingRight:pr};
         }
 
+        public function setDocument(document:Object, id:String = null):void
+        {
+            this.document = document;  
+        }
     }
         
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1fc77cb0/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
 
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
index eb641b8..64364c8 100644
--- 
a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
+++ 
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
@@ -19,6 +19,7 @@
 package org.apache.flex.html.beads.layouts
 {
        import org.apache.flex.core.IBeadLayout;
+    import org.apache.flex.core.IDocument;
        import org.apache.flex.core.ILayoutChild;
     import org.apache.flex.core.ILayoutParent;
        import org.apache.flex.core.IStrand;
@@ -42,7 +43,7 @@ package org.apache.flex.html.beads.layouts
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-       public class OneFlexibleChildVerticalLayout implements IBeadLayout
+       public class OneFlexibleChildVerticalLayout implements IBeadLayout, 
IDocument
        {
         /**
          *  Constructor.
@@ -58,14 +59,16 @@ package org.apache.flex.html.beads.layouts
                
         
         /**
-         *  The flexible child
+         *  The id of the flexible child
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-        public var flexibleChild:IUIBase;
+        public var flexibleChild:String;
+        
+        private var actualChild:ILayoutChild;
         
         // the strand/host container is also an ILayoutChild because
         // can have its size dictated by the host's parent which is
@@ -73,6 +76,12 @@ package org.apache.flex.html.beads.layouts
         private var host:ILayoutChild;
                
         /**
+         *  @private
+         *  The document.
+         */
+        private var document:Object;
+        
+        /**
          *  @copy org.apache.flex.core.IBead#strand
          *  
          *  @langversion 3.0
@@ -84,7 +93,53 @@ package org.apache.flex.html.beads.layouts
                {
             host = value as ILayoutChild;
                }
-               
+              
+        private var _maxWidth:Number;
+        
+        /**
+         *  @copy org.apache.flex.core.IBead#maxWidth
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get maxWidth():Number
+        {
+            return _maxWidth;
+        }
+        
+        /**
+         *  @private 
+         */
+        public function set maxWidth(value:Number):void
+        {
+            _maxWidth = value;
+        }
+        
+        private var _maxHeight:Number;
+        
+        /**
+         *  @copy org.apache.flex.core.IBead#maxHeight
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get maxHeight():Number
+        {
+            return _maxHeight;
+        }
+        
+        /**
+         *  @private 
+         */
+        public function set maxHeight(value:Number):void
+        {
+            _maxHeight = value;
+        }
+        
         /**
          * @copy org.apache.flex.core.IBeadLayout#layout
          */
@@ -92,7 +147,8 @@ package org.apache.flex.html.beads.layouts
                {
             var layoutParent:ILayoutParent = host.getBeadByType(ILayoutParent) 
as ILayoutParent;
             var contentView:IParentIUIBase = layoutParent ? 
layoutParent.contentView : IParentIUIBase(host);
-                       
+                       actualChild = document[flexibleChild];
+            
             var ilc:ILayoutChild;
                        var n:int = contentView.numElements;
                        var marginLeft:Object;
@@ -100,7 +156,7 @@ package org.apache.flex.html.beads.layouts
                        var marginTop:Object;
                        var marginBottom:Object;
                        var margin:Object;
-                       var maxWidth:Number = 0;
+                       maxWidth = 0;
                        var horizontalMargins:Array = new Array(n);
                        
             var hh:Number = layoutParent.resizableView.height;
@@ -121,7 +177,7 @@ package org.apache.flex.html.beads.layouts
             for (var i:int = 0; i < n; i++)
             {
                 var child:IUIBase = contentView.getElementAt(i) as IUIBase;
-                if (child == flexibleChild)
+                if (child == actualChild)
                 {
                     flexChildIndex = i;
                     break;
@@ -401,6 +457,11 @@ package org.apache.flex.html.beads.layouts
             return {paddingLeft:pl, paddingTop:pt, paddingRight:pr};
         }
 
+        public function setDocument(document:Object, id:String = null):void
+        {
+            this.document = document;  
+        }
+        
     }
         
 }

Reply via email to