Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2016-07-01 07:42:16 -0400
committerIvan Furnadjiev2016-07-01 07:42:16 -0400
commit60b2bcae074db268dd98aa5a45e46ac92d9bfcc0 (patch)
treedf5055d481d9e9114519f821ff7415da0e64e3d7 /bundles
parentf19d3f13a7ab1a4fcd7c17f832d97102f3204e5d (diff)
downloadorg.eclipse.rap-60b2bcae074db268dd98aa5a45e46ac92d9bfcc0.tar.gz
org.eclipse.rap-60b2bcae074db268dd98aa5a45e46ac92d9bfcc0.tar.xz
org.eclipse.rap-60b2bcae074db268dd98aa5a45e46ac92d9bfcc0.zip
Render Grid indentionWidth property at runtime
In Tree/Table indentionWidth property doesn't change at runtime. It's rendered only once when widget is created. As Nebula Grid is represented as tree on the client a non zero indention width leads to visual offset of item text/checkbox in the first column when there is no subitems. Change-Id: I7952993c00ab2fa549dc2e73c90cee43665e1b2b
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java3
-rw-r--r--bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/gridkit/GridLCA.java11
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridHandler.js5
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/widgets/Grid.js5
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridRowContainer.js4
5 files changed, 21 insertions, 7 deletions
diff --git a/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java b/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java
index 9ef9641582..ecb0022f8d 100644
--- a/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java
+++ b/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java
@@ -2945,6 +2945,9 @@ public class Grid extends Composite {
}
int getIndentationWidth() {
+ if( !isTree ) {
+ return 0;
+ }
if( !layoutCache.hasIndentationWidth() ) {
layoutCache.indentationWidth = getThemeAdapter().getIndentationWidth( this );
}
diff --git a/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/gridkit/GridLCA.java b/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/gridkit/GridLCA.java
index 23d981adcb..a2f9a85e2d 100644
--- a/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/gridkit/GridLCA.java
+++ b/bundles/org.eclipse.rap.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/gridkit/GridLCA.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2012, 2015 EclipseSource and others.
+ * Copyright (c) 2012, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -71,6 +71,7 @@ public class GridLCA extends WidgetLCA<Grid> {
private static final String PROP_SCROLL_LEFT = "scrollLeft";
private static final String PROP_SELECTION = "selection";
private static final String PROP_AUTO_HEIGHT = "autoHeight";
+ private static final String PROP_INDENTION_WIDTH = "indentionWidth";
// TODO: [if] Sync sortDirection and sortColumn in GridColumnLCA when multiple sort columns are
// possible on the client
private static final String PROP_SORT_DIRECTION = "sortDirection";
@@ -95,8 +96,6 @@ public class GridLCA extends WidgetLCA<Grid> {
remoteObject.set( "parent", getId( grid.getParent() ) );
remoteObject.set( "style", createJsonArray( getStyles( grid, ALLOWED_STYLES ) ) );
remoteObject.set( "appearance", "grid" );
- IGridAdapter adapter = getGridAdapter( grid );
- remoteObject.set( "indentionWidth", adapter.getIndentationWidth() );
remoteObject.set( PROP_MARKUP_ENABLED, isMarkupEnabledFor( grid ) );
TemplateLCAUtil.renderRowTemplate( grid );
remoteObject.listen( PROP_SETDATA_LISTENER, isVirtual( grid ) );
@@ -124,6 +123,7 @@ public class GridLCA extends WidgetLCA<Grid> {
preserveProperty( grid, PROP_SCROLL_LEFT, getScrollLeft( grid ) );
preserveProperty( grid, PROP_SELECTION, getSelection( grid ) );
preserveProperty( grid, PROP_AUTO_HEIGHT, grid.isAutoHeight() );
+ preserveProperty( grid, PROP_INDENTION_WIDTH, getIndentationWidth( grid ) );
preserveProperty( grid, PROP_SORT_DIRECTION, getSortDirection( grid ) );
preserveProperty( grid, PROP_SORT_COLUMN, getSortColumn( grid ) );
preserveProperty( grid, PROP_ENABLE_CELL_TOOLTIP, CellToolTipUtil.isEnabledFor( grid ) );
@@ -150,6 +150,7 @@ public class GridLCA extends WidgetLCA<Grid> {
renderProperty( grid, PROP_SCROLL_LEFT, getScrollLeft( grid ), ZERO );
renderProperty( grid, PROP_SELECTION, getSelection( grid ), DEFAULT_SELECTION );
renderProperty( grid, PROP_AUTO_HEIGHT, grid.isAutoHeight(), false );
+ renderProperty( grid, PROP_INDENTION_WIDTH, getIndentationWidth( grid ), ZERO );
renderProperty( grid, PROP_SORT_DIRECTION, getSortDirection( grid ), DEFAULT_SORT_DIRECTION );
renderProperty( grid, PROP_SORT_COLUMN, getSortColumn( grid ), null );
renderListenSelection( grid );
@@ -209,6 +210,10 @@ public class GridLCA extends WidgetLCA<Grid> {
return result;
}
+ private static int getIndentationWidth( Grid grid ) {
+ return getGridAdapter( grid ).getIndentationWidth();
+ }
+
private static String getSortDirection( Grid grid ) {
String result = "none";
for( int i = 0; i < grid.getColumnCount() && result.equals( "none" ); i++ ) {
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridHandler.js b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridHandler.js
index 0bcd28e2ce..3fb7eab10d 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridHandler.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridHandler.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 EclipseSource and others.
+ * Copyright (c) 2011, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -77,7 +77,8 @@ rwt.remote.HandlerRegistry.add( "rwt.widgets.Grid", {
"enableCellToolTip",
"cellToolTipText",
"columnOrder",
- "autoHeight"
+ "autoHeight",
+ "indentionWidth"
] ),
propertyHandler : rwt.remote.HandlerUtil.extendControlPropertyHandler( {
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Grid.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Grid.js
index 435fbc11fe..e4eb02d688 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Grid.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Grid.js
@@ -357,6 +357,11 @@ rwt.qx.Class.define( "rwt.widgets.Grid", {
this._scheduleUpdate();
},
+ setIndentionWidth : function( value ) {
+ this._config.indentionWidth = value;
+ this._scheduleUpdate();
+ },
+
//////////////
// Overwritten
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridRowContainer.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridRowContainer.js
index 68dc799702..7e83482c5d 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridRowContainer.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridRowContainer.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 EclipseSource and others.
+ * Copyright (c) 2011, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -69,7 +69,7 @@ rwt.qx.Class.define( "rwt.widgets.base.GridRowContainer", {
"autoHeight" : false,
"variant" : null,
"selectionPadding" : null,
- "indentionWidth" : 16,
+ "indentionWidth" : 0,
"hasCheckBoxes" : false,
"checkBoxLeft" : null,
"checkBoxWidth" : null,

Back to the top