diff options
author | Artur Signell <artur@vaadin.com> | 2011-11-08 18:20:44 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2011-11-08 18:20:44 +0200 |
commit | 2faa45146cdfccc3a2b83397bc23a4ec48f534af (patch) | |
tree | ec6ec855bb05dd363d819d590ef95fa69a8deedc | |
parent | 2eff8c02aba3d9dc0dd74b0aff9c114a3dc29201 (diff) | |
parent | 797cf8ae497075239fe9e415d91ec0195f2f9ec2 (diff) | |
download | vaadin-framework-2faa45146cdfccc3a2b83397bc23a4ec48f534af.tar.gz vaadin-framework-2faa45146cdfccc3a2b83397bc23a4ec48f534af.zip |
Merge remote branch 'origin/6.8'
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java b/tests/testbench/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java new file mode 100644 index 0000000000..701c7a6a36 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java @@ -0,0 +1,73 @@ +package com.vaadin.tests.components.treetable;
+
+import com.vaadin.data.Container.Hierarchical;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.terminal.ExternalResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.TreeTable;
+
+public class ChangeDataSourcePageLengthZero extends TestBase {
+ @Override
+ public void setup() {
+ final TreeTable tt = new TreeTable();
+ tt.setSizeUndefined();
+ tt.setWidth("100%");
+ tt.setImmediate(true);
+ tt.setPageLength(0);
+ setupContainer(tt, 20);
+ addComponent(tt);
+ Button page1 = new Button("Set new data source (20 items)");
+ page1.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ setupContainer(tt, 20);
+ }
+ });
+ Button page2 = new Button("Set new data source (10 items)");
+ page2.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ setupContainer(tt, 10);
+ }
+ });
+ addComponent(page1);
+ addComponent(page2);
+ }
+
+ private static void setupContainer(TreeTable tt, int num) {
+ HierarchicalContainer container = new HierarchicalContainer();
+ container.addContainerProperty("i", Integer.class, null);
+ container.addContainerProperty("link", Link.class, null);
+ fillContainer(container, num);
+ tt.setContainerDataSource(container);
+ }
+
+ private static void fillContainer(Hierarchical container, int num) {
+ Object previous = null;
+ for (int i = 0; i < num; i++) {
+ Object item = container.addItem();
+ container.getContainerProperty(item, "i").setValue(i + 1);
+ container.getContainerProperty(item, "link").setValue(
+ new Link(String.valueOf(i + 1), new ExternalResource(
+ "http://www.google.fi")));
+ if (i > 0 && (i + 1) % 2 == 0) {
+ container.setChildrenAllowed(item, false);
+ container.setParent(item, previous);
+ } else {
+ container.setChildrenAllowed(item, true);
+ }
+ previous = item;
+ }
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Changing the data source should update the height of a TreeTable with pagelength zero";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7908;
+ }
+}
\ No newline at end of file |