diff options
author | Artur Signell <artur@vaadin.com> | 2015-02-21 00:12:09 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-03-02 21:51:32 +0200 |
commit | 587104589cd7907946fdf1d5508602da5545096f (patch) | |
tree | 8588e1cbc2c849b79736554fd2887bb73084b421 /server | |
parent | 10e362899e6cb342ebbe6ae32ee6ecd024e3bf43 (diff) | |
download | vaadin-framework-587104589cd7907946fdf1d5508602da5545096f.tar.gz vaadin-framework-587104589cd7907946fdf1d5508602da5545096f.zip |
Make Column.setLastFrozenColumn work (#16726)
Change-Id: I58fee1549459b24cb47e0d3321d16fb8b215959a
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/Grid.java | 2 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/grid/GridColumns.java | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index 6cab170565..6ab6c6b1a4 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -2197,7 +2197,7 @@ public class Grid extends AbstractComponent implements SelectionNotifier, public Column setLastFrozenColumn() { checkColumnIsAttached(); grid.setFrozenColumnCount(grid.getState(false).columnOrder - .indexOf(this) + 1); + .indexOf(getState().id) + 1); return this; } diff --git a/server/tests/src/com/vaadin/tests/server/component/grid/GridColumns.java b/server/tests/src/com/vaadin/tests/server/component/grid/GridColumns.java index 06c1b14bb6..fda662e4d9 100644 --- a/server/tests/src/com/vaadin/tests/server/component/grid/GridColumns.java +++ b/server/tests/src/com/vaadin/tests/server/component/grid/GridColumns.java @@ -185,6 +185,25 @@ public class GridColumns { } @Test + public void testSetFrozenColumnCount() { + assertEquals("Grid should not start with a frozen column", 0, + grid.getFrozenColumnCount()); + grid.setFrozenColumnCount(2); + assertEquals("Freezing two columns should freeze two columns", 2, + grid.getFrozenColumnCount()); + } + + @Test + public void testSetFrozenColumnCountThroughColumn() { + assertEquals("Grid should not start with a frozen column", 0, + grid.getFrozenColumnCount()); + grid.getColumns().get(2).setLastFrozenColumn(); + assertEquals( + "Setting the third column as last frozen should freeze three columns", + 3, grid.getFrozenColumnCount()); + } + + @Test public void testFrozenColumnRemoveColumn() { assertEquals("Grid should not start with a frozen column", 0, grid.getFrozenColumnCount()); |