From: Pekka Hyvönen Date: Thu, 16 Apr 2015 11:25:55 +0000 (+0300) Subject: Declarative support and test for Grid.Column.hidingToggleCaption #17481 X-Git-Tag: 7.5.0.beta1~56^2^2~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6ed28680346c648a6b4e974568a56f6d4d0e000b;p=vaadin-framework.git Declarative support and test for Grid.Column.hidingToggleCaption #17481 Change-Id: Ic20686649b28530160498742e78f69074e32e596 --- diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index 9346248dd9..a7ff15c8dd 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -3204,6 +3204,10 @@ public class Grid extends AbstractComponent implements SelectionNotifier, isHidable(), def.hidable, boolean.class); DesignAttributeHandler.writeAttribute("hidden", attributes, isHidden(), def.hidden, boolean.class); + DesignAttributeHandler.writeAttribute("hiding-toggle-caption", + attributes, getHidingToggleCaption(), + SharedUtil.propertyIdToHumanFriendly(getPropertyId()), + String.class); DesignAttributeHandler.writeAttribute("property-id", attributes, getPropertyId(), null, Object.class); } @@ -3237,6 +3241,10 @@ public class Grid extends AbstractComponent implements SelectionNotifier, setHidden(DesignAttributeHandler.readAttribute("hidden", attributes, boolean.class)); } + if (design.hasAttr("hiding-toggle-caption")) { + setHidingToggleCaption(DesignAttributeHandler.readAttribute( + "hiding-toggle-caption", attributes, String.class)); + } // Read size info where necessary. if (design.hasAttr("width")) { setWidth(DesignAttributeHandler.readAttribute("width", diff --git a/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java index 798988bb0d..6cf9ef55ad 100644 --- a/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java @@ -28,7 +28,7 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { + " " + " " + " " - + " " + + " " + " " + "" // + "" // @@ -39,7 +39,8 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { .setExpandRatio(2).setSortable(false); grid.addColumn("Column3", String.class).setMinimumWidth(15) .setExpandRatio(1).setEditable(false); - grid.addColumn("Column4", String.class).setHidable(true); + grid.addColumn("Column4", String.class).setHidable(true) + .setHidingToggleCaption("col 4"); grid.addColumn("Column5", String.class).setHidden(true); // Remove the default header @@ -57,6 +58,7 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { + " " + " " // property-id="property-1" + " " + + " " // property-id="property-3" + "" // + ""; Grid grid = new Grid(); @@ -65,6 +67,8 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { .setExpandRatio(2); grid.addColumn("Column3", String.class).setMinimumWidth(15) .setExpandRatio(1); + grid.addColumn("property-3", String.class).setHidable(true) + .setHidden(true).setHidingToggleCaption("col 4"); testRead(design, grid); } diff --git a/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeTestBase.java b/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeTestBase.java index 2a4b3f01fc..9424d89ecf 100644 --- a/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeTestBase.java +++ b/server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeTestBase.java @@ -147,7 +147,12 @@ public class GridDeclarativeTestBase extends DeclarativeTestBase { col2.isSortable()); assertEquals(baseError + "Editable", col1.isEditable(), col2.isEditable()); - + assertEquals(baseError + "Hidable", col1.isHidable(), + col2.isHidable()); + assertEquals(baseError + "Hidden", col1.isHidden(), col2.isHidden()); + assertEquals(baseError + "HidingToggleCaption", + col1.getHidingToggleCaption(), + col2.getHidingToggleCaption()); } } }