diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2015-02-18 10:05:25 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2015-02-18 12:23:23 +0200 |
commit | 9b2f51ca9ff48ad9484b8ee67770ab1a58352b35 (patch) | |
tree | 952a8f76a7e5003fd59daf0d1ebb17899ccd5f61 /uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java | |
parent | f537b9fdb2ba3993090d22011adfe247e4e2b6bd (diff) | |
download | vaadin-framework-9b2f51ca9ff48ad9484b8ee67770ab1a58352b35.tar.gz vaadin-framework-9b2f51ca9ff48ad9484b8ee67770ab1a58352b35.zip |
Update server side state when columns are reordered. (#16643)
Change-Id: I96c65dbb96614a5f5782b747fb8588647211cf4b
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index 3a6aca11f2..792ef89d42 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -248,10 +248,25 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { addFilterActions(); + addInternalActions(); + this.grid = grid; return grid; } + private void addInternalActions() { + createClickAction("Update column order without updating client", + "Internals", new Command<Grid, Void>() { + @Override + public void execute(Grid grid, Void value, Object data) { + List<Column> columns = grid.getColumns(); + grid.setColumnOrder(columns.get(1).getPropertyId(), + columns.get(0).getPropertyId()); + grid.getUI().getConnectorTracker().markClean(grid); + } + }, null); + } + private void addFilterActions() { createClickAction("Column 1 starts with \"(23\"", "Filter", new Command<Grid, Void>() { @@ -658,6 +673,33 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } } }, null, c); + createClickAction("Move left", getColumnProperty(c), + new Command<Grid, String>() { + + @Override + public void execute(Grid grid, String value, Object data) { + final String columnProperty = getColumnProperty((Integer) data); + List<Column> cols = grid.getColumns(); + List<Object> reordered = new ArrayList<Object>(); + boolean addAsLast = false; + for (int i = 0; i < cols.size(); i++) { + Column col = cols.get(i); + if (col.getPropertyId().equals(columnProperty)) { + if (i == 0) { + addAsLast = true; + } else { + reordered.add(i - 1, columnProperty); + } + } else { + reordered.add(col.getPropertyId()); + } + } + if (addAsLast) { + reordered.add(columnProperty); + } + grid.setColumnOrder(reordered.toArray()); + } + }, null, c); createBooleanAction("Sortable", getColumnProperty(c), true, new Command<Grid, Boolean>() { |