flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [16/50] [abbrv] git commit: [flex-asjs] [refs/heads/dual] - More layout updates.
Date Tue, 18 Apr 2017 06:17:40 GMT
More layout updates.


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

Branch: refs/heads/dual
Commit: 2b8464900d3a2772646ee2538e3cc3894347f120
Parents: 09a2c06
Author: Peter Ent <pent@apache.org>
Authored: Tue Apr 4 13:25:46 2017 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Tue Apr 4 13:25:46 2017 -0400

----------------------------------------------------------------------
 .../flex/html/beads/layouts/ButtonBarLayout.as  | 43 ++++++++------------
 .../ButtonBarButtonItemRenderer.as              | 18 ++++++++
 .../DataGridButtonBarButtonItemRenderer.as      |  1 -
 3 files changed, 36 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b846490/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
index 75d1ee7..0d3668d 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
@@ -31,6 +31,7 @@ package org.apache.flex.html.beads.layouts
 	import org.apache.flex.core.IViewportModel;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
+	import org.apache.flex.core.SimpleCSSStyles;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.html.List;
@@ -48,7 +49,7 @@ package org.apache.flex.html.beads.layouts
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
 	 */
-	public class ButtonBarLayout extends LayoutBase implements IBeadLayout
+	public class ButtonBarLayout extends HorizontalFlexLayout implements IBeadLayout
 	{
 		/**
 		 *  constructor.
@@ -98,31 +99,13 @@ package org.apache.flex.html.beads.layouts
 			}
 
 			var n:int = contentView.numElements;
-			var realN:int = n;
-
-			COMPILE::JS {
-				contentView.element.style["display"] = "flex";
-				contentView.element.style["flex-flow"] = "row";
-			}
-
-			for (var j:int=0; j < n; j++)
-			{
-				var child:IUIBase = contentView.getElementAt(j) as IUIBase;
-				if (child == null || !child.visible) realN--;
-			}
-
-			var xpos:Number = 0;
-			var useWidth:Number = contentView.width / realN;
-			var useHeight:Number = contentView.height;
 
 			for (var i:int=0; i < n; i++)
 			{
 				var ir:ISelectableItemRenderer = contentView.getElementAt(i) as ISelectableItemRenderer;
 				if (ir == null || !UIBase(ir).visible) continue;
+				
 				COMPILE::SWF {
-					UIBase(ir).y = 0;
-					UIBase(ir).x = xpos;
-
 					if (buttonWidths) {
 						var widthValue:* = buttonWidths[i];
 
@@ -130,13 +113,21 @@ package org.apache.flex.html.beads.layouts
 							if (widthValue != null) UIBase(ir).width = Number(widthValue);
 						}
 						else if (_widthType == ButtonBarModel.PROPORTIONAL_WIDTHS) {
-							if (widthValue != null) UIBase(ir).width = useWidth; // - need to replicate this for
SWF side element.style["flex-grow"] = String(widthValue);
+							if (widthValue != null) {
+								if (UIBase(ir).style == null) {
+									UIBase(ir).style = new SimpleCSSStyles();
+								}
+								UIBase(ir).style.flexGrow = Number(widthValue);
+							}
 						}
 						else if (_widthType == ButtonBarModel.PERCENT_WIDTHS) {
 							if (widthValue != null) UIBase(ir).percentWidth = Number(widthValue);
 						}
 					} else {
-						UIBase(ir).width = useWidth;
+						if (UIBase(ir).style == null) {
+							UIBase(ir).style = new SimpleCSSStyles();
+						}
+						UIBase(ir).style.flexGrow = 1;
 					}
 				}
 
@@ -155,13 +146,15 @@ package org.apache.flex.html.beads.layouts
 							if (widthValue != null) UIBase(ir).percentWidth = Number(widthValue);
 						}
 					} else {
-						UIBase(ir).width = useWidth;
+						UIBase(ir).element.style["flex-grow"] = "1";
 					}
+					
+					UIBase(ir).height = contentView.height;
 				}
-				xpos += UIBase(ir).width;
 			}
 
-            return true;
+			// now let the horizontal layout take care of things.
+			return super.layout();
 		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b846490/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
index 0ff21d2..214125e 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
@@ -92,6 +92,24 @@ package org.apache.flex.html.supportClasses
 		}
 		
 		/**
+		 * @private
+		 */
+		override public function setWidth(value:Number, noEvent:Boolean = false):void
+		{
+			super.setWidth(value, noEvent);
+			textButton.width = value;
+		}
+		
+		/**
+		 * @private
+		 */
+		override public function setHeight(value:Number, noEvent:Boolean = false):void
+		{
+			super.setHeight(value, noEvent);
+			textButton.height = value;
+		}
+		
+		/**
 		 *  The data to be displayed by the itemRenderer instance. For ButtonBarItemRenderer, the
 		 *  data's string version is used as the label for the Button.
 		 *

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b846490/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
index 645a393..d05036f 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
@@ -67,7 +67,6 @@ package org.apache.flex.html.supportClasses
 			if (textButton == null) {
 				textButton = new DataGridButtonBarTextButton();
 				textButton.percentWidth = 100;
-				textButton.percentHeight = 100;
 				
 				// listen for clicks on the button and translate them into
 				// an itemClicked event.


Mime
View raw message