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] - Fixed DataGrid layout to size the button bar header buttons correctly.
Date Tue, 26 May 2015 20:02:21 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 055a4bb4e -> 9cb961f7c


Fixed DataGrid layout to size the button bar header buttons correctly.


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

Branch: refs/heads/develop
Commit: 9cb961f7ca2e457e3c19608cf3adb3231e0ab1d9
Parents: 055a4bb
Author: Peter Ent <pent@apache.org>
Authored: Tue May 26 16:02:19 2015 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Tue May 26 16:02:19 2015 -0400

----------------------------------------------------------------------
 .../org/apache/flex/html/beads/DataGridView.as  |  4 ---
 .../flex/html/beads/layouts/DataGridLayout.as   | 26 +++++++++++++-------
 2 files changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb961f7/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
index 8d3e8fa..2c67e70 100644
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
@@ -108,14 +108,11 @@ package org.apache.flex.html.beads
 			
 			// create an array of columnLabels for use by the ButtonBar/DataGrid header.
 			var columnLabels:Array = new Array();
-			var buttonWidths:Array = new Array();
 			for(var i:int=0; i < sharedModel.columns.length; i++) {
 				var dgc:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
 				columnLabels.push(dgc.label);
-				buttonWidths.push(dgc.columnWidth);
 			}
 			var bblayout:ButtonBarLayout = new ButtonBarLayout();
-			bblayout.buttonWidths = buttonWidths;
 			
 			buttonBarModel = new ArraySelectionModel();
 			buttonBarModel.dataProvider = columnLabels;
@@ -142,7 +139,6 @@ package org.apache.flex.html.beads
 				list.itemRenderer = dataGridColumn.itemRenderer;
 				list.labelField = dataGridColumn.dataField;
 				list.addBead(presentationModel);
-				trace("List.rowHeight is "+list.rowHeight);
 				
 				var colWidth:Number = dataGridColumn.columnWidth;
 				if (!isNaN(colWidth)) list.width = colWidth;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb961f7/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
index 0ad68df..4d1a288 100644
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
@@ -26,6 +26,7 @@ package org.apache.flex.html.beads.layouts
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.html.ButtonBar;
 	import org.apache.flex.html.supportClasses.DataGridColumn;
 	
 	/**
@@ -86,7 +87,6 @@ package org.apache.flex.html.beads.layouts
 			_header = UIBase(value);
 		}
 		
-		
 		private var _columns:Array;
 		
 		/**
@@ -114,22 +114,19 @@ package org.apache.flex.html.beads.layouts
 			var sw:Number = UIBase(_strand).width;
 			var sh:Number = UIBase(_strand).height;
 			
-			header.x = 0;
-			header.y = 0;
-			header.width = sw;
-			header.height = 25;
-			
-			var columnHeight:Number = sh - header.height;
-			var columnWidth:Number  = sw / columns.length;
+			var columnHeight:Number = Math.floor(sh - header.height);
+			var columnWidth:Number  = Math.floor(sw / columns.length);
 			
 			var xpos:Number = 0;
-			var ypos:Number = header.height;
+			var ypos:Number = Math.floor(header.height);
 			
 			// TODO: change the layout so that the model's DataGridColumn.columnWidth
 			// isn't used blindly, but is considered in the overall width. In other words,
 			// right now the width could exceed the strand's width.
 			var model:IDataGridModel = _strand.getBeadByType(IDataGridModel) as IDataGridModel;
 			
+			var buttonWidths:Array = new Array();
+			
 			for(var i:int=0; i < columns.length; i++) {
 				var column:UIBase = columns[i] as UIBase;
 				column.x = xpos;
@@ -141,8 +138,19 @@ package org.apache.flex.html.beads.layouts
 				else column.width  = columnWidth;
 				
 				xpos += column.width;
+				
+				buttonWidths.push(column.width);
 			}
 			
+			var bar:ButtonBar = header as ButtonBar;
+			var barLayout:ButtonBarLayout = bar.getBeadByType(ButtonBarLayout) as ButtonBarLayout;
+			barLayout.buttonWidths = buttonWidths;
+			
+			header.x = 0;
+			header.y = 0;
+			header.width = sw;
+			header.height = 25;
+			
 			return true;
 		}
 	}


Mime
View raw message