Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridColumnGroupHandler.js4
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/widgets/GridColumn.js11
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridHeader.js4
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GridColumnTest.js67
4 files changed, 70 insertions, 16 deletions
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridColumnGroupHandler.js b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridColumnGroupHandler.js
index 63ee84cfa4..93b9712682 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridColumnGroupHandler.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/GridColumnGroupHandler.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
@@ -13,8 +13,10 @@ rwt.remote.HandlerRegistry.add( "rwt.widgets.GridColumnGroup", {
factory : function( properties ) {
var result;
+ var styleMap = rwt.remote.HandlerUtil.createStyleMap( properties.style );
rwt.remote.HandlerUtil.callWithTarget( properties.parent, function( parent ) {
result = new rwt.widgets.GridColumn( parent, true );
+ result.setShowChevron( styleMap.TOGGLE === true );
rwt.remote.HandlerUtil.addDestroyableChild( parent, result );
} );
return result;
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GridColumn.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GridColumn.js
index eff00c1d6e..e3c5b1dbaf 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GridColumn.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GridColumn.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2014 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2007, 2016 Innoopract Informationssysteme GmbH 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
@@ -41,6 +41,7 @@ rwt.qx.Class.define( "rwt.widgets.GridColumn", {
this._footerImage = null;
this._footerSpan = 1;
this._sortDirection = null;
+ this._showChevron = false;
this._check = false;
this._grid.addColumn( this );
},
@@ -307,6 +308,14 @@ rwt.qx.Class.define( "rwt.widgets.GridColumn", {
return this._isGroup;
},
+ setShowChevron : function( value ) {
+ this._showChevron = value;
+ },
+
+ getShowChevron : function() {
+ return this._showChevron;
+ },
+
_update : function() {
this.dispatchSimpleEvent( "update" );
},
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridHeader.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridHeader.js
index 9c2aee2122..23cb797c90 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridHeader.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/GridHeader.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2011, 2016 Innoopract Informationssysteme GmbH 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
@@ -138,7 +138,7 @@ rwt.qx.Class.define( "rwt.widgets.base.GridHeader", {
label.setImage( column.getImage() );
label.setToolTipText( column.getToolTipText() );
label.setSortIndicator( column.getSortDirection() );
- if( column.isGroup() ) {
+ if( column.isGroup() && column.getShowChevron() ) {
label.setChevron( column.isExpanded() ? "expanded" : "collapsed" );
}
this._renderLabelY( label, column );
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GridColumnTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GridColumnTest.js
index 336785ede1..c1f3e471d8 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GridColumnTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GridColumnTest.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
@@ -1201,6 +1201,33 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
var column = ObjectRegistry.getObject( "w4" );
assertTrue( column instanceof rwt.widgets.GridColumn );
assertTrue( column.isGroup() );
+ assertFalse( column.getShowChevron() );
+ var label = this._getColumnLabel( tree, column );
+ assertIdentical( tree._header, label.getParent() );
+ assertEquals( "tree-column", label.getAppearance() );
+ assertTrue( label.hasState( "group" ) );
+ column.dispose();
+ tree.destroy();
+ },
+
+ testCreateColumnGroupByProtocol_withStyle_TOGGLE : function() {
+ var tree = this._createTreeByProtocol( "w3", "w2", [] );
+
+ MessageProcessor.processOperation( {
+ "target" : "w4",
+ "action" : "create",
+ "type" : "rwt.widgets.GridColumnGroup",
+ "properties" : {
+ "style" : ["TOGGLE"],
+ "parent" : "w3"
+ }
+ } );
+ TestUtil.flush();
+
+ var column = ObjectRegistry.getObject( "w4" );
+ assertTrue( column instanceof rwt.widgets.GridColumn );
+ assertTrue( column.isGroup() );
+ assertTrue( column.getShowChevron() );
var label = this._getColumnLabel( tree, column );
assertIdentical( tree._header, label.getParent() );
assertEquals( "tree-column", label.getAppearance() );
@@ -1405,7 +1432,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
tree.destroy();
},
- testRenderGroupChevron : function() {
+ testRenderGroupChevron_disabled : function() {
this._fakeChevronAppearance();
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
@@ -1415,6 +1442,22 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
TestUtil.flush();
var label = this._getColumnLabel( tree, column );
+ assertNull( label.getCellContent( 2 ) );
+ assertEquals( [ 0, 0 ], label.getCellDimension( 2 ) );
+ column.dispose();
+ tree.destroy();
+ },
+
+ testRenderGroupChevron : function() {
+ this._fakeChevronAppearance();
+ var tree = this._createTreeByProtocol( "w3", "w2", [] );
+ tree.setHeaderHeight( 50 );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
+
+ TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23 } );
+ TestUtil.flush();
+
+ var label = this._getColumnLabel( tree, column );
assertEquals( "chev-left.gif", label.getCellContent( 2 ) );
assertEquals( [ 10, 7 ], label.getCellDimension( 2 ) );
column.dispose();
@@ -1425,7 +1468,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
this._fakeChevronAppearance();
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23 } );
TestUtil.flush();
@@ -1442,7 +1485,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
this._fakeChevronAppearance();
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23 } );
TestUtil.flush();
@@ -1459,7 +1502,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
this._fakeChevronAppearance();
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23 } );
TestUtil.flush();
@@ -1478,7 +1521,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
this._fakeChevronAppearance();
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 50, "height" : 23, "text" : "x" } );
TestUtil.flush();
@@ -1493,7 +1536,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
this._fakeChevronAppearance();
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", {
"left" : 10,
@@ -1513,7 +1556,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
this._fakeChevronAppearance();
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", {
"left" : 10,
@@ -1534,7 +1577,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
TestUtil.initRequestLog();
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23 } );
TestUtil.protocolListen( "w4", { "Collapse" : true } );
TestUtil.flush();
@@ -1554,7 +1597,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
TestUtil.initRequestLog();
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23, "expanded" : false } );
TestUtil.protocolListen( "w4", { "Expand" : true } );
TestUtil.flush();
@@ -1575,7 +1618,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
TestUtil.initRequestLog();
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23 } );
TestUtil.flush();
@@ -1595,7 +1638,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.GridColumnTest", {
var tree = this._createTreeByProtocol( "w3", "w2", [] );
tree.setHeaderHeight( 50 );
TestUtil.initRequestLog();
- var column = this._createColumnGroupByProtocol( "w4", "w3", [] );
+ var column = this._createColumnGroupByProtocol( "w4", "w3", ["TOGGLE"] );
TestUtil.protocolSet( "w4", { "left" : 10, "width": 40, "height" : 23, "expanded" : false } );
TestUtil.flush();

Back to the top