You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/03/06 10:48:03 UTC
[royale-asjs] branch develop updated: jewel-datagrid: fixed final
issues with height and streamline view and layout
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 8ec82a6 jewel-datagrid: fixed final issues with height and streamline view and layout
8ec82a6 is described below
commit 8ec82a6cb606164f7d505c7e389ec1bf075bb70d
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Fri Mar 6 11:47:53 2020 +0100
jewel-datagrid: fixed final issues with height and streamline view and layout
---
.../src/main/royale/DataGridPlayGround.mxml | 3 +--
.../royale/jewel/beads/layouts/DataGridLayout.as | 30 +++++-----------------
.../royale/jewel/beads/views/DataGridView.as | 19 ++++++++------
3 files changed, 19 insertions(+), 33 deletions(-)
diff --git a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
index 91b5c16..561fb2e 100644
--- a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
@@ -160,8 +160,7 @@ limitations under the License.
<j:DataGrid localId="datagrid" height="100%"
change="dataGridProductChange(event.target as DataGrid, datagrid_lb)"
- >
- <!-- dataProvider="{productModel.fewProductList}" -->
+ dataProvider="{productModel.fewProductList}">
<j:beads>
<j:DataGridColumnLabelsChange/>
</j:beads>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as
index 028066e..ada854b 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as
@@ -21,7 +21,6 @@ package org.apache.royale.jewel.beads.layouts
import org.apache.royale.collections.ArrayList;
import org.apache.royale.core.IBeadLayout;
import org.apache.royale.core.IDataGridModel;
- import org.apache.royale.core.ILayoutChild;
import org.apache.royale.core.IScrollingViewport;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.IUIBase;
@@ -42,7 +41,7 @@ package org.apache.royale.jewel.beads.layouts
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
- * @productversion Royale 0.9
+ * @productversion Royale 0.9.7
*/
public class DataGridLayout implements IBeadLayout
{
@@ -52,7 +51,7 @@ package org.apache.royale.jewel.beads.layouts
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
- * @productversion Royale 0.9
+ * @productversion Royale 0.9.7
*/
public function DataGridLayout()
{
@@ -66,13 +65,12 @@ package org.apache.royale.jewel.beads.layouts
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
- * @productversion Royale 0.9
+ * @productversion Royale 0.9.7
* @royaleignorecoercion org.apache.royale.events.IEventDispatcher
*/
public function set strand(value:IStrand):void
{
_strand = value;
-
(_strand as IEventDispatcher).addEventListener("layoutNeeded", handleLayoutNeeded);
}
@@ -127,30 +125,16 @@ package org.apache.royale.jewel.beads.layouts
if(listArea.y != header.height)
listArea.y = header.height;
-
- (listArea as ILayoutChild).percentWidth = 100;
- // (listArea as ILayoutChild).percentHeight = 100;
-
- COMPILE::JS {
- if(datagrid.height == 0)
- listArea.positioner.style.height = "calc(100% - " + header.height + "px)";
- else
- listArea.height = datagrid.height - header.height;
- }
- for(var i:int=0; i < bbmodel.dataProvider.length; i++) {
+ for(var i:int=0; i < bbmodel.dataProvider.length; i++)
+ {
var columnDef:IDataGridColumn = (bbmodel.dataProvider as ArrayList).getItemAt(i) as IDataGridColumn;
var columnList:UIBase = displayedColumns[i] as UIBase;
- if(model.dataProvider && (model.dataProvider.length * presentationModel.rowHeight) > listArea.height)
+ //remove columns height if rows not surround datagrid height (and this one is set to pixels)
+ if(model.dataProvider && isNaN(datagrid.percentHeight) && (model.dataProvider.length * presentationModel.rowHeight) > listArea.height)
{
columnList.height = NaN;
- } else
- {
- if(datagrid.height == 0)
- columnList.percentHeight = 100;
- else
- columnList.height = listArea.height;
}
//temporal- if only one isNaN(columnDef.columnWidth) make it true so widthType = ButtonBarModel.PIXEL_WIDTHS
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as
index 33cdd9b..ee3431b 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as
@@ -88,8 +88,6 @@ package org.apache.royale.jewel.beads.views
_dg = _strand as IDataGrid;
_presentationModel = _dg.presentationModel as IDataGridPresentationModel;
- // _dg.addEventListener("widthChanged", handleSizeChanges);
- // _dg.addEventListener("heightChanged", handleSizeChanges);
// see if there is a presentation model already in place. if not, add one.
_sharedModel = _dg.model as IDataGridModel;
@@ -125,16 +123,21 @@ package org.apache.royale.jewel.beads.views
// columns
var listAreaClass:Class = ValuesManager.valuesImpl.getValue(host, "listAreaClass") as Class;
_listArea = new listAreaClass() as IUIBase;
+ (_listArea as ILayoutChild).percentWidth = 100;
+ COMPILE::JS {
+ _listArea.positioner.style.height = "calc(100% - " + header.height + "px)";
+ }
+
_dg.strandChildren.addElement(_listArea as IChild);
- if (_sharedModel.columns)
- createLists();
-
// set default width and height
- if(!_dg.width && !(_dg as ILayoutChild).percentWidth)
+ if(!_dg.width && (_dg as ILayoutChild).isWidthSizedToContent())
_dg.width = 220; // if width not set make it default to 220px
- if(!_dg.height && isNaN((_dg as ILayoutChild).percentHeight))
+ if(!_dg.height && (_dg as ILayoutChild).isHeightSizedToContent())
_dg.height = 240; // if height not set make it default to 240px
+
+ if (_sharedModel.columns)
+ createLists();
}
/**
@@ -170,6 +173,7 @@ package org.apache.royale.jewel.beads.views
// by default make columns get the 1/n of the maximun space available
(list as ILayoutChild).percentWidth = 100 / _sharedModel.columns.length;
+ (list as ILayoutChild).percentHeight = 100;
list.itemRenderer = dataGridColumn.itemRenderer;
list.labelField = dataGridColumn.dataField;
list.addEventListener('rollOverIndexChanged', handleColumnListRollOverChange);
@@ -199,7 +203,6 @@ package org.apache.royale.jewel.beads.views
{
IEventDispatcher(_strand).removeEventListener("initComplete", initCompleteHandler);
handleDataProviderChanged(null);
- // host.dispatchEvent(new Event("layoutNeeded"));
}
/**