]> source.dussan.org Git - vaadin-framework.git/commitdiff
Declarative support and test for Grid.Column.hidingToggleCaption #17481
authorPekka Hyvönen <pekka@vaadin.com>
Thu, 16 Apr 2015 11:25:55 +0000 (14:25 +0300)
committerPekka Hyvönen <pekka@vaadin.com>
Thu, 16 Apr 2015 11:25:55 +0000 (14:25 +0300)
Change-Id: Ic20686649b28530160498742e78f69074e32e596

server/src/com/vaadin/ui/Grid.java
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeTestBase.java

index 9346248dd952824a2e6e371bd9d4abfaa828016b..a7ff15c8dde66126df11cc1112487f53db8b0f8d 100644 (file)
@@ -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",
index 798988bb0db8fa4081ac3e39687395f15af70e9b..6cf9ef55add095a434d3762d41bd313fed1912e3 100644 (file)
@@ -28,7 +28,7 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase {
                 + "   <col sortable=true width='100' property-id='Column1'>"
                 + "   <col sortable=false max-width='200' expand='2' property-id='Column2'>"
                 + "   <col sortable=true editable=false min-width='15' expand='1' property-id='Column3'>"
-                + "   <col sortable=true hidable=true property-id='Column4'>"
+                + "   <col sortable=true hidable=true hiding-toggle-caption='col 4' property-id='Column4'>"
                 + "   <col sortable=true hidden=true property-id='Column5'>"
                 + "</colgroup>" //
                 + "<thead />" //
@@ -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 {
                 + "   <col sortable=true width='100' property-id='Column1'>"
                 + "   <col sortable=true max-width='200' expand='2'>" // property-id="property-1"
                 + "   <col sortable=true min-width='15' expand='1' property-id='Column3'>"
+                + "   <col sortable=true hidden=true hidable=true hiding-toggle-caption='col 4'>" // property-id="property-3"
                 + "</colgroup>" //
                 + "</table></v-grid>";
         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);
     }
index 2a4b3f01fcafa90ae19e164d2b73203a9844d3ef..9424d89ecfbff129b3cddf3d5074bff7d34d8b1e 100644 (file)
@@ -147,7 +147,12 @@ public class GridDeclarativeTestBase extends DeclarativeTestBase<Grid> {
                     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());
         }
     }
 }