You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2017/04/11 16:01:05 UTC
[40/44] git commit: [flex-asjs] [refs/heads/develop] - Fixed layout
(HTML side) bug for DataGrid.
Fixed layout (HTML side) bug for DataGrid.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/28150c46
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/28150c46
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/28150c46
Branch: refs/heads/develop
Commit: 28150c46ec97ec335b35804dff597af2709c164e
Parents: fece150
Author: Peter Ent <pe...@apache.org>
Authored: Mon Apr 10 11:51:56 2017 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Apr 10 11:51:56 2017 -0400
----------------------------------------------------------------------
.../flex/html/beads/DataGridPercentageView.as | 5 +-
.../org/apache/flex/html/beads/DataGridView.as | 445 ++++++++++---------
.../html/supportClasses/ScrollingViewport.as | 1 +
3 files changed, 227 insertions(+), 224 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/28150c46/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridPercentageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridPercentageView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridPercentageView.as
index 76365f3..510e18d 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridPercentageView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridPercentageView.as
@@ -131,10 +131,11 @@ package org.apache.flex.html.beads
}
COMPILE::JS {
_header.element.style["flex-grow"] = "0";
+ _header.element.style["min-height"] = "30px";
_listArea.element.style["flex-grow"] = "1";
}
-
- finishSetup(null);
+
+ IEventDispatcher(_strand).addEventListener("initComplete", finishSetup);
}
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/28150c46/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
index 4103659..68e5d95 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
@@ -40,260 +40,261 @@ package org.apache.flex.html.beads
COMPILE::SWF {
import org.apache.flex.core.SimpleCSSStyles;
}
-
- /**
- * The DataGridView class is the visual bead for the org.apache.flex.html.DataGrid.
- * This class constructs the items that make the DataGrid: Lists for each column and a
- * org.apache.flex.html.ButtonBar for the column headers.
- *
- * @viewbead
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataGridView extends GroupView implements IBeadView
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataGridView()
- {
- super();
- }
-
- private var _strand:IStrand;
- private var _header:DataGridButtonBar;
- private var _listArea:Container;
-
- private var _lists:Array;
/**
- * An array of List objects the comprise the columns of the DataGrid.
- */
- public function get columnLists():Array
- {
- return _lists;
- }
-
- /**
- * The area used to hold the columns
- *
- */
- public function get listArea():Container
- {
- return _listArea;
- }
-
- /**
- * Returns the component used as the header for the DataGrid.
- */
- public function get header():IUIBase
- {
- return _header;
- }
-
- /**
- * @copy org.apache.flex.core.IBead#strand
+ * The DataGridView class is the visual bead for the org.apache.flex.html.DataGrid.
+ * This class constructs the items that make the DataGrid: Lists for each column and a
+ * org.apache.flex.html.ButtonBar for the column headers.
*
+ * @viewbead
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- override public function set strand(value:IStrand):void
+ public class DataGridView extends GroupView implements IBeadView
{
- super.strand = value;
- _strand = value;
-
- var host:DataGrid = value as DataGrid;
-
- _header = new DataGridButtonBar();
- _header.height = 30;
- _header.percentWidth = 100;
-
- _listArea = new Container();
- _listArea.percentWidth = 100;
- _listArea.className = "DataGridListArea";
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridView()
+ {
+ super();
+ }
- COMPILE::SWF {
- _header.style = new SimpleCSSStyles();
- _header.style.flexGrow = 0;
-
- _listArea.style = new SimpleCSSStyles();
- _listArea.style.flexGrow = 1;
+ private var _strand:IStrand;
+ private var _header:DataGridButtonBar;
+ private var _listArea:Container;
+
+ private var _lists:Array;
+
+ /**
+ * An array of List objects the comprise the columns of the DataGrid.
+ */
+ public function get columnLists():Array
+ {
+ return _lists;
}
- COMPILE::JS {
- _header.element.style["flex-grow"] = "0";
- _listArea.element.style["flex-grow"] = "1";
+
+ /**
+ * The area used to hold the columns
+ *
+ */
+ public function get listArea():Container
+ {
+ return _listArea;
}
-
- finishSetup(null);
- }
-
- /**
- * @private
- */
- private function finishSetup(event:Event):void
- {
- var host:DataGrid = _strand as DataGrid;
- if (_lists == null || _lists.length == 0) {
- createLists();
+ /**
+ * Returns the component used as the header for the DataGrid.
+ */
+ public function get header():IUIBase
+ {
+ return _header;
}
-
- // see if there is a presentation model already in place. if not, add one.
- var presentationModel:IDataGridPresentationModel = host.presentationModel;
- var sharedModel:IDataGridModel = host.model as IDataGridModel;
- IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",handleDataProviderChanged);
- IEventDispatcher(sharedModel).addEventListener("selectedIndexChanged", handleSelectedIndexChanged);
-
- var columnLabels:Array = new Array();
- var buttonWidths:Array = new Array();
- var marginBorderOffset:int = 0;
- COMPILE::SWF {
- marginBorderOffset = 1;
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ var host:DataGrid = value as DataGrid;
+
+ _header = new DataGridButtonBar();
+ _header.height = 30;
+ _header.percentWidth = 100;
+
+ _listArea = new Container();
+ _listArea.percentWidth = 100;
+ _listArea.className = "DataGridListArea";
+
+ COMPILE::SWF {
+ _header.style = new SimpleCSSStyles();
+ _header.style.flexGrow = 0;
+
+ _listArea.style = new SimpleCSSStyles();
+ _listArea.style.flexGrow = 1;
+ }
+ COMPILE::JS {
+ _header.element.style["flex-grow"] = "0";
+ _header.element.style["min-height"] = "30px";
+ _listArea.element.style["flex-grow"] = "1";
+ }
+
+ IEventDispatcher(_strand).addEventListener("initComplete", finishSetup);
}
-
- for(var i:int=0; i < sharedModel.columns.length; i++) {
- var dgc:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
- columnLabels.push(dgc.label);
- var colWidth:Number = dgc.columnWidth - marginBorderOffset;
- buttonWidths.push(colWidth);
+
+ /**
+ * @private
+ */
+ private function finishSetup(event:Event):void
+ {
+ var host:DataGrid = _strand as DataGrid;
- var list:DataGridColumnList = _lists[i] as DataGridColumnList;
- if (!isNaN(colWidth)) {
- list.width = Number(colWidth - marginBorderOffset);
- } else {
- COMPILE::SWF {
- list.style = new SimpleCSSStyles();
- list.style.flexGrow = 1;
- }
- COMPILE::JS {
- list.element.style["flex-grow"] = "1";
+ if (_lists == null || _lists.length == 0) {
+ createLists();
+ }
+
+ // see if there is a presentation model already in place. if not, add one.
+ var presentationModel:IDataGridPresentationModel = host.presentationModel;
+ var sharedModel:IDataGridModel = host.model as IDataGridModel;
+ IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",handleDataProviderChanged);
+ IEventDispatcher(sharedModel).addEventListener("selectedIndexChanged", handleSelectedIndexChanged);
+
+ var columnLabels:Array = new Array();
+ var buttonWidths:Array = new Array();
+
+ var marginBorderOffset:int = 0;
+ COMPILE::SWF {
+ marginBorderOffset = 1;
+ }
+
+ for(var i:int=0; i < sharedModel.columns.length; i++) {
+ var dgc:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
+ columnLabels.push(dgc.label);
+ var colWidth:Number = dgc.columnWidth - marginBorderOffset;
+ buttonWidths.push(colWidth);
+
+ var list:DataGridColumnList = _lists[i] as DataGridColumnList;
+ if (!isNaN(colWidth)) {
+ list.width = Number(colWidth - marginBorderOffset);
+ } else {
+ COMPILE::SWF {
+ list.style = new SimpleCSSStyles();
+ list.style.flexGrow = 1;
}
+ COMPILE::JS {
+ list.element.style["flex-grow"] = "1";
+ }
+ }
}
+
+ var bblayout:ButtonBarLayout = new ButtonBarLayout();
+ _header.buttonWidths = buttonWidths
+ _header.widthType = ButtonBarModel.PIXEL_WIDTHS;
+ _header.dataProvider = columnLabels;
+ _header.addBead(bblayout);
+ _header.addBead(new Viewport());
+ host.addElement(_header);
+
+ host.addElement(_listArea);
+
+ handleDataProviderChanged(event);
+
+ host.addEventListener("widthChanged", handleSizeChanges);
+ host.addEventListener("heightChanged", handleSizeChanges);
}
-
- var bblayout:ButtonBarLayout = new ButtonBarLayout();
- _header.buttonWidths = buttonWidths
- _header.widthType = ButtonBarModel.PIXEL_WIDTHS;
- _header.dataProvider = columnLabels;
- _header.addBead(bblayout);
- _header.addBead(new Viewport());
- host.addElement(_header);
-
- host.addElement(_listArea);
-
- handleDataProviderChanged(event);
- host.addEventListener("widthChanged", handleSizeChanges);
- host.addEventListener("heightChanged", handleSizeChanges);
- }
-
- /**
- * @private
- */
- private function handleSizeChanges(event:Event):void
- {
- _header.dispatchEvent(new Event("layoutChanged"));
- _listArea.dispatchEvent(new Event("layoutChanged"));
- }
-
- /**
- * @private
- */
- private function handleDataProviderChanged(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
-
- for (var i:int=0; i < _lists.length; i++)
+ /**
+ * @private
+ */
+ private function handleSizeChanges(event:Event):void
+ {
+ _header.dispatchEvent(new Event("layoutChanged"));
+ _listArea.dispatchEvent(new Event("layoutChanged"));
+ }
+
+ /**
+ * @private
+ */
+ private function handleDataProviderChanged(event:Event):void
{
- var list:DataGridColumnList = _lists[i] as DataGridColumnList;
- var listModel:ISelectionModel = list.getBeadByType(IBeadModel) as ISelectionModel;
- listModel.dataProvider = sharedModel.dataProvider;
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+
+ for (var i:int=0; i < _lists.length; i++)
+ {
+ var list:DataGridColumnList = _lists[i] as DataGridColumnList;
+ var listModel:ISelectionModel = list.getBeadByType(IBeadModel) as ISelectionModel;
+ listModel.dataProvider = sharedModel.dataProvider;
+ }
+
+ host.dispatchEvent(new Event("layoutNeeded"));
}
-
- host.dispatchEvent(new Event("layoutNeeded"));
- }
-
- /**
- * @private
- */
- private function handleSelectedIndexChanged(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- var newIndex:int = sharedModel.selectedIndex;
- for (var i:int=0; i < _lists.length; i++)
+ /**
+ * @private
+ */
+ private function handleSelectedIndexChanged(event:Event):void
{
- var list:DataGridColumnList = _lists[i] as DataGridColumnList;
- list.selectedIndex = newIndex;
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+ var newIndex:int = sharedModel.selectedIndex;
+
+ for (var i:int=0; i < _lists.length; i++)
+ {
+ var list:DataGridColumnList = _lists[i] as DataGridColumnList;
+ list.selectedIndex = newIndex;
+ }
}
- }
-
- /**
- * @private
- */
- private function handleColumnListChange(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- var list:DataGridColumnList = event.target as DataGridColumnList;
- sharedModel.selectedIndex = list.selectedIndex;
-
- for(var i:int=0; i < _lists.length; i++) {
- if (list != _lists[i]) {
- var otherList:DataGridColumnList = _lists[i] as DataGridColumnList;
- otherList.selectedIndex = list.selectedIndex;
+
+ /**
+ * @private
+ */
+ private function handleColumnListChange(event:Event):void
+ {
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+ var list:DataGridColumnList = event.target as DataGridColumnList;
+ sharedModel.selectedIndex = list.selectedIndex;
+
+ for(var i:int=0; i < _lists.length; i++) {
+ if (list != _lists[i]) {
+ var otherList:DataGridColumnList = _lists[i] as DataGridColumnList;
+ otherList.selectedIndex = list.selectedIndex;
+ }
}
+
+ host.dispatchEvent(new Event('change'));
}
-
- host.dispatchEvent(new Event('change'));
- }
-
- /**
- * @private
- */
- private function createLists():void
- {
- var host:DataGrid = _strand as DataGrid;
- var sharedModel:IDataGridModel = host.model as IDataGridModel;
- var presentationModel:IDataGridPresentationModel = host.presentationModel;
-
- _lists = new Array();
-
- for (var i:int=0; i < sharedModel.columns.length; i++) {
- var dataGridColumn:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
-
- var list:DataGridColumnList = new DataGridColumnList();
- list.id = "dataGridColumn"+String(i);
- list.addBead(sharedModel);
- list.itemRenderer = dataGridColumn.itemRenderer;
- list.labelField = dataGridColumn.dataField;
- list.addEventListener('change',handleColumnListChange);
- list.addBead(presentationModel);
+ /**
+ * @private
+ */
+ private function createLists():void
+ {
+ var host:DataGrid = _strand as DataGrid;
- if (i == 0) {
- list.className = "first";
- } else if (i == sharedModel.columns.length-1) {
- list.className = "last";
- } else {
- list.className = "middle";
+ var sharedModel:IDataGridModel = host.model as IDataGridModel;
+ var presentationModel:IDataGridPresentationModel = host.presentationModel;
+
+ _lists = new Array();
+
+ for (var i:int=0; i < sharedModel.columns.length; i++) {
+ var dataGridColumn:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
+
+ var list:DataGridColumnList = new DataGridColumnList();
+ list.id = "dataGridColumn"+String(i);
+ list.addBead(sharedModel);
+ list.itemRenderer = dataGridColumn.itemRenderer;
+ list.labelField = dataGridColumn.dataField;
+ list.addEventListener('change',handleColumnListChange);
+ list.addBead(presentationModel);
+
+ if (i == 0) {
+ list.className = "first";
+ } else if (i == sharedModel.columns.length-1) {
+ list.className = "last";
+ } else {
+ list.className = "middle";
+ }
+
+ _listArea.addElement(list);
+ _lists.push(list);
}
-
- _listArea.addElement(list);
- _lists.push(list);
+
+ host.dispatchEvent(new Event("layoutNeeded"));
}
-
- host.dispatchEvent(new Event("layoutNeeded"));
}
- }
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/28150c46/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
index fe254fe..1a2b214 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
@@ -65,6 +65,7 @@ package org.apache.flex.html.supportClasses
*/
public function ScrollingViewport()
{
+ super();
}
public function get verticalScrollPosition():Number