]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test case for #3165
authorArtur Signell <artur.signell@itmill.com>
Mon, 14 Sep 2009 09:39:52 +0000 (09:39 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 14 Sep 2009 09:39:52 +0000 (09:39 +0000)
svn changeset:8756/svn branch:6.1

src/com/vaadin/tests/components/table/ModifyContainerProperty.java [new file with mode: 0644]

diff --git a/src/com/vaadin/tests/components/table/ModifyContainerProperty.java b/src/com/vaadin/tests/components/table/ModifyContainerProperty.java
new file mode 100644 (file)
index 0000000..0038e7f
--- /dev/null
@@ -0,0 +1,57 @@
+package com.vaadin.tests.components.table;\r
+\r
+import com.vaadin.data.util.IndexedContainer;\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.Table;\r
+\r
+@SuppressWarnings("serial")\r
+public class ModifyContainerProperty extends TestBase {\r
+\r
+    private Table table = new Table();\r
+    private IndexedContainer ic = new IndexedContainer();\r
+\r
+    @Override\r
+    protected void setup() {\r
+        addComponent(table);\r
+\r
+        ic.addContainerProperty("one", String.class, "one");\r
+        ic.addContainerProperty("two", String.class, "two");\r
+\r
+        ic.addItem("foo");\r
+\r
+        ic.getContainerProperty("foo", "one").setValue("bar");\r
+        ic.getContainerProperty("foo", "two").setValue("baz");\r
+\r
+        table.setContainerDataSource(ic);\r
+        addComponent(new Button("Remove container property",\r
+                new Button.ClickListener() {\r
+                    public void buttonClick(com.vaadin.ui.Button.ClickEvent arg0) {\r
+                        ic.removeContainerProperty("one");\r
+                    }\r
+                }));\r
+        addComponent(new Button("Add container property",\r
+                new Button.ClickListener() {\r
+                    public void buttonClick(com.vaadin.ui.Button.ClickEvent arg0) {\r
+                        ic.addContainerProperty("three", String.class, "three");\r
+                        Object[] current = table.getVisibleColumns();\r
+                        Object[] vis = new Object[current.length + 1];\r
+                        for (int i = 0; i < current.length; i++) {\r
+                            vis[i] = current[i];\r
+                        }\r
+                        vis[current.length] = "three";\r
+                        table.setVisibleColumns(vis);\r
+                    }\r
+                }));\r
+    }\r
+\r
+    @Override\r
+    protected String getDescription() {\r
+        return "Clicking on \"Add container property\" adds a property to the container and sets it visible. The table should then show a \"three\" column in addition to the others. Clicking on \"Remove container property\" should remove column \"two\" from the table.";\r
+    }\r
+\r
+    @Override\r
+    protected Integer getTicketNumber() {\r
+        return 3165;\r
+    }\r
+}\r