flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Created ILayoutParent interface to be implemented by those beads that can support layouts. Modified existing beads to implement ILayoutParent as needed. Modified and created layouts to use ILayoutParent to o
Date Wed, 18 Sep 2013 19:27:02 GMT
Updated Branches:
  refs/heads/develop 3d95631fa -> 03ec92ada


Created ILayoutParent interface to be implemented by those beads that can support layouts.
Modified existing beads to implement ILayoutParent as needed. Modified and created layouts
to use ILayoutParent to obtain the objects to lay out.


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

Branch: refs/heads/develop
Commit: 03ec92ada7434c2ea2bdc65f8f6dabd1b946f2df
Parents: 3d95631
Author: Peter Ent <pent@apache.org>
Authored: Wed Sep 18 15:26:47 2013 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Wed Sep 18 15:26:47 2013 -0400

----------------------------------------------------------------------
 frameworks/as/basic-manifest.xml                |   2 +
 frameworks/as/defaults.css                      |  19 ++++
 frameworks/as/src/FlexJSUIClasses.as            |   5 +-
 .../src/org/apache/flex/core/ILayoutParent.as   |  38 +++++++
 .../flex/html/staticControls/ButtonBar.as       |  28 +++++
 .../html/staticControls/beads/ContainerView.as  |  31 +++++-
 .../flex/html/staticControls/beads/ListView.as  |  27 ++++-
 .../staticControls/beads/NumericStepperView.as  |  33 +++++-
 .../beads/layouts/NonVirtualHorizontalLayout.as |  62 ++++++-----
 .../NonVirtualHorizontalScrollingLayout.as      | 110 +++++++++++++++++++
 .../beads/layouts/NonVirtualVerticalLayout.as   |  15 ++-
 .../NonVirtualVerticalScrollingLayout.as        |  68 ++++++------
 .../ButtonBarButtonItemRenderer.as              |  76 +++++++++++++
 13 files changed, 437 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/basic-manifest.xml b/frameworks/as/basic-manifest.xml
index 14c2c96..2fe364b 100644
--- a/frameworks/as/basic-manifest.xml
+++ b/frameworks/as/basic-manifest.xml
@@ -28,6 +28,7 @@
     <component id="ConstantBinding" class="org.apache.flex.binding.ConstantBinding"/>
     <component id="SimpleBinding" class="org.apache.flex.binding.SimpleBinding"/>
     <component id="Button" class="org.apache.flex.html.staticControls.Button"/>
+    <component id="ButtonBar" class="org.apache.flex.html.staticControls.ButtonBar"/>
     <component id="DropDownList" class="org.apache.flex.html.staticControls.DropDownList"/>
     <component id="DropDownListList" class="org.apache.flex.html.staticControls.supportClasses.DropDownListList"/>
     <component id="Image" class="org.apache.flex.html.staticControls.Image"/>
@@ -62,6 +63,7 @@
     <component id="TextFieldItemRenderer" class="org.apache.flex.html.staticControls.supportClasses.TextFieldItemRenderer"/>
     <component id="StringItemRenderer" class="org.apache.flex.html.staticControls.supportClasses.StringItemRenderer"/>
     <component id="DataItemRenderer" class="org.apache.flex.html.staticControls.supportClasses.DataItemRenderer"/>
+    <component id="ButtonBarButtonItemRenderer" class="org.apache.flex.html.staticControls.supportClasses.ButtonBarButtonItemRenderer"/>
     <component id="ScrollBar" class="org.apache.flex.html.staticControls.supportClasses.ScrollBar"/>
     <component id="NumericOnlyTextInputBead" class="org.apache.flex.html.staticControls.accessories.NumericOnlyTextInputBead"
/>
     <component id="PasswordInputBead" class="org.apache.flex.html.staticControls.accessories.PasswordInputBead"
/>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/as/defaults.css b/frameworks/as/defaults.css
index cdf7584..f01484d 100644
--- a/frameworks/as/defaults.css
+++ b/frameworks/as/defaults.css
@@ -73,6 +73,25 @@ Alert
     border-thickness: 1;
 }
 
+ButtonBar
+{
+    IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.ArraySelectionModel");
+    IBeadView:  ClassReference("org.apache.flex.html.staticControls.beads.ListView");			
+    IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.ListSingleSelectionMouseController");
+    IBeadLayout: ClassReference("org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizontalLayout");
+    IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForArrayData");
+    IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+    IItemRenderer: ClassReference("org.apache.flex.html.staticControls.supportClasses.ButtonBarButtonItemRenderer");
+
+    border-style: none;
+}
+
+ButtonBarButtonItemRenderer
+{
+    width: 80;
+    height: 30;
+}
+
 CheckBox
 {
     IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.ToggleButtonModel");

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/FlexJSUIClasses.as b/frameworks/as/src/FlexJSUIClasses.as
index 8b1b205..9b94af9 100644
--- a/frameworks/as/src/FlexJSUIClasses.as
+++ b/frameworks/as/src/FlexJSUIClasses.as
@@ -74,8 +74,9 @@ internal class FlexJSUIClasses
 	import org.apache.flex.html.staticControls.beads.controllers.SliderMouseController; SliderMouseController;
 	import org.apache.flex.html.staticControls.beads.controllers.SpinnerMouseController; SpinnerMouseController;
     import org.apache.flex.html.staticControls.beads.controllers.VScrollBarMouseController;
VScrollBarMouseController;
-    import org.apache.flex.html.staticControls.beads.layouts.NonVirtualVerticalScrollingLayout;
NonVirtualVerticalScrollingLayout;    
-    import org.apache.flex.html.staticControls.beads.layouts.VScrollBarLayout; VScrollBarLayout;
   
+    import org.apache.flex.html.staticControls.beads.layouts.NonVirtualVerticalScrollingLayout;
NonVirtualVerticalScrollingLayout;  
+	import org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizontalScrollingLayout;
NonVirtualHorizontalScrollingLayout;
+    import org.apache.flex.html.staticControls.beads.layouts.VScrollBarLayout; VScrollBarLayout;
     import org.apache.flex.html.staticControls.beads.TextItemRendererFactoryForArrayData;
TextItemRendererFactoryForArrayData;
 	import org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForArrayData; DataItemRendererFactoryForArrayData;
     import org.apache.flex.core.ItemRendererClassFactory; ItemRendererClassFactory;    

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/core/ILayoutParent.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/core/ILayoutParent.as b/frameworks/as/src/org/apache/flex/core/ILayoutParent.as
new file mode 100644
index 0000000..3604b37
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/core/ILayoutParent.as
@@ -0,0 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+	import flash.display.DisplayObject;
+	import flash.display.DisplayObjectContainer;
+	
+	import org.apache.flex.html.staticControls.supportClasses.Border;
+	import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
+
+	public interface ILayoutParent
+	{
+		function get contentView():DisplayObjectContainer;
+		
+		function get border():Border;
+		
+		function get vScrollBar():ScrollBar;
+		function get hScrollBar():ScrollBar;
+		
+		function get resizableView():DisplayObject;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/ButtonBar.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/ButtonBar.as b/frameworks/as/src/org/apache/flex/html/staticControls/ButtonBar.as
new file mode 100644
index 0000000..ee7c0e3
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/ButtonBar.as
@@ -0,0 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.staticControls
+{
+	public class ButtonBar extends List
+	{
+		public function ButtonBar()
+		{
+			super();
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
index 950baaa..c0eb0b7 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
@@ -18,18 +18,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.staticControls.beads
 {
+	import flash.display.DisplayObject;
 	import flash.display.DisplayObjectContainer;
 	import flash.display.Sprite;
 	
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IBeadView;
+	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.html.staticControls.Container;
 	import org.apache.flex.html.staticControls.ContainerContentArea;
+	import org.apache.flex.html.staticControls.supportClasses.Border;
+	import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
 	
-	public class ContainerView implements IBeadView
+	public class ContainerView implements IBeadView, ILayoutParent
 	{
 		public function ContainerView()
 		{
@@ -111,5 +115,30 @@ package org.apache.flex.html.staticControls.beads
 			}
 		}
 		
+		public function get contentView():DisplayObjectContainer
+		{
+			return actualParent;
+		}
+		
+		public function get border():Border
+		{
+			return null;
+		}
+		
+		public function get resizableView():DisplayObject
+		{
+			return _strand as DisplayObject;
+		}
+		
+		public function get vScrollBar():ScrollBar
+		{
+			return null;
+		}
+		
+		public function get hScrollBar():ScrollBar
+		{
+			return null;
+		}
+		
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/beads/ListView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ListView.as b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ListView.as
index 559435e..dbe9e36 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ListView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ListView.as
@@ -18,14 +18,18 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.staticControls.beads
 {	
+	import flash.display.DisplayObject;
+	import flash.display.DisplayObjectContainer;
+	
+	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IBeadView;
-    import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IItemRenderer;
 	import org.apache.flex.core.IItemRendererParent;
+	import org.apache.flex.core.ILayoutParent;
+	import org.apache.flex.core.IParent;
 	import org.apache.flex.core.ISelectionModel;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.Strand;
-	import org.apache.flex.core.IParent;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.html.staticControls.beads.models.ScrollBarModel;
@@ -34,7 +38,7 @@ package org.apache.flex.html.staticControls.beads
 	import org.apache.flex.html.staticControls.supportClasses.NonVirtualDataGroup;
 	import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
 
-	public class ListView extends Strand implements IBeadView, IStrand, IListView
+	public class ListView extends Strand implements IBeadView, IStrand, IListView, ILayoutParent
 	{
 		public function ListView()
 		{
@@ -64,6 +68,21 @@ package org.apache.flex.html.staticControls.beads
                 _vScrollBar = createScrollBar();
 			return _vScrollBar;
 		}
+		
+		public function get hScrollBar():ScrollBar
+		{
+			return null;
+		}
+		
+		public function get contentView():DisplayObjectContainer
+		{
+			return _dataGroup as DisplayObjectContainer;
+		}
+		
+		public function get resizableView():DisplayObject
+		{
+			return _strand as DisplayObject;
+		}
 
 		private var _strand:IStrand;
 		
@@ -89,7 +108,7 @@ package org.apache.flex.html.staticControls.beads
             if (getBeadByType(IBeadLayout) == null)
             {
                 var mapper:IBeadLayout = new (ValuesManager.valuesImpl.getValue(_strand,
"iBeadLayout")) as IBeadLayout;
-                addBead(mapper);
+				strand.addBead(mapper);
             }            
 		}
 		

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
index a07dae0..27308ef 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
@@ -18,7 +18,11 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.staticControls.beads
 {
+	import flash.display.DisplayObject;
+	import flash.display.DisplayObjectContainer;
+	
 	import org.apache.flex.core.IBeadView;
+	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IParent;
 	import org.apache.flex.core.IRangeModel;
 	import org.apache.flex.core.IStrand;
@@ -29,8 +33,10 @@ package org.apache.flex.html.staticControls.beads
 	import org.apache.flex.html.staticControls.Spinner;
 	import org.apache.flex.html.staticControls.TextInput;
 	import org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizontalLayout;
+	import org.apache.flex.html.staticControls.supportClasses.Border;
+	import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
 	
-	public class NumericStepperView implements IBeadView
+	public class NumericStepperView implements IBeadView, ILayoutParent
 	{
 		public function NumericStepperView()
 		{
@@ -122,5 +128,30 @@ package org.apache.flex.html.staticControls.beads
 			var n:Number = IRangeModel(UIBase(_strand).model).value;
 			input.text = String(IRangeModel(UIBase(_strand).model).value);
 		}
+		
+		public function get contentView():DisplayObjectContainer
+		{
+			return _strand as DisplayObjectContainer;
+		}
+		
+		public function get border():Border
+		{
+			return null;
+		}
+		
+		public function get vScrollBar():ScrollBar
+		{
+			return null;
+		}
+		
+		public function get hScrollBar():ScrollBar
+		{
+			return null;
+		}
+		
+		public function get resizableView():DisplayObject
+		{
+			return _strand as DisplayObject;
+		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalLayout.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalLayout.as
index ecc9d02..1b793e1 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalLayout.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalLayout.as
@@ -19,13 +19,14 @@
 package org.apache.flex.html.staticControls.beads.layouts
 {
 	import flash.display.DisplayObject;
+	import flash.display.DisplayObjectContainer;
 	
 	import org.apache.flex.core.IBeadLayout;
+	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
-	import org.apache.flex.html.staticControls.Container;
 
 	public class NonVirtualHorizontalLayout implements IBeadLayout
 	{
@@ -40,23 +41,26 @@ package org.apache.flex.html.staticControls.beads.layouts
 			_strand = value;
 			IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
 			IEventDispatcher(value).addEventListener("childrenAdded", changeHandler);
+			IEventDispatcher(value).addEventListener("itemsCreated", changeHandler);
 		}
 	
 		private function changeHandler(event:Event):void
 		{
-			var children:Array = 
-					Container(_strand).getChildren();
-			var n:int = children.length;
+			var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
+			var contentView:DisplayObjectContainer = layoutParent.contentView;
+			
+			var n:int = contentView.numChildren;
 			var marginLeft:Object;
 			var marginRight:Object;
 			var marginTop:Object;
 			var marginBottom:Object;
 			var margin:Object;
 			var maxHeight:Number = 0;
-            var verticalMargins:Array = [];
+			var verticalMargins:Array = [];
+			
 			for (var i:int = 0; i < n; i++)
 			{
-				var child:DisplayObject = children[i];
+				var child:DisplayObject = contentView.getChildAt(i);
 				margin = ValuesManager.valuesImpl.getValue(child, "margin");
 				if (margin is Array)
 				{
@@ -97,14 +101,14 @@ package org.apache.flex.html.staticControls.beads.layouts
 				mb = Number(marginBottom);
 				if (isNaN(mb))
 					mb = 0;
-                if (marginLeft == "auto")
-                    ml = 0;
-                else
-                {
-                    ml = Number(marginLeft);
-                    if (isNaN(ml))
-                        ml = 0;
-                }
+				if (marginLeft == "auto")
+					ml = 0;
+				else
+				{
+					ml = Number(marginLeft);
+					if (isNaN(ml))
+						ml = 0;
+				}
 				if (marginRight == "auto")
 					mr = 0;
 				else
@@ -115,26 +119,26 @@ package org.apache.flex.html.staticControls.beads.layouts
 				}
 				child.y = mt;
 				maxHeight = Math.max(maxHeight, ml + child.height + mr);
-                var xx:Number;
-                if (i == 0)
-                    child.x = ml;
-                else
-                    child.x = xx + ml + lastmr;
-                xx = child.x + child.width;
-                lastmr = mr;
-                var valign:Object = ValuesManager.valuesImpl.getValue(child, "vertical-align");
-                verticalMargins.push({ marginTop: marginTop, marginBottom: marginBottom,
valign: valign });
+				var xx:Number;
+				if (i == 0)
+					child.x = ml;
+				else
+					child.x = xx + ml + lastmr;
+				xx = child.x + child.width;
+				lastmr = mr;
+				var valign:Object = ValuesManager.valuesImpl.getValue(child, "vertical-align");
+				verticalMargins.push({ marginTop: marginTop, marginBottom: marginBottom, valign: valign
});
 			}
 			for (i = 0; i < n; i++)
 			{
-                var obj:Object = verticalMargins[0]
-				child = children[i];
+				var obj:Object = verticalMargins[0]
+				child = contentView.getChildAt(i);
 				if (obj.valign == "middle")
 					child.y = maxHeight - child.height / 2;
-                else if (valign == "bottom")
-                    child.y = maxHeight - child.height - obj.marginBottom;
-                else
-                    child.y = obj.marginTop;
+				else if (valign == "bottom")
+					child.y = maxHeight - child.height - obj.marginBottom;
+				else
+					child.y = obj.marginTop;
 			}
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalScrollingLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalScrollingLayout.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalScrollingLayout.as
new file mode 100644
index 0000000..00dcfc1
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualHorizontalScrollingLayout.as
@@ -0,0 +1,110 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.staticControls.beads.layouts
+{
+	import flash.display.DisplayObject;
+	import flash.display.DisplayObjectContainer;
+	import flash.geom.Rectangle;
+	
+	import org.apache.flex.core.IBeadLayout;
+	import org.apache.flex.core.IBorderModel;
+	import org.apache.flex.core.ILayoutParent;
+	import org.apache.flex.core.IScrollBarModel;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.html.staticControls.supportClasses.Border;
+	import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
+	
+	public class NonVirtualHorizontalScrollingLayout implements IBeadLayout
+	{
+		public function NonVirtualHorizontalScrollingLayout()
+		{
+		}
+		
+		private var hScrollBar:ScrollBar;
+		
+		private var _strand:IStrand;
+		
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
+			IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+			IEventDispatcher(value).addEventListener("itemsCreated", changeHandler);
+		}
+		
+		private function changeHandler(event:Event):void
+		{            
+			var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
+			var contentView:DisplayObjectContainer = 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.numChildren;
+			var xx:Number = 0;
+			for (var i:int = 0; i < n; i++)
+			{
+				var ir:DisplayObject = contentView.getChildAt(i);
+				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;
+			}
+			*/
+		}
+		
+		/*private function scrollHandler(event:Event):void
+		{
+			var xpos:Number = IScrollBarModel(hScrollBar.model).value;
+			dataGroup.scrollRect = new Rectangle(xpos, 0, xpos + dataGroup.width, dataGroup.height);
+		}*/
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
index 06783fa..04a3b5e 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalLayout.as
@@ -19,13 +19,14 @@
 package org.apache.flex.html.staticControls.beads.layouts
 {
 	import flash.display.DisplayObject;
+	import flash.display.DisplayObjectContainer;
 	
 	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
-	import org.apache.flex.html.staticControls.Container;
 
 	public class NonVirtualVerticalLayout implements IBead
 	{
@@ -40,13 +41,15 @@ package org.apache.flex.html.staticControls.beads.layouts
 			_strand = value;
 			IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
 			IEventDispatcher(value).addEventListener("childrenAdded", changeHandler);
+			IEventDispatcher(value).addEventListener("itemsCreated", changeHandler);
 		}
 	
 		private function changeHandler(event:Event):void
 		{
-			var children:Array = 
-					Container(_strand).getChildren();
-			var n:int = children.length;
+			var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
+			var contentView:DisplayObjectContainer = layoutParent.contentView;
+			
+			var n:int = contentView.numChildren;
 			var hasHorizontalFlex:Boolean;
 			var flexibleHorizontalMargins:Array = [];
 			var marginLeft:Object;
@@ -57,7 +60,7 @@ package org.apache.flex.html.staticControls.beads.layouts
 			var maxWidth:Number = 0;
 			for (var i:int = 0; i < n; i++)
 			{
-				var child:DisplayObject = children[i];
+				var child:DisplayObject = contentView.getChildAt(i);
 				margin = ValuesManager.valuesImpl.getValue(child, "margin");
 				if (margin is Array)
 				{
@@ -147,7 +150,7 @@ package org.apache.flex.html.staticControls.beads.layouts
 			{
 				for (i = 0; i < n; i++)
 				{
-					child = children[i];
+					child = contentView.getChildAt(i);
 					var obj:Object = flexibleHorizontalMargins[i];
 					if (obj.marginLeft == "auto" && obj.marginRight == "auto")
 						child.x = maxWidth - child.width / 2;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalScrollingLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalScrollingLayout.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalScrollingLayout.as
index c50c081..0bc9dfd 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalScrollingLayout.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/NonVirtualVerticalScrollingLayout.as
@@ -24,11 +24,11 @@ package org.apache.flex.html.staticControls.beads.layouts
 	
 	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IBorderModel;
+	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.IScrollBarModel;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
-	import org.apache.flex.html.staticControls.beads.IListView;
 	import org.apache.flex.html.staticControls.supportClasses.Border;
 	import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
 
@@ -37,75 +37,75 @@ package org.apache.flex.html.staticControls.beads.layouts
 		public function NonVirtualVerticalScrollingLayout()
 		{
 		}
-		
-		public var dataGroup:DisplayObjectContainer;
         
-        private var border:Border;		
-        private var borderModel:IBorderModel
-        private var vScrollBar:ScrollBar;		
-		private var listView:IListView;
+        private var vScrollBar:ScrollBar;	
 
 		private var _strand:IStrand;
 		
 		public function set strand(value:IStrand):void
 		{
 			_strand = value;
-			listView = value as IListView;
-			dataGroup = listView.dataGroup as DisplayObjectContainer;
-            border = listView.border;
-            borderModel = border.model as IBorderModel;
-			IEventDispatcher(listView.strand).addEventListener("heightChanged", changeHandler);
-			IEventDispatcher(listView.strand).addEventListener("widthChanged", changeHandler);
-			IEventDispatcher(listView.strand).addEventListener("itemsCreated", changeHandler);
+			
+			IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
+			IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+			IEventDispatcher(value).addEventListener("itemsCreated", changeHandler);
 		}
 	
 		private function changeHandler(event:Event):void
 		{            
-            var ww:Number = DisplayObject(listView.strand).width;
-            var hh:Number = DisplayObject(listView.strand).height;
+			var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
+			var contentView:DisplayObjectContainer = layoutParent.contentView;
+			var border:Border = layoutParent.border;
+			var borderModel:IBorderModel = border.model as IBorderModel;
+			
+            var ww:Number = DisplayObject(layoutParent.resizableView).width;
+            var hh:Number = DisplayObject(layoutParent.resizableView).height;
             border.width = ww;
             border.height = hh;
            
-			dataGroup.width = ww - borderModel.offsets.left - borderModel.offsets.right;
-			dataGroup.height = hh - borderModel.offsets.top - borderModel.offsets.bottom;
-            dataGroup.x = borderModel.offsets.left;
-            dataGroup.y = borderModel.offsets.top;
+			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 = dataGroup.numChildren;
+			var n:int = contentView.numChildren;
 			var yy:Number = 0;
 			for (var i:int = 0; i < n; i++)
 			{
-				var ir:DisplayObject = dataGroup.getChildAt(i);
+				var ir:DisplayObject = contentView.getChildAt(i);
 				ir.y = yy;
-				ir.width = dataGroup.width;
+				ir.width = contentView.width;
 				yy += ir.height;			
 			}
-			if (yy > dataGroup.height)
+			if (yy > contentView.height)
 			{
-                vScrollBar = listView.vScrollBar;
-				dataGroup.width -= vScrollBar.width;
+                vScrollBar = layoutParent.vScrollBar;
+				contentView.width -= vScrollBar.width;
 				IScrollBarModel(vScrollBar.model).maximum = yy;
-				IScrollBarModel(vScrollBar.model).pageSize = dataGroup.height;
-				IScrollBarModel(vScrollBar.model).pageStepSize = dataGroup.height;
+				IScrollBarModel(vScrollBar.model).pageSize = contentView.height;
+				IScrollBarModel(vScrollBar.model).pageStepSize = contentView.height;
 				vScrollBar.visible = true;
-				vScrollBar.height = dataGroup.height;
-				vScrollBar.y = dataGroup.y;
-				vScrollBar.x = dataGroup.width;
+				vScrollBar.height = contentView.height;
+				vScrollBar.y = contentView.y;
+				vScrollBar.x = contentView.width;
                 var vpos:Number = IScrollBarModel(vScrollBar.model).value;
-                dataGroup.scrollRect = new Rectangle(0, vpos, dataGroup.width, vpos + dataGroup.height);
+				contentView.scrollRect = new Rectangle(0, vpos, contentView.width, vpos + contentView.height);
                 vScrollBar.addEventListener("scroll", scrollHandler);
 			}
 			else if (vScrollBar)
 			{
-				dataGroup.scrollRect = null;
+				contentView.scrollRect = null;
 				vScrollBar.visible = false;
 			}
 		}
 
         private function scrollHandler(event:Event):void
         {
+			var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
+			var contentView:DisplayObjectContainer = layoutParent.contentView;
+			
             var vpos:Number = IScrollBarModel(vScrollBar.model).value;
-            dataGroup.scrollRect = new Rectangle(0, vpos, dataGroup.width, vpos + dataGroup.height);
+			contentView.scrollRect = new Rectangle(0, vpos, contentView.width, vpos + contentView.height);
         }
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03ec92ad/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
b/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
new file mode 100644
index 0000000..13c4597
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
@@ -0,0 +1,76 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.staticControls.supportClasses
+{
+	import org.apache.flex.events.Event;
+	import org.apache.flex.html.staticControls.TextButton;
+
+	public class ButtonBarButtonItemRenderer extends UIItemRendererBase
+	{
+		public function ButtonBarButtonItemRenderer()
+		{
+			super();
+		}
+		
+		private var textButton:TextButton;
+		
+		override public function addedToParent():void
+		{
+			super.addedToParent();
+		}
+		
+		private function handleClickEvent(event:Event):void
+		{
+			trace("Click! on index "+this.index);
+			this.dispatchEvent(new Event("selected"));
+		}
+		
+		override public function set data(value:Object):void
+		{
+			super.data = value;
+			
+			var added:Boolean = false;
+			if (textButton == null) {
+				textButton = new TextButton();
+				textButton.addEventListener('click',handleClickEvent);
+				added = true;
+			}
+			
+			if (value is String) {
+				textButton.text = String(value);
+			}
+			else if (value.hasOwnProperty("label")) {
+				textButton.text = String(value["label"]);
+			}
+			else if (value.hasOwnProperty("title")) {
+				textButton.text = String(value["title"]);
+			}
+			
+			if (added) addElement(textButton);
+		}
+		
+		override public function adjustSize():void
+		{
+			textButton.width = this.width;
+			textButton.height = this.height;
+			
+			updateRenderer();
+		}
+	}
+}
\ No newline at end of file


Mime
View raw message