diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-07-18 14:31:10 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-07-18 14:31:10 +0300 |
commit | c81f853fd949d0e515459733b5f5a867b9e2ee0f (patch) | |
tree | ad42c04cdd494e4400e3ca57eab1098579416829 /server/src | |
parent | a8a6d25fe93002d8d11f958e9ddadc5c49604174 (diff) | |
download | vaadin-framework-c81f853fd949d0e515459733b5f5a867b9e2ee0f.tar.gz vaadin-framework-c81f853fd949d0e515459733b5f5a867b9e2ee0f.zip |
Fix TreeGrid.getHierarchyColumn to use correct id (#9690)
Fixes #9661
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/TreeGrid.java | 2 | ||||
-rw-r--r-- | server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/TreeGrid.java b/server/src/main/java/com/vaadin/ui/TreeGrid.java index 703a83192a..8ee154a56e 100644 --- a/server/src/main/java/com/vaadin/ui/TreeGrid.java +++ b/server/src/main/java/com/vaadin/ui/TreeGrid.java @@ -248,7 +248,7 @@ public class TreeGrid<T> extends Grid<T> * has been explicitly set */ public Column<T, ?> getHierarchyColumn() { - return getColumn(getState(false).hierarchyColumnId); + return getColumnByInternalId(getState(false).hierarchyColumnId); } /** diff --git a/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java b/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java index fdaacae48b..1876d8de35 100644 --- a/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java +++ b/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import com.vaadin.data.TreeData; import com.vaadin.data.provider.TreeDataProvider; +import com.vaadin.ui.Grid.Column; import com.vaadin.ui.TreeGrid; import com.vaadin.ui.renderers.TextRenderer; @@ -14,6 +15,7 @@ public class TreeGridTest { private boolean expandEventFired = false; private boolean collapseEventFired = false; + @Test public void testChangeRendererOfHierarchyColumn() { treeGrid.addColumn(Object::toString).setId("foo"); treeGrid.setHierarchyColumn("foo"); @@ -44,4 +46,14 @@ public class TreeGridTest { Assert.assertFalse("Item not collapsed", treeGrid.isExpanded("Foo")); Assert.assertTrue("Collapse event not fired", collapseEventFired); } + + @Test + public void testSetAndGetHierarchyColumn() { + Column<String, String> column = treeGrid.addColumn(Object::toString) + .setId("foo"); + treeGrid.setHierarchyColumn("foo"); + Assert.assertEquals("Hierarchy column was not correctly returned", + column, treeGrid.getHierarchyColumn()); + } + } |