flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject [3/3] git commit: [flex-asjs] [refs/heads/develop] - Updated layout and scrolling. Removed scrolling-specific layouts because that is now handled by new viewports. Modified ContainerView to work with viewports.
Date Mon, 22 Jun 2015 14:40:01 GMT
Updated layout and scrolling. Removed scrolling-specific layouts because that is now handled by new viewports. Modified ContainerView to work with viewports.


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

Branch: refs/heads/develop
Commit: f62f49c75f3853c6eae4feaaf47d7ecd02293e93
Parents: e0b037f
Author: Peter Ent <pent@apache.org>
Authored: Mon Jun 22 10:39:51 2015 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Mon Jun 22 10:39:51 2015 -0400

----------------------------------------------------------------------
 frameworks/projects/HTML/as/defaults.css        |  10 +-
 frameworks/projects/HTML/as/src/HTMLClasses.as  |  11 +-
 .../org/apache/flex/html/beads/ContainerView.as | 551 ++++++++++---------
 .../src/org/apache/flex/html/beads/ListView.as  | 127 +----
 .../src/org/apache/flex/html/beads/PanelView.as |  61 +-
 .../flex/html/beads/PanelWithControlBarView.as  | 103 ++--
 .../flex/html/beads/ScrollingContainerView.as   | 550 ++++++++++--------
 .../flex/html/beads/layouts/HorizontalLayout.as |  45 +-
 .../beads/layouts/HorizontalScrollingLayout.as  | 142 -----
 .../flex/html/beads/layouts/VerticalLayout.as   | 350 ++++++------
 .../beads/layouts/VerticalScrollingLayout.as    | 341 ------------
 .../flex/html/beads/models/ViewportModel.as     | 149 +++++
 .../html/supportClasses/ContainerContentArea.as |  16 +-
 .../flex/html/supportClasses/DataGroup.as       |  20 +-
 .../flex/html/supportClasses/ScrollBar.as       |   3 +-
 .../html/supportClasses/ScrollingViewport.as    | 367 ++++++++++++
 .../html/supportClasses/UIItemRendererBase.as   |   1 +
 .../apache/flex/html/supportClasses/Viewport.as | 132 +++++
 .../org/apache/flex/html/beads/DataGridView.as  |  11 +
 .../FlexibleFirstChildHorizontalLayout.as       |  44 +-
 frameworks/projects/HTML/basic-manifest.xml     |   5 +-
 21 files changed, 1733 insertions(+), 1306 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/defaults.css b/frameworks/projects/HTML/as/defaults.css
index 6bca6cd..7d57d1b 100644
--- a/frameworks/projects/HTML/as/defaults.css
+++ b/frameworks/projects/HTML/as/defaults.css
@@ -113,6 +113,9 @@ DataGrid
     IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
 
     background-color: #FFFFFF;
+	border-style: solid;
+	border-color: #222222;
+	border-width: 1px;
 }
 
 DateChooser {
@@ -152,11 +155,14 @@ List
     IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
     IBeadView:  ClassReference("org.apache.flex.html.beads.ListView");			
     IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
-    IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalScrollingLayout");
+    IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
     IDataGroup: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
     IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");
     IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
     IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+	IViewport: ClassReference("org.apache.flex.html.supportClasses.ScrollingViewport");
+	border-style: solid;
+	border-color: #222222;
 }
 
 Panel
@@ -188,7 +194,7 @@ SimpleList
     IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
     IBeadView:  ClassReference("org.apache.flex.html.beads.ListView");
     IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
-    IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalScrollingLayout");
+    IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
     IDataGroup: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
     IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.TextItemRendererFactoryForArrayData");
     IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/HTMLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/HTMLClasses.as b/frameworks/projects/HTML/as/src/HTMLClasses.as
index d508c82..d74defb 100644
--- a/frameworks/projects/HTML/as/src/HTMLClasses.as
+++ b/frameworks/projects/HTML/as/src/HTMLClasses.as
@@ -48,12 +48,12 @@ internal class HTMLClasses
     import org.apache.flex.html.beads.ImageButtonView; ImageButtonView;
     import org.apache.flex.html.beads.ImageAndTextButtonView; ImageAndTextButtonView;
 	import org.apache.flex.html.beads.ImageView; ImageView;
-    import org.apache.flex.html.beads.ListView; ListView;
+	import org.apache.flex.html.beads.ListView; ListView;
     import org.apache.flex.html.beads.NumericStepperView; NumericStepperView;
     import org.apache.flex.html.beads.PanelView; PanelView;
     import org.apache.flex.html.beads.PanelWithControlBarView; PanelWithControlBarView;
 	import org.apache.flex.html.beads.RadioButtonView; RadioButtonView;
-    import org.apache.flex.html.beads.ScrollBarView; ScrollBarView;
+	import org.apache.flex.html.beads.ScrollBarView; ScrollBarView;
 	import org.apache.flex.html.beads.SimpleAlertView; SimpleAlertView;
     import org.apache.flex.html.beads.SingleLineBorderBead; SingleLineBorderBead;
 	import org.apache.flex.html.beads.SliderView; SliderView;
@@ -79,6 +79,7 @@ internal class HTMLClasses
     import org.apache.flex.html.beads.models.TitleBarModel; TitleBarModel;
 	import org.apache.flex.html.beads.models.ToggleButtonModel; ToggleButtonModel;
 	import org.apache.flex.html.beads.models.ValueToggleButtonModel; ValueToggleButtonModel;
+	import org.apache.flex.html.beads.models.ViewportModel; ViewportModel;
     import org.apache.flex.html.beads.controllers.AlertController; AlertController;
 	import org.apache.flex.html.beads.controllers.ComboBoxController; ComboBoxController;
     import org.apache.flex.html.beads.controllers.DropDownListController; DropDownListController;
@@ -89,14 +90,16 @@ internal class HTMLClasses
 	import org.apache.flex.html.beads.controllers.SpinnerMouseController; SpinnerMouseController;
     import org.apache.flex.html.beads.controllers.VScrollBarMouseController; VScrollBarMouseController;
 	import org.apache.flex.html.beads.layouts.ButtonBarLayout; ButtonBarLayout;
-    import org.apache.flex.html.beads.layouts.VerticalScrollingLayout; VerticalScrollingLayout;  
-	import org.apache.flex.html.beads.layouts.HorizontalScrollingLayout; HorizontalScrollingLayout;
+    import org.apache.flex.html.beads.layouts.VerticalLayout; VerticalLayout;  
+	import org.apache.flex.html.beads.layouts.HorizontalLayout; HorizontalLayout;
     import org.apache.flex.html.beads.layouts.BasicLayout; BasicLayout;
     import org.apache.flex.html.beads.layouts.VScrollBarLayout; VScrollBarLayout;
 	import org.apache.flex.html.beads.layouts.TileLayout; TileLayout;
     import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData; TextItemRendererFactoryForArrayData;
 	import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData; DataItemRendererFactoryForArrayData;
 	import org.apache.flex.html.supportClasses.DataGroup; DataGroup;
+	import org.apache.flex.html.supportClasses.Viewport; Viewport;
+	import org.apache.flex.html.supportClasses.ScrollingViewport; ScrollingViewport;
 	import org.apache.flex.events.CustomEvent; CustomEvent;
 	import org.apache.flex.events.Event; Event;
 	import org.apache.flex.events.MouseEvent; MouseEvent;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
index cb43044..6470276 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
@@ -17,41 +17,36 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads
-{
-    import org.apache.flex.core.BeadViewBase;
-    import org.apache.flex.core.ContainerBase;
-    import org.apache.flex.core.IBead;
-    import org.apache.flex.core.IBeadLayout;
-    import org.apache.flex.core.IBeadView;
-    import org.apache.flex.core.ILayoutParent;
-    import org.apache.flex.core.IParentIUIBase;
-    import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.IUIBase;
+{	
+	import org.apache.flex.core.BeadViewBase;
+	import org.apache.flex.core.ContainerBase;
+	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IBeadLayout;
+	import org.apache.flex.core.IBeadView;
+	import org.apache.flex.core.IContainer;
+	import org.apache.flex.core.ILayoutParent;
+	import org.apache.flex.core.IParentIUIBase;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IViewport;
+	import org.apache.flex.core.IViewportModel;
+	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.UIMetrics;
-    import org.apache.flex.core.UIBase;
-    import org.apache.flex.core.ValuesManager;
-    import org.apache.flex.events.Event;
-    import org.apache.flex.events.IEventDispatcher;
-    import org.apache.flex.html.supportClasses.Border;
-    import org.apache.flex.html.supportClasses.ContainerContentArea;
-    import org.apache.flex.html.supportClasses.ScrollBar;
+	import org.apache.flex.core.ValuesManager;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.html.beads.models.ViewportModel;
+	import org.apache.flex.html.supportClasses.Border;
+	import org.apache.flex.html.supportClasses.ContainerContentArea;
+	import org.apache.flex.html.supportClasses.Viewport;
 	import org.apache.flex.utils.BeadMetrics;
 	
-    /**
-     *  The ContainerView class is the default view for
-     *  the org.apache.flex.core.ContainerBase classes.
-     *  It lets you use some CSS styles to manage the border, background
-     *  and padding around the content area.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion FlexJS 0.0
-     */
 	public class ContainerView extends BeadViewBase implements IBeadView, ILayoutParent
 	{
-        /**
-         *  Constructor.
+		/**
+     	 *  The ContainerView class is the default view for
+         *  the org.apache.flex.core.ContainerBase classes.
+         *  It lets you use some CSS styles to manage the border, background
+         *  and padding around the content area.
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
@@ -62,29 +57,41 @@ package org.apache.flex.html.beads
 		{
 		}
 		
-        /**
-         *  The actual parent that parents the children.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */        
+		/**
+		 *  The actual parent that parents the children.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */        
 		protected var actualParent:UIBase;
-				
-        /**
-         *  The layout.  The layout may actually layout
-         *  the children of the internal content area
-         *  and not the pieces of the "chrome" like titlebars
-         *  and borders.  The ContainerView or its subclass will have some
-         *  baked-in logic for handling the chrome.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */        
-        protected var layout:IBeadLayout;
+		
+		/**
+		 * @private
+		 */
+		private var viewportModel:IViewportModel;
+		
+		private var _viewport:IViewport;
+		
+		/**
+		 * The Viewport used to manage the display of the content area.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get viewport():IViewport
+		{
+			return _viewport;
+		}
+		public function set viewport(value:IViewport):void
+		{
+			_viewport = value;
+		}
+		
+		private var _strand:IStrand;
         
         /**
          *  @copy org.apache.flex.core.IBead#strand
@@ -97,200 +104,207 @@ package org.apache.flex.html.beads
 		override public function set strand(value:IStrand):void
 		{
 			super.strand = value;
-            
-            var host:UIBase = value as UIBase;
-            
-            if (host.isWidthSizedToContent() && host.isHeightSizedToContent())
-            {
-                // if both dimensions are sized to content, then only draw the
-                // borders, etc, after a child is added.  The children in an MXML
-                // document don't send this event until the last child is added.
-                host.addEventListener("childrenAdded", changeHandler);
-                host.addEventListener("layoutNeeded", changeHandler);
-                // listen for width and height changes as well in case the app
-                // switches away from content sizing via binding or other code
-                host.addEventListener("widthChanged", changeHandler);
-                host.addEventListener("heightChanged", changeHandler);
-            }
-            else
-            {
-                // otherwise, listen for size changes before drawing
-                // borders and laying out children.
-                host.addEventListener("widthChanged", changeHandler);
-                host.addEventListener("heightChanged", changeHandler);
-                host.addEventListener("sizeChanged", sizeChangeHandler);
-                // if we have fixed size in both dimensions, listen for children
-				// being added, but also force an initial display to get the
-				// background, border, etc.
-                if (!isNaN(host.explicitWidth) && !isNaN(host.explicitHeight)) {
-                    host.addEventListener("childrenAdded", changeHandler);
-					displayBackgroundAndBorder(host);
-				}
-            }            
-            checkActualParent();
-        }
-        
-        private function checkActualParent():Boolean
-        {
-            var host:UIBase = UIBase(_strand);
-            if (contentAreaNeeded())
-            {
-                if (actualParent == null || actualParent == host)
-                {
-                    actualParent = new ContainerContentArea();
-					actualParent.className = "ActualParent";
-                    host.addElement(actualParent, false);
-                    ContainerBase(host).setActualParent(actualParent);
-                }
-                return true;
-            }
-            else
-            {
-                actualParent = host;
-            }
-            return false;
-        }
-        
-        private function sizeChangeHandler(event:Event):void
-        {
-            var host:UIBase = UIBase(_strand);
-            host.addEventListener("childrenAdded", changeHandler);
-            host.addEventListener("layoutNeeded", changeHandler);
-            host.addEventListener("itemsCreated", changeHandler);
-            changeHandler(event);
-        }
-        
-        private var inChangeHandler:Boolean = false;
-        
-        /**
-         *  React if the size changed or content changed 
+			
+			_strand = value;
+			
+			var host:UIBase = value as UIBase;
+			var metrics:UIMetrics = getMetrics();
+			
+			checkActualParent(true);
+			
+			createViewport(metrics);
+			
+			viewport.updateContentAreaSize();
+			
+			if (!host.isWidthSizedToContent() && !host.isHeightSizedToContent()) {
+				displayBackgroundAndBorder(host);
+			}
+			
+			host.addEventListener("childrenAdded", changeHandler);
+			host.addEventListener("layoutNeeded", changeHandler);
+			host.addEventListener("widthChanged", resizeHandler);
+			host.addEventListener("heightChanged", resizeHandler);
+		}
+		
+		/**
+		 * Creates and initializes the Viewport. Subclasses can override this to
+		 * reposition the Viewport, via the Viewport's model, to suit their needs. 
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
-         */
-        protected function changeHandler(event:Event):void
-        {
-            if (inChangeHandler) return;
-            
-            inChangeHandler = true;
-            
-            var host:UIBase = UIBase(_strand);
-			var originalHostWidth:Number = host.width;
-			var originalHostHeight:Number = host.height;
-
-            if (layout == null)
-            {
-                layout = _strand.getBeadByType(IBeadLayout) as IBeadLayout;
-                if (layout == null)
-                {
-                    var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
-                    if (c)
-                    {
-                        layout = new c() as IBeadLayout;
-                        _strand.addBead(layout);
-                    }
-                }
-            }
-            
-			var metrics:UIMetrics = determineMetrics();
+		 */
+		protected function createViewport(metrics:UIMetrics):void
+		{
+			viewportModel = new ViewportModel();
 			
-			if (checkActualParent())
-			{
-				actualParent.x = metrics.left;
-				actualParent.y = metrics.top;
-            }
-            var pb:Number = metrics.bottom;
-            if (isNaN(pb))
-                pb = 0;
-            var pr:Number = metrics.right;
-            if (isNaN(pr))
-                pr = 0;
+			// the viewport takes the entire space as there is no default chrome.
+			// if chrome children get added the viewport will need to be adjusted
+			// accordingly.
+			viewportModel.viewportHeight = host.height;
+			viewportModel.viewportWidth = host.width;
+			viewportModel.viewportX = 0;
+			viewportModel.viewportY = 0;
 			
-			var sizeChangedByLayout:Boolean;
+			// default the content area to match the viewport's size. later, the
+			// viewport will resize and position the contentArea if needed.
+			viewportModel.contentHeight = viewportModel.viewportHeight - metrics.top - metrics.bottom;
+			viewportModel.contentWidth = viewportModel.viewportWidth - metrics.left - metrics.right;
+			viewportModel.contentX = viewportModel.viewportX + metrics.left;
+			viewportModel.contentY = viewportModel.viewportY + metrics.top;
 			
-            // if the width is dictated by the parent
-            if (!host.isWidthSizedToContent())
-            {
-                if (actualParent != host)
-                {
-                    // force the width of the internal content area as desired.
-                    actualParent.setWidth(host.width);
-                }
-                // run the layout
-                sizeChangedByLayout = layout.layout();
-            }
-            else 
-            {
-                // if the height is dictated by the parent
-                if (!host.isHeightSizedToContent())
-                {
-                    if (actualParent != host)
-                    {
-                        // force the height
-                        actualParent.setHeight(host.height);
-                    }
-                }
-                sizeChangedByLayout = layout.layout();
-                if (actualParent != host)
-                {
-                    // actualParent.width should be the new width after layout.
-                    // set the host's width.  This should send a widthChanged event and
-                    // have it blocked at the beginning of this method
-//old                    host.setWidth(padding.paddingLeft + pr + actualParent.width);
-					host.setWidth(actualParent.width);
-                }
-            }
-            // and if the height is sized to content, set the height now as well.
-            if (host != actualParent)
-	        {
-                if (host.isHeightSizedToContent()) {
-                    host.setHeight(actualParent.height);
+			viewportModel.horizontalScrollPosition = 0;
+			viewportModel.verticalScrollPosition = 0;
+			viewportModel.contentArea = actualParent;
+			
+			if (viewport == null) {
+				viewport = _strand.getBeadByType(IViewport) as IViewport;
+				if (viewport == null) {
+					var c:Class = ValuesManager.valuesImpl.getValue(host, "iViewport");
+					if (c)
+					{
+						viewport = new c() as IViewport;
+						_strand.addBead(viewport);
+					}
+					else {
+						viewport = new Viewport();
+						_strand.addBead(viewport);
+					}
 				}
-                else
-                    actualParent.setHeight(host.height);
-		    }
-			// if host and actualParent are the same, determine if the layout changed
-			// the size and if, dispatch events based on what changed
-			else if (sizeChangedByLayout) 
+				viewport.model = viewportModel;
+			}
+		}
+				
+		/**
+		 * Event handler invoked whenever the size or children are added.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		protected function changeHandler(event:Event):void
+		{
+			var host:UIBase = UIBase(_strand);
+			
+			// add the layout to the viewport if not done so already
+			if (viewportModel.layout == null)
 			{
-				if (originalHostWidth != host.width) 
-					host.dispatchEvent(new Event("widthChanged"));
-				if (originalHostHeight != host.height)
-					host.dispatchEvent(new Event("heightChanged"));
+				viewportModel.layout = _strand.getBeadByType(IBeadLayout) as IBeadLayout;
+				if (viewportModel.layout == null)
+				{
+					var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
+					if (c)
+					{
+						viewportModel.layout = new c() as IBeadLayout;
+						_strand.addBead(viewportModel.layout);
+					}
+				}
 			}
 			
+			// Run the layout which will not only size and position the children
+			// of the contentArea (actualParent), but will also change the viewport
+			// model's content size properties. 
+			if (viewport.runLayout()) 
+			{
+				handleContentResize();
+			}			
+			
+			// update the contentArea so that it exposes all of the items as placed
+			// by the layout.
+			viewport.updateContentAreaSize();
+			
 			displayBackgroundAndBorder(host);
-			            
-            inChangeHandler = false;
 		}
 		
-		protected function displayBackgroundAndBorder(host:UIBase) : void
+		protected function handleContentResize():void
 		{
-			var backgroundColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
-			var backgroundImage:Object = ValuesManager.valuesImpl.getValue(host, "background-image");
-			if (backgroundColor != null || backgroundImage != null)
+			var host:UIBase = UIBase(_strand);
+			
+			// If the host is being sized by its content, the change in the contentArea
+			// causes the host's size to change
+			if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {					
+				host.setWidthAndHeight(viewportModel.contentWidth, viewportModel.contentHeight, true);
+				
+				viewportModel.viewportHeight = host.height;
+				viewportModel.viewportWidth  = host.width;				
+			}
+				
+				// if the width is fixed and the height is changing, then set up horizontal
+				// scrolling (if the viewport supports it).
+			else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent())
 			{
-				if (host.getBeadByType(IBackgroundBead) == null)
-					host.addBead(new (ValuesManager.valuesImpl.getValue(host, "iBackgroundBead")) as IBead);					
+				viewport.needsHorizontalScroller();
+				
+				host.setHeight(viewportModel.contentHeight, false);
+				viewportModel.viewportHeight = host.height;
+				
 			}
-			
-			var borderStyle:String;
-			var borderStyles:Object = ValuesManager.valuesImpl.getValue(host, "border");
-			if (borderStyles is Array)
+				
+				// if the height is fixed and the width can change, then set up
+				// vertical scrolling (if the viewport supports it).
+			else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent())
 			{
-				borderStyle = borderStyles[1];
+				viewport.needsVerticalScroller();
+				
+				host.setWidth(viewportModel.contentWidth+viewport.scrollerWidth(), false);
+				viewportModel.viewportWidth = host.width;
 			}
-			if (borderStyle == null)
+				
+				// Otherwise the viewport needs to display some scrollers (or other elements
+				// allowing the rest of the contentArea to be visible)
+			else {
+				
+				viewport.needsScrollers();
+			}
+		}
+		
+		/**
+		 * @private
+		 */
+		private function resizeHandler(event:Event):void
+		{
+//			if (event.currentTarget == _strand) {
+//				return;
+//			}
+			
+			var host:UIBase = UIBase(_strand);
+			trace("host is now "+host.width + " x " +host.height);
+			
+			viewportModel.viewportHeight = host.height;
+			viewportModel.viewportWidth = host.width;
+			
+			if (!host.isWidthSizedToContent()) viewportModel.contentWidth = host.width;
+			if (!host.isHeightSizedToContent()) viewportModel.contentHeight = host.height;
+			
+			changeHandler(event);
+			
+			viewport.updateSize();
+		}
+		
+		/**
+		 * @private
+		 */
+		protected function checkActualParent(force:Boolean=false):Boolean
+		{
+			var host:UIBase = UIBase(_strand);
+			if (contentAreaNeeded() || force)
 			{
-				borderStyle = ValuesManager.valuesImpl.getValue(host, "border-style") as String;
+				if (actualParent == null || actualParent == host)
+				{
+					actualParent = new ContainerContentArea();
+					actualParent.className = "ActualParent";
+					host.addElement(actualParent, false);
+					ContainerBase(host).setActualParent(actualParent);
+				}
+				return true;
 			}
-			if (borderStyle != null && borderStyle != "none")
+			else
 			{
-				if (host.getBeadByType(IBorderBead) == null)
-					host.addBead(new (ValuesManager.valuesImpl.getValue(host, "iBorderBead")) as IBead);	
+				actualParent = host;
 			}
+			return false;
 		}
 		
 		/**
@@ -303,38 +317,85 @@ package org.apache.flex.html.beads
 		 */
 		protected function contentAreaNeeded():Boolean
 		{
-			var metrics:UIMetrics = determineMetrics();
+			var metrics:UIMetrics = getMetrics();
 			
 			return (!isNaN(metrics.left) && metrics.left > 0 ||
-				    !isNaN(metrics.top) && metrics.top > 0);
+				!isNaN(metrics.top) && metrics.top > 0);
 		}
 		
-        /**
-         *  The parent of the children.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
+		/**
+		 * Returns the metrics (border, padding) of the strand.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function getMetrics():UIMetrics
+		{
+			return BeadMetrics.getMetrics(_strand);
+		}
+		
+		/**
+		 *  The parent of the children.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
 		public function get contentView():IParentIUIBase
 		{
 			return actualParent;
 		}
 		
-        /**
-         *  The host component, which can resize to different slots.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
+		/**
+		 *  The host component, which can resize to different slots.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
 		public function get resizableView():IUIBase
 		{
 			return _strand as IUIBase;
 		}
 		
+		protected function displayBackgroundAndBorder(host:UIBase) : void
+		{
+			var backgroundColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
+			var backgroundImage:Object = ValuesManager.valuesImpl.getValue(host, "background-image");
+			if (backgroundColor != null || backgroundImage != null)
+			{
+				if (host.getBeadByType(IBackgroundBead) == null)
+					var c:Class = ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
+				    if (c) {
+						host.addBead( new c() as IBead );
+					}
+			}
+			
+			var borderStyle:String;
+			var borderStyles:Object = ValuesManager.valuesImpl.getValue(host, "border");
+			if (borderStyles is Array)
+			{
+				borderStyle = borderStyles[1];
+			}
+			if (borderStyle == null)
+			{
+				borderStyle = ValuesManager.valuesImpl.getValue(host, "border-style") as String;
+			}
+			if (borderStyle != null && borderStyle != "none")
+			{
+				if (host.getBeadByType(IBorderBead) == null) {
+					c = ValuesManager.valuesImpl.getValue(host, "iBorderBead");
+					if (c) {
+						host.addBead( new c() as IBead );
+					}
+				}
+			}
+		}
+		
         private var inGetViewHeight:Boolean;
         
 		/**
@@ -373,7 +434,7 @@ package org.apache.flex.html.beads
             if (inGetViewWidth)
             {
                 //trace("ContainerView: no width set for " + host);
-				var metrics:UIMetrics = determineMetrics();
+				var metrics:UIMetrics = getMetrics();
                 return host["$width"] + metrics.left + metrics.right;
             }
             inGetViewWidth = true;
@@ -381,11 +442,5 @@ package org.apache.flex.html.beads
             inGetViewWidth = false;
 			return vw;
 		}
-		
-		protected function determineMetrics():UIMetrics
-		{
-			return BeadMetrics.getMetrics(_strand);
-		}
-		
 	}
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as
index 86ea70d..886a9aa 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as
@@ -19,11 +19,13 @@
 package org.apache.flex.html.beads
 {	
 	import org.apache.flex.core.BeadViewBase;
+	import org.apache.flex.core.ContainerBase;
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IBeadModel;
 	import org.apache.flex.core.IBeadView;
 	import org.apache.flex.core.ISelectableItemRenderer;
+	import org.apache.flex.core.IItemRenderer;
 	import org.apache.flex.core.IItemRendererParent;
 	import org.apache.flex.core.IScrollingLayoutParent;
 	import org.apache.flex.core.IParent;
@@ -54,7 +56,7 @@ package org.apache.flex.html.beads
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
 	 */
-	public class ListView extends Strand implements IBeadView, IStrand, IListView, IScrollingLayoutParent
+	public class ListView extends ContainerView implements IListView
 	{
 		public function ListView()
 		{
@@ -96,36 +98,6 @@ package org.apache.flex.html.beads
 			_dataGroup = value;
 		}
 		
-		private var _vScrollBar:ScrollBar;
-		
-		/**
-		 *  The vertical org.apache.flex.html.ScrollBar, if needed.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get vScrollBar():ScrollBar
-		{
-            if (!_vScrollBar)
-                _vScrollBar = createScrollBar();
-			return _vScrollBar;
-		}
-		
-		/**
-		 *  The horizontal org.apache.flex.html.ScrollBar, currently null.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get hScrollBar():ScrollBar
-		{
-			return null;
-		}
-		
 		/**
 		 *  The contentArea includes the dataGroup and scrollBars.
 		 *
@@ -134,7 +106,7 @@ package org.apache.flex.html.beads
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function get contentView():IParentIUIBase
+		override public function get contentView():IParentIUIBase
 		{
 			return _dataGroup as IParentIUIBase;
 		}
@@ -142,17 +114,15 @@ package org.apache.flex.html.beads
 		/**
 		 * @private
 		 */
-		public function get resizableView():IUIBase
+		override public function get resizableView():IUIBase
 		{
 			return _strand as IUIBase;
 		}
-		
-        private var _layout:IBeadLayout;
         
         /**
          * @private
          */
-        public function get host():IUIBase
+        override public function get host():IUIBase
         {
             return _strand as IUIBase;
         }
@@ -167,35 +137,32 @@ package org.apache.flex.html.beads
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function set strand(value:IStrand):void
+		override public function set strand(value:IStrand):void
 		{
 			_strand = value;
-			
-            for each (var bead:IBead in beads)
-                addBead(bead);
+			super.strand = value;
             
-            dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
 			IEventDispatcher(_strand).addEventListener("widthChanged", handleSizeChange);
 			IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
             
             // this gets sent at least once after the beads are all in place.
             IEventDispatcher(_strand).addEventListener("layoutNeeded",handleSizeChange);
-            
+			IEventDispatcher(_strand).addEventListener("itemsCreated", changeHandler);
+     
             listModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
             listModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
             listModel.addEventListener("rollOverIndexChanged", rollOverIndexChangeHandler);
 			listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-
-            _border = new Border();
-            _border.model = new (ValuesManager.valuesImpl.getValue(value, "iBorderModel")) as IBeadModel;
-            _strand.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
-            IParent(_strand).addElement(_border);
-            
+		}
+		
+		override protected function checkActualParent(force:Boolean=false):Boolean
+		{
 			if (_dataGroup == null) {
-				_dataGroup = new (ValuesManager.valuesImpl.getValue(value, "iDataGroup")) as IItemRendererParent;
+				_dataGroup = new (ValuesManager.valuesImpl.getValue(_strand, "iDataGroup")) as IItemRendererParent;
+				actualParent = _dataGroup as UIBase;
+				IParent(_strand).addElement(_dataGroup,false);
 			}
-			IParent(_strand).addElement(_dataGroup);
-            
+			return true;
 		}
 		
 		private var lastSelectedIndex:int = -1;
@@ -206,6 +173,7 @@ package org.apache.flex.html.beads
 		protected function dataProviderChangeHandler(event:Event):void
 		{
 			// override if needed
+			changeHandler(event);
 		}
 		
 		/**
@@ -245,46 +213,6 @@ package org.apache.flex.html.beads
 			}
 			lastRollOverIndex = IRollOverModel(listModel).rollOverIndex;
 		}
-			
-		/**
-		 * @private
-		 */
-		private function createScrollBar():ScrollBar
-		{
-			var vsb:ScrollBar;
-			vsb = new ScrollBar();
-			var vsbm:ScrollBarModel = new ScrollBarModel();
-			vsbm.maximum = 100;
-			vsbm.minimum = 0;
-			vsbm.pageSize = 10;
-			vsbm.pageStepSize = 10;
-			vsbm.snapInterval = 1;
-			vsbm.stepSize = 1;
-			vsbm.value = 0;
-			vsb.model = vsbm;
-			vsb.x = IUIBase(_strand).width - 16;
-			vsb.y = 0;
-			vsb.setWidthAndHeight(16, IUIBase(_strand).height, true);
-            IParent(_strand).addElement(vsb);
-			return vsb;
-		}
-
-        /**
-         *  Layout everything except the DataGroup, 
-         *  but size the DataGroup as needed
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        protected function layoutList():void
-        {
-            UIBase(_dataGroup).x = 0;
-            UIBase(_dataGroup).y = 0;
-            UIBase(_dataGroup).width = UIBase(_strand).width;
-            UIBase(_dataGroup).height = UIBase(_strand).height;
-        }
         
         /**
          *  respond to a change in size or request to re-layout everything
@@ -296,18 +224,7 @@ package org.apache.flex.html.beads
          */
 		protected function handleSizeChange(event:Event):void
 		{
-            layoutList();
-            
-            if (_layout == null)
-            {
-                _layout = _strand.getBeadByType(IBeadLayout) as IBeadLayout;
-                if (_layout == null)
-                {
-                    _layout = new (ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout")) as IBeadLayout;
-                    _strand.addBead(_layout);
-                }  
-            }
-            _layout.layout();
+			_dataGroup.updateAllItemRenderers();
 		}
 				
         /**
@@ -318,7 +235,7 @@ package org.apache.flex.html.beads
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-        public function get viewHeight():Number
+        override public function get viewHeight():Number
         {
             // don't want to put $height in an interface
             return _strand["$height"];
@@ -332,7 +249,7 @@ package org.apache.flex.html.beads
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-        public function get viewWidth():Number
+        override public function get viewWidth():Number
         {
             // don't want to put $width in an interface
             return _strand["$width"];

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
index f7303e7..7004b6d 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
@@ -23,6 +23,7 @@ package org.apache.flex.html.beads
 	import org.apache.flex.core.IBeadView;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IViewportModel;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.UIMetrics;
 	import org.apache.flex.events.Event;
@@ -99,12 +100,57 @@ package org.apache.flex.html.beads
 			// be picked up automatically by the TitleBar.
 			titleBar.model = host.model;
 			host.addElement(titleBar, false);
-			titleBar.addEventListener("heightChanged", changeHandler);
+			titleBar.addEventListener("heightChanged", titleBarHeightChanged);
             if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
                 titleBar.addEventListener("widthChanged", changeHandler);
+			
+			trace("TitleBar's height: "+titleBar.height);
             
             super.strand = value;
-            
+
+		}
+		
+		private function setupViewport(metrics:UIMetrics):void
+		{
+			var host:UIBase = UIBase(_strand);
+			
+			titleBar.width = host.width;
+			
+			var model:IViewportModel = viewport.model;
+			model.viewportX = 0;
+			model.viewportY = titleBar.height;
+			model.viewportWidth = host.width;
+			model.viewportHeight = host.height - titleBar.height;
+			model.contentX = model.viewportX + metrics.left;
+			model.contentY = model.viewportY + metrics.top;
+			model.contentWidth = model.viewportWidth - metrics.left - metrics.right;
+			model.contentHeight = model.viewportHeight - metrics.top - metrics.bottom;
+		}
+		
+		override protected function createViewport(metrics:UIMetrics):void
+		{
+			super.createViewport(metrics);
+			setupViewport(metrics);
+		}
+		
+		override protected function handleContentResize():void
+		{
+			super.handleContentResize();
+			
+			var host:UIBase = UIBase(_strand);
+			titleBar.width = host.width;
+		}
+		
+		override protected function changeHandler(event:Event):void
+		{
+			titleBar.width = UIBase(_strand).width;
+			super.changeHandler(event);
+		}
+		
+		private function titleBarHeightChanged(event:Event):void
+		{
+			var metrics:UIMetrics = this.getMetrics();
+			setupViewport(metrics);
 		}
         
         /**
@@ -115,17 +161,6 @@ package org.apache.flex.html.beads
         {
             return true;
         }
-						
-        /**
-         * @private
-         */
-        override protected function determineMetrics():UIMetrics
-        {
-            var metrics:UIMetrics = super.determineMetrics();
-            titleBar.width = UIBase(_strand).width;
-            metrics.top += titleBar.height;
-            return metrics;
-        }
                 
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
index 69645fb..54e6482 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
@@ -25,6 +25,7 @@ package org.apache.flex.html.beads
     import org.apache.flex.core.ITitleBarModel;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IViewportModel;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.UIMetrics;
 	import org.apache.flex.events.Event;
@@ -110,7 +111,7 @@ package org.apache.flex.html.beads
 			// be picked up automatically by the TitleBar.
 			titleBar.model = host.model;
 			host.addElement(titleBar, false);
-			titleBar.addEventListener("heightChanged", changeHandler);
+			titleBar.addEventListener("heightChanged", chromeHeightChanged);
 			if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
 				titleBar.addEventListener("widthChanged", changeHandler);
 			
@@ -126,7 +127,7 @@ package org.apache.flex.html.beads
 				_controlBar.dispatchEvent(new Event("layoutNeeded"));
 				
 				host.addElement(controlBar, false);
-				controlBar.addEventListener("heightChanged", changeHandler);
+				controlBar.addEventListener("heightChanged", chromeHeightChanged);
 				if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
 					controlBar.addEventListener("widthChanged", changeHandler);
 			}
@@ -134,66 +135,74 @@ package org.apache.flex.html.beads
 			super.strand = value;
 		}
 		
-		/**
-		 *  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
+		private function setupViewport(metrics:UIMetrics):void
 		{
-			return true;
+			var host:UIBase = UIBase(_strand);
+			
+			titleBar.width = host.width;
+			if (controlBar) {
+				controlBar.width = host.width;
+				controlBar.y = host.height - controlBar.height;
+			}
+			
+			var model:IViewportModel = viewport.model;
+			model.viewportX = 0;
+			model.viewportY = titleBar.height;
+			model.viewportWidth = host.width;
+			model.viewportHeight = host.height - titleBar.height;
+			if (controlBar) {
+				model.viewportHeight -= controlBar.height;
+			}
+			model.contentX = model.viewportX + metrics.left;
+			model.contentY = model.viewportY + metrics.top;
+			model.contentWidth = model.viewportWidth - metrics.left - metrics.right;
+			model.contentHeight = model.viewportHeight - metrics.top - metrics.bottom;
 		}
 		
-		/**
-		 * @private
-		 */
-		override protected function determineMetrics():UIMetrics
+		override protected function createViewport(metrics:UIMetrics):void
 		{
-			var metrics:UIMetrics = super.determineMetrics();
-			titleBar.width = UIBase(_strand).width;
-			metrics.top += titleBar.height;
+			super.createViewport(metrics);
+			setupViewport(metrics);
+		}
+		
+		override protected function handleContentResize():void
+		{
+			super.handleContentResize();
 			
-			controlBar.width = UIBase(_strand).width;
-			metrics.bottom += controlBar.height;
-
-			return metrics;
+			var host:UIBase = UIBase(_strand);
+			titleBar.width = host.width;
+			if (controlBar) {
+				controlBar.width = host.width;
+				controlBar.y = host.height - controlBar.height;
+			}
 		}
 		
-		/**
-		 * @private
-		 */
 		override protected function changeHandler(event:Event):void
 		{
+			titleBar.width = UIBase(_strand).width;	
+			controlBar.width = UIBase(_strand).width;
+			controlBar.y = UIBase(_strand).height - controlBar.height;	
 			super.changeHandler(event);
-			
-			controlBar.y = UIBase(_strand).height - controlBar.height;
+		}
+		
+		private function chromeHeightChanged(event:Event):void
+		{
+			var metrics:UIMetrics = this.getMetrics();
+			setupViewport(metrics);
 		}
 		
 		/**
-		 * @private
+		 *  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
 		 */
-		private function layoutChromeElements():void
+		override protected function contentAreaNeeded():Boolean
 		{
-			var metrics:UIMetrics = determineMetrics();
-			titleBar.x = 0;
-			titleBar.y = 0;
-			titleBar.width = UIBase(_strand).width;
-			
-			if (controlBar) {
-				controlBar.x = 0;
-				controlBar.y = UIBase(_strand).height - controlBar.height;
-				controlBar.width = UIBase(_strand).width;
-			}
-			
-			actualParent.x = metrics.left;
-			actualParent.y = titleBar.height + metrics.top;
-			actualParent.width = UIBase(_strand).width - metrics.left - metrics.right;
-			actualParent.height = UIBase(_strand).height - titleBar.height - metrics.top - metrics.bottom;
-			if (controlBar) actualParent.height -= controlBar.height;
+			return true;
 		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollingContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollingContainerView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollingContainerView.as
index a859b07..4c407f2 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollingContainerView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollingContainerView.as
@@ -17,44 +17,35 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads
-{
-	
+{	
 	import org.apache.flex.core.BeadViewBase;
 	import org.apache.flex.core.ContainerBase;
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IBeadView;
-	import org.apache.flex.core.IParent;
+	import org.apache.flex.core.IContainer;
+	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IParentIUIBase;
-	import org.apache.flex.core.IScrollingLayoutParent;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IViewportModel;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.UIMetrics;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
-	import org.apache.flex.html.Container;
-	import org.apache.flex.html.beads.models.ScrollBarModel;
+	import org.apache.flex.html.beads.models.ViewportModel;
 	import org.apache.flex.html.supportClasses.Border;
 	import org.apache.flex.html.supportClasses.ContainerContentArea;
-	import org.apache.flex.html.supportClasses.ScrollBar;
+	import org.apache.flex.html.supportClasses.Viewport;
 	import org.apache.flex.utils.BeadMetrics;
 	
-    /**
-     *  The ContainerView class is the default view for
-     *  the org.apache.flex.html.Container class.
-     *  It lets you use some CSS styles to manage the border, background
-     *  and padding around the content area.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion FlexJS 0.0
-     */
-	public class ScrollingContainerView extends BeadViewBase implements IBeadView, IScrollingLayoutParent
+	public class ScrollingContainerView extends BeadViewBase implements IBeadView, ILayoutParent
 	{
-        /**
-         *  Constructor.
+		/**
+     	 *  The ContainerView class is the default view for
+         *  the org.apache.flex.core.ContainerBase classes.
+         *  It lets you use some CSS styles to manage the border, background
+         *  and padding around the content area.
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
@@ -63,40 +54,43 @@ package org.apache.flex.html.beads
          */
 		public function ScrollingContainerView()
 		{
-            var vsbm:ScrollBarModel = new ScrollBarModel();
-            vsbm.maximum = 0;
-            vsbm.minimum = 0;
-            vsbm.pageSize = 0;
-            vsbm.pageStepSize = 1;
-            vsbm.snapInterval = 1;
-            vsbm.stepSize = 1;
-            vsbm.value = 0;
-            _vScrollBarModel = vsbm;
 		}
 		
-        /**
-         *  The actual parent that parents the children.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */        
+		/**
+		 *  The actual parent that parents the children.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */        
 		protected var actualParent:UIBase;
-				
-        /**
-         *  The layout.  The layout may actually layout
-         *  the children of the internal content area
-         *  and not the pieces of the "chrome" like titlebars
-         *  and borders.  The ContainerView or its subclass will have some
-         *  baked-in logic for handling the chrome.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */        
-        protected var layout:IBeadLayout;
+		
+		/**
+		 * @private
+		 */
+		private var viewportModel:IViewportModel;
+		
+		private var _viewport:Viewport;
+		
+		/**
+		 * The Viewport used to manage the display of the content area.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get viewport():Viewport
+		{
+			return _viewport;
+		}
+		public function set viewport(value:Viewport):void
+		{
+			_viewport = value;
+		}
+		
+		private var _strand:IStrand;
         
         /**
          *  @copy org.apache.flex.core.IBead#strand
@@ -109,221 +103,260 @@ package org.apache.flex.html.beads
 		override public function set strand(value:IStrand):void
 		{
 			super.strand = value;
-            var host:UIBase = value as UIBase;
 			
-			actualParent = new ContainerContentArea();
-			actualParent.className = "ActualParent";
-			host.addElement(actualParent, false);
-			ContainerBase(host).setActualParent(actualParent);
+			_strand = value;
 			
-			host.addEventListener("beadsAdded", changeHandler);
-            
-            if (host.isWidthSizedToContent() && host.isHeightSizedToContent())
-            {
-                // if both dimensions are sized to content, then only draw the
-                // borders, etc, after a child is added.  The children in an MXML
-                // document don't send this event until the last child is added.
-                host.addEventListener("childrenAdded", changeHandler);
-                host.addEventListener("layoutNeeded", changeHandler);
-                // listen for width and height changes as well in case the app
-                // switches away from content sizing via binding or other code
-                host.addEventListener("widthChanged", changeHandler);
-                host.addEventListener("heightChanged", changeHandler);
-            }
-            else
-            {
-                // otherwise, listen for size changes before drawing
-                // borders and laying out children.
-                host.addEventListener("widthChanged", changeHandler);
-                host.addEventListener("heightChanged", changeHandler);
-                host.addEventListener("sizeChanged", sizeChangeHandler);
-                // if we have fixed size in both dimensions, wait for children
-                // to be added then run a layout pass right then as the
-                // parent won't kick off any other event in the child
-                if (!isNaN(host.explicitWidth) && !isNaN(host.explicitHeight))
-                {
-                    if (host.numChildren == 0)
-                        host.addEventListener("childrenAdded", changeHandler);
-                }
-            }
+			var host:UIBase = value as UIBase;
+			var metrics:UIMetrics = getMetrics();
 			
-			displayBackgroundAndBorder(host);
-        }
-        
-        private function sizeChangeHandler(event:Event):void
-        {
-            var host:UIBase = UIBase(_strand);
-            host.addEventListener("childrenAdded", changeHandler);
-            host.addEventListener("layoutNeeded", changeHandler);
-            host.addEventListener("itemsCreated", changeHandler);
-        }
-		
-		private var inChangeHandler:Boolean = false;
-
-        private function changeHandler(event:Event):void
-        {
-			if (inChangeHandler) return;
+			checkActualParent(true);
 			
-			inChangeHandler = true;
+			createViewport(metrics);
 			
-            var host:UIBase = _strand as UIBase;
-            if (layout == null)
-            {
-                layout = host.getBeadByType(IBeadLayout) as IBeadLayout;
-                if (layout == null)
-                {
-                    var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
-                    if (c)
-                    {
-                        layout = new c() as IBeadLayout;
-                        host.addBead(layout);
-                    }
-                }
-            }
-			
-			var metrics:UIMetrics = BeadMetrics.getMetrics(host);
+			viewport.updateContentAreaSize();
 			
-			actualParent.x = metrics.left;
-			actualParent.y = metrics.top;
-			actualParent.width = host.width - metrics.left - metrics.right;
-			actualParent.height = host.height - metrics.top -metrics.bottom;
-			// note that adding a scrollbar will go against the host's right
-			// edge and be separated from the actualParent by padding-right
-        
-            layout.layout();
+			if (!host.isWidthSizedToContent() && !host.isHeightSizedToContent()) {
+				displayBackgroundAndBorder(host);
+			}
 			
-			inChangeHandler = false;
+			host.addEventListener("childrenAdded", changeHandler);
+			host.addEventListener("layoutNeeded", changeHandler);
+			host.addEventListener("widthChanged", resizeHandler);
+			host.addEventListener("heightChanged", resizeHandler);
 		}
 		
-        /**
-         *  The parent of the children.
+		/**
+		 * Creates and initializes the Viewport. Subclasses can override this to
+		 * reposition the Viewport, via the Viewport's model, to suit their needs. 
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
-         */
-		public function get contentView():IParentIUIBase
+		 */
+		protected function createViewport(metrics:UIMetrics):void
 		{
-			return actualParent;
+			viewportModel = new ViewportModel();
+			
+			// the viewport takes the entire space as there is no default chrome.
+			// if chrome children get added the viewport will need to be adjusted
+			// accordingly.
+			viewportModel.viewportHeight = host.height;
+			viewportModel.viewportWidth = host.width;
+			viewportModel.viewportX = 0;
+			viewportModel.viewportY = 0;
+			
+			// default the content area to match the viewport's size. later, the
+			// viewport will resize and position the contentArea if needed.
+			viewportModel.contentHeight = viewportModel.viewportHeight - metrics.top - metrics.bottom;
+			viewportModel.contentWidth = viewportModel.viewportWidth - metrics.left - metrics.right;
+			viewportModel.contentX = viewportModel.viewportX + metrics.left;
+			viewportModel.contentY = viewportModel.viewportY + metrics.top;
+			
+			viewportModel.horizontalScrollPosition = 0;
+			viewportModel.verticalScrollPosition = 0;
+			viewportModel.contentArea = actualParent;
+			
+			if (viewport == null) {
+				viewport = _strand.getBeadByType(Viewport) as Viewport;
+				if (viewport == null) {
+					var c:Class = ValuesManager.valuesImpl.getValue(host, "iViewport");
+					if (c)
+					{
+						viewport = new c() as Viewport;
+						_strand.addBead(viewport);
+					}
+					else {
+						viewport = new Viewport();
+						_strand.addBead(viewport);
+					}
+				}
+				viewport.model = viewportModel;
+			}
 		}
-		
-        /**
-         *  The border.
+				
+		/**
+		 * Event handler invoked whenever the size or children are added.
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-		public function get border():Border
+		protected function changeHandler(event:Event):void
 		{
-			return null;
+			var host:UIBase = UIBase(_strand);
+			
+			// add the layout to the viewport if not done so already
+			if (viewportModel.layout == null)
+			{
+				viewportModel.layout = _strand.getBeadByType(IBeadLayout) as IBeadLayout;
+				if (viewportModel.layout == null)
+				{
+					var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
+					if (c)
+					{
+						viewportModel.layout = new c() as IBeadLayout;
+						_strand.addBead(viewportModel.layout);
+					}
+				}
+			}
+			
+			// Run the layout which will not only size and position the children
+			// of the contentArea (actualParent), but will also change the viewport
+			// model's content size properties. 
+			if (viewport.runLayout()) 
+			{
+				handleContentResize();
+			}			
+			
+			// update the contentArea so that it exposes all of the items as placed
+			// by the layout.
+			viewport.updateContentAreaSize();
+			
+			displayBackgroundAndBorder(host);
 		}
 		
-        /**
-         *  The host component, which can resize to different slots.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function get resizableView():IUIBase
+		protected function handleContentResize():void
 		{
-			return _strand as IUIBase;
+			var host:UIBase = UIBase(_strand);
+			
+			// If the host is being sized by its content, the change in the contentArea
+			// causes the host's size to change
+			if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {					
+				host.setWidthAndHeight(viewportModel.contentWidth, viewportModel.contentHeight, true);
+				
+				viewportModel.viewportHeight = host.height;
+				viewportModel.viewportWidth  = host.width;				
+			}
+				
+				// if the width is fixed and the height is changing, then set up horizontal
+				// scrolling (if the viewport supports it).
+			else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent())
+			{
+				viewport.needsHorizontalScroller();
+				
+				host.setHeight(viewportModel.contentHeight, false);
+				viewportModel.viewportHeight = host.height;
+				
+			}
+				
+				// if the height is fixed and the width can change, then set up
+				// vertical scrolling (if the viewport supports it).
+			else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent())
+			{
+				viewport.needsVerticalScroller()();
+				
+				host.setWidth(viewportModel.contentWidth+viewport.scrollerWidth(), false);
+				viewportModel.viewportWidth = host.width;
+			}
+				
+				// Otherwise the viewport needs to display some scrollers (or other elements
+				// allowing the rest of the contentArea to be visible)
+			else {
+				
+				viewport.needsScrollers();
+			}
 		}
 		
-        private var _vScrollBarModel:ScrollBarModel;
-        private var _vScrollBar:ScrollBar;
-        
-        /**
-         *  The vertical ScrollBar, if it exists.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function get vScrollBar():ScrollBar
+		/**
+		 * @private
+		 */
+		private function resizeHandler(event:Event):void
 		{
-            if (!_vScrollBar)
-                _vScrollBar = createScrollBar();
-            return _vScrollBar;
+			var host:UIBase = UIBase(_strand);
+			trace("host is now "+host.width + " x " +host.height);
+			
+			viewportModel.viewportHeight = host.height;
+			viewportModel.viewportWidth = host.width;
+			
+			if (!host.isWidthSizedToContent()) viewportModel.contentWidth = host.width;
+			if (!host.isHeightSizedToContent()) viewportModel.contentHeight = host.height;
+			
+			changeHandler(event);
+			
+			viewport.updateSize();
 		}
 		
-        /**
-         *  The horizontal ScrollBar, if it exists.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function get hScrollBar():ScrollBar
+		/**
+		 * @private
+		 */
+		protected function checkActualParent(force:Boolean=false):Boolean
 		{
-			return null;
+			var host:UIBase = UIBase(_strand);
+			if (contentAreaNeeded() || force)
+			{
+				if (actualParent == null || actualParent == host)
+				{
+					actualParent = new ContainerContentArea();
+					actualParent.className = "ActualParent";
+					host.addElement(actualParent, false);
+					ContainerBase(host).setActualParent(actualParent);
+				}
+				return true;
+			}
+			else
+			{
+				actualParent = host;
+			}
+			return false;
+		}
+		
+		/**
+		 *  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 metrics:UIMetrics = getMetrics();
+			
+			return (!isNaN(metrics.left) && metrics.left > 0 ||
+				!isNaN(metrics.top) && metrics.top > 0);
+		}
+		
+		/**
+		 * Returns the metrics (border, padding) of the strand.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function getMetrics():UIMetrics
+		{
+			return BeadMetrics.getMetrics(_strand);
+		}
+		
+		/**
+		 *  The parent of the children.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get contentView():IParentIUIBase
+		{
+			return actualParent;
 		}
-
-        /**
-         * @private
-         */
-        private function createScrollBar():ScrollBar
-        {
-            var vsb:ScrollBar;
-            vsb = new ScrollBar();
-            vsb.model = _vScrollBarModel;
-			// pin to right side by default
-			vsb.x = IUIBase(_strand).width - 16;
-			vsb.y = 0;
-			vsb.setWidthAndHeight(16, IUIBase(_strand).height, true);
-            IParent(_strand).addElement(vsb, false);
-            return vsb;
-        }
-
-        /**
-         *  The position of the vertical scrollbar
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function get verticalScrollPosition():Number
-        {
-            return _vScrollBarModel.value;
-        }
-        
-        /**
-         *  @private
-         */
-        public function set verticalScrollPosition(value:Number):void
-        {
-            _vScrollBarModel.value = value;
-        }
-
-        /**
-         *  The maximum position of the vertical scrollbar
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function get maxVerticalScrollPosition():Number
-        {
-            return _vScrollBarModel.maximum - 
-                _vScrollBarModel.pageSize;
-        }
 		
 		/**
-		 *  Sets up the border and background beads if necessary
+		 *  The host component, which can resize to different slots.
 		 *  
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
+		public function get resizableView():IUIBase
+		{
+			return _strand as IUIBase;
+		}
+		
 		protected function displayBackgroundAndBorder(host:UIBase) : void
 		{
 			var backgroundColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
@@ -331,7 +364,10 @@ package org.apache.flex.html.beads
 			if (backgroundColor != null || backgroundImage != null)
 			{
 				if (host.getBeadByType(IBackgroundBead) == null)
-					host.addBead(new (ValuesManager.valuesImpl.getValue(host, "iBackgroundBead")) as IBead);					
+					var c:Class = ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
+				    if (c) {
+						host.addBead( new c() as IBead );
+					}
 			}
 			
 			var borderStyle:String;
@@ -346,10 +382,60 @@ package org.apache.flex.html.beads
 			}
 			if (borderStyle != null && borderStyle != "none")
 			{
-				if (host.getBeadByType(IBorderBead) == null)
-					host.addBead(new (ValuesManager.valuesImpl.getValue(host, "iBorderBead")) as IBead);	
+				if (host.getBeadByType(IBorderBead) == null) {
+					c = ValuesManager.valuesImpl.getValue(host, "iBorderBead");
+					if (c) {
+						host.addBead( new c() as IBead );
+					}
+				}
 			}
 		}
-    
-    }
-}
+		
+        private var inGetViewHeight:Boolean;
+        
+		/**
+		 *  @copy org.apache.flex.core.IBeadView#viewHeight
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		override public function get viewHeight():Number
+		{
+            if (inGetViewHeight)
+            {
+                //trace("ContainerView: no height set for " + host);
+                return host["$height"];
+            }
+            inGetViewHeight = true;
+			var vh:Number = contentView.height;
+            inGetViewHeight = false;
+            return vh;
+		}
+		
+        private var inGetViewWidth:Boolean;
+        
+		/**
+		 *  @copy org.apache.flex.core.IBeadView#viewWidth
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		override public function get viewWidth():Number
+		{
+            if (inGetViewWidth)
+            {
+                //trace("ContainerView: no width set for " + host);
+				var metrics:UIMetrics = getMetrics();
+                return host["$width"] + metrics.left + metrics.right;
+            }
+            inGetViewWidth = true;
+			var vw:Number = contentView.width;
+            inGetViewWidth = false;
+			return vw;
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalLayout.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalLayout.as
index 9be7be0..2f02262 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalLayout.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalLayout.as
@@ -19,11 +19,14 @@
 package org.apache.flex.html.beads.layouts
 {
 	import org.apache.flex.core.IBeadLayout;
+	import org.apache.flex.core.IBeadModel;
 	import org.apache.flex.core.ILayoutChild;
 	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IParentIUIBase;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IViewport;
+	import org.apache.flex.core.IViewportModel;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
@@ -71,6 +74,25 @@ package org.apache.flex.html.beads.layouts
 		{
 			host = value as ILayoutChild;
 		}
+		
+		private var _viewportModel:IViewportModel;
+		
+		/**
+		 *  The data that describes the viewport used by this layout.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get viewportModel():IViewportModel
+		{
+			return _viewportModel;
+		}
+		public function set viewportModel(value:IViewportModel):void
+		{
+			_viewportModel = value;
+		}
 	
         /**
          * @copy org.apache.flex.core.IBeadLayout#layout
@@ -81,6 +103,10 @@ package org.apache.flex.html.beads.layouts
 			var layoutParent:ILayoutParent = host.getBeadByType(ILayoutParent) as ILayoutParent;
 			var contentView:IParentIUIBase = layoutParent.contentView;
 			
+			// this layout will use and modify the IViewportMode
+			var viewport:IViewport = host.getBeadByType(IViewport) as IViewport;
+			viewportModel = viewport.model;
+			
 			var n:int = contentView.numElements;
             var hostSizedToContent:Boolean = host.isHeightSizedToContent();
             var ilc:ILayoutChild;
@@ -232,7 +258,24 @@ package org.apache.flex.html.beads.layouts
     					child.y = obj.marginTop;
     			}
             }
-            return true;
+			
+			// Only return true if the contentView needs to be larger; that new
+			// size is stored in the model.
+			var sizeChanged:Boolean = false;
+			if (viewportModel != null) {
+				if (viewportModel.contentHeight < maxHeight) {
+					viewportModel.contentHeight = maxHeight;
+					sizeChanged = true;
+				}
+				if (viewportModel.contentWidth < xx) {
+					viewportModel.contentWidth = xx;
+					sizeChanged = true;
+				}
+			}
+			
+			host.dispatchEvent( new Event("layoutComplete") );
+			
+			return sizeChanged;
 		}
         
         private function setPositionAndHeight(child:IUIBase, top:Number, mt:Number,

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f62f49c7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalScrollingLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalScrollingLayout.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalScrollingLayout.as
deleted file mode 100644
index 066d5f1..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/HorizontalScrollingLayout.as
+++ /dev/null
@@ -1,142 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads.layouts
-{
-	import org.apache.flex.core.IBeadLayout;
-	import org.apache.flex.core.IBorderModel;
-    import org.apache.flex.core.IParentIUIBase;
-	import org.apache.flex.core.IScrollingLayoutParent;
-    import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.IUIBase;
-	import org.apache.flex.events.Event;
-	import org.apache.flex.events.IEventDispatcher;
-	import org.apache.flex.html.supportClasses.Border;
-	import org.apache.flex.html.supportClasses.ScrollBar;
-	
-    /**
-     *  The HorizontalScrollingLayout class is a layout
-     *  bead that displays a set of children horizontally in one row, 
-     *  separating them according to CSS layout rules for margin and 
-     *  vertical-align styles and lays out a horizontal ScrollBar
-     *  below the children.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion FlexJS 0.0
-     */
-	public class HorizontalScrollingLayout implements IBeadLayout
-	{
-        /**
-         *  Constructor.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function HorizontalScrollingLayout()
-		{
-		}
-		
-		private var hScrollBar:ScrollBar;
-		
-		private var _strand:IStrand;
-		
-        /**
-         *  @copy org.apache.flex.core.IBead#strand
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-		}
-		
-        /**
-         *  @copy org.apache.flex.core.IBeadLayout#layout
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function layout():Boolean
-		{            
-			var layoutParent:IScrollingLayoutParent = 
-                        _strand.getBeadByType(IScrollingLayoutParent) as IScrollingLayoutParent;
-			var contentView:IParentIUIBase = layoutParent.contentView;
-			var border:Border = layoutParent.border;
-			var borderModel:IBorderModel = border.model as IBorderModel;
-			
-			var ww:Number = layoutParent.resizableView.width;
-			var hh:Number = layoutParent.resizableView.height;
-			border.width = ww;
-			border.height = hh;
-			
-			contentView.width = ww - borderModel.offsets.left - borderModel.offsets.right;
-			contentView.height = hh - borderModel.offsets.top - borderModel.offsets.bottom;
-			contentView.x = borderModel.offsets.left;
-			contentView.y = borderModel.offsets.top;
-			
-			var n:int = contentView.numElements;
-			var xx:Number = 0;
-			for (var i:int = 0; i < n; i++)
-			{
-				var ir:IUIBase = contentView.getElementAt(i) as IUIBase;
-				if (ir == null || !ir.visible) continue;
-				ir.x = xx;
-				ir.height = contentView.height;
-				xx += ir.width;			
-			}
-			/*
-			if (xx > dataGroup.width)
-			{
-				hScrollBar = listView.hScrollBar;
-				dataGroup.height -= hScrollBar.height;
-				IScrollBarModel(hScrollBar.model).maximum = xx;
-				IScrollBarModel(hScrollBar.model).pageSize = dataGroup.width;
-				IScrollBarModel(hScrollBar.model).pageStepSize = dataGroup.width;
-				hScrollBar.visible = true;
-				hScrollBar.width = dataGroup.width;
-				hScrollBar.x = dataGroup.x;
-				hScrollBar.y = dataGroup.height;
-				var xpos:Number = IScrollBarModel(hScrollBar.model).value;
-				dataGroup.scrollRect = new Rectangle(xpos, 0, xpos + dataGroup.width, dataGroup.height);
-				hScrollBar.addEventListener("scroll", scrollHandler);
-			}
-			else if (hScrollBar)
-			{
-				dataGroup.scrollRect = null;
-				hScrollBar.visible = false;
-			}
-			*/
-            return true;
-		}
-		
-		/*private function scrollHandler(event:Event):void
-		{
-			var xpos:Number = IScrollBarModel(hScrollBar.model).value;
-			dataGroup.scrollRect = new Rectangle(xpos, 0, xpos + dataGroup.width, dataGroup.height);
-		}*/
-	}
-}


Mime
View raw message