flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [49/50] git commit: [flex-asjs] [refs/heads/develop] - hack ButtonBar into compiling cleanly. Probably needs revisiting
Date Thu, 25 Sep 2014 16:04:31 GMT
hack ButtonBar into compiling cleanly.  Probably needs revisiting


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

Branch: refs/heads/develop
Commit: 00402c8a15875a7d1004fe1936be2addf685f32c
Parents: 133214f
Author: Alex Harui <aharui@apache.org>
Authored: Thu Sep 25 08:36:27 2014 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Sep 25 08:36:27 2014 -0700

----------------------------------------------------------------------
 .../flex/html/beads/layouts/ButtonBarLayout.as  | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/00402c8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
index 69fd35b..f871baa 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
@@ -19,14 +19,15 @@
 package org.apache.flex.html.beads.layouts
 {	
 	import org.apache.flex.core.IBeadLayout;
-	import org.apache.flex.core.IItemRenderer;
 	import org.apache.flex.core.IItemRendererClassFactory;
 	import org.apache.flex.core.IItemRendererParent;
 	import org.apache.flex.core.ILayoutParent;
 	import org.apache.flex.core.ISelectionModel;
+    import org.apache.flex.core.ISelectableItemRenderer;
 	import org.apache.flex.core.IStrand;
     import org.apache.flex.core.IParent;
     import org.apache.flex.core.IUIBase;
+    import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
@@ -102,19 +103,26 @@ package org.apache.flex.html.beads.layouts
 		 */
 		private function changeHandler(event:Event):void
 		{
-			var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
-			var contentView:IParent = layoutParent.contentView;
-			
-			var n:int = contentView.numElements;
+            var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
+            var contentView:IParent = layoutParent.contentView;
+            
+            var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as
ISelectionModel;
+            var dp:Array = selectionModel.dataProvider as Array;
+            if (!dp)
+                return;
+            
+            var itemRendererFactory:IItemRendererClassFactory = _strand.getBeadByType(IItemRendererClassFactory)
as IItemRendererClassFactory;
+            
+			var n:int = dp.length;
 			var xpos:Number = 0;
 			var useWidth:Number = IUIBase(_strand).width / n;
 			var useHeight:Number = IUIBase(_strand).height;
 			
 			for (var i:int = 0; i < n; i++)
 			{
-				var ir:IItemRenderer = IItemRendererParent(contentView).getItemRendererForIndex(i);
+				var ir:ISelectableItemRenderer = IItemRendererParent(contentView).getItemRendererForIndex(i)
as ISelectableItemRenderer;
 				if (ir == null) {
-					ir = itemRendererFactory.createItemRenderer(contentView as IItemRendererParent) as IItemRenderer;
+					ir = itemRendererFactory.createItemRenderer(contentView as IItemRendererParent) as ISelectableItemRenderer;
 				}
 				ir.index = i;
 				ir.labelField = (_strand as List).labelField;


Mime
View raw message