]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test application for #7785 (adapted from ticket).
authorHenri Sara <henri.sara@itmill.com>
Thu, 24 Nov 2011 10:10:44 +0000 (10:10 +0000)
committerHenri Sara <henri.sara@itmill.com>
Thu, 24 Nov 2011 10:10:44 +0000 (10:10 +0000)
svn changeset:22116/svn branch:6.7

tests/testbench/com/vaadin/tests/components/treetable/TreeTableModifyAndSetCollapsed.java [new file with mode: 0644]

diff --git a/tests/testbench/com/vaadin/tests/components/treetable/TreeTableModifyAndSetCollapsed.java b/tests/testbench/com/vaadin/tests/components/treetable/TreeTableModifyAndSetCollapsed.java
new file mode 100644 (file)
index 0000000..336ffb5
--- /dev/null
@@ -0,0 +1,57 @@
+package com.vaadin.tests.components.treetable;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.TreeTable;
+
+public class TreeTableModifyAndSetCollapsed extends TestBase {
+
+    int counter = 1;
+
+    @Override
+    protected void setup() {
+        final HierarchicalContainer container = new HierarchicalContainer();
+        container.addContainerProperty("value", String.class, "");
+
+        final TreeTable tt = new TreeTable(null, container);
+        tt.setSizeFull();
+        int parentId = counter++;
+        Item parent = container.addItem(parentId);
+        tt.setCollapsed(parentId, false);
+        parent.getItemProperty("value").setValue("parent " + (counter++) + "");
+        addComponent(tt);
+        Button repopulate = new Button("Repopulate", new ClickListener() {
+
+            public void buttonClick(ClickEvent event) {
+                // repopulate the container and expand root item
+                container.removeAllItems();
+                int parentId = counter++;
+                Item parent = container.addItem(parentId);
+                tt.setCollapsed(parentId, false);
+                parent.getItemProperty("value").setValue(
+                        "parent " + (counter++) + "");
+                for (int i = 0; i < 4; i++) {
+                    int childId = counter++;
+                    Item child = container.addItem(childId);
+                    child.getItemProperty("value").setValue(childId + "");
+                    container.setParent(childId, parentId);
+                }
+            }
+        });
+        addComponent(repopulate);
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Modifying a container and using setCollapsed on the same server round-trip should not cause any problems";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(7785);
+    }
+}