diff options
author | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2011-08-23 13:02:17 +0000 |
---|---|---|
committer | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2011-08-23 13:02:17 +0000 |
commit | c96076ef8bb2d9d9f27f0b44cb1743af0babab24 (patch) | |
tree | 2365f1f041f4b93eb66eb0f0111c79afe53b86af /tests | |
parent | b0a5fd783d5a62b33141727007be8b2971656a32 (diff) | |
download | vaadin-framework-c96076ef8bb2d9d9f27f0b44cb1743af0babab24.tar.gz vaadin-framework-c96076ef8bb2d9d9f27f0b44cb1743af0babab24.zip |
Barebones fix for #6745: Connectors for Tree, i.e. ugly but works. We can make it more pretty in future releases if necessary.
Includes TestBench test for the feature.
svn changeset:20577/svn branch:6.7
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/vaadin/tests/components/tree/TreeConnectors.html | 67 | ||||
-rw-r--r-- | tests/src/com/vaadin/tests/components/tree/TreeConnectors.java | 85 |
2 files changed, 152 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/tree/TreeConnectors.html b/tests/src/com/vaadin/tests/components/tree/TreeConnectors.html new file mode 100644 index 0000000000..b76c65fa69 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/tree/TreeConnectors.html @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="/" /> +<title>TreeConnectors</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TreeConnectors</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/TreeConnectors?theme=base</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>base</td> +</tr> +<tr> + <td>open</td> + <td>/run/TreeConnectors?theme=reindeer</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>reindeer</td> +</tr> +<tr> + <td>open</td> + <td>/run/TreeConnectors?theme=runo</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>runo</td> +</tr> +<tr> + <td>open</td> + <td>/run/TreeConnectors?theme=liferay</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>liferay</td> +</tr> +<tr> + <td>open</td> + <td>/run/TreeConnectors?theme=chameleon</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>chameleon</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/src/com/vaadin/tests/components/tree/TreeConnectors.java b/tests/src/com/vaadin/tests/components/tree/TreeConnectors.java new file mode 100644 index 0000000000..08d4df0003 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/tree/TreeConnectors.java @@ -0,0 +1,85 @@ +package com.vaadin.tests.components.tree; + +import com.vaadin.data.Item; +import com.vaadin.data.util.HierarchicalContainer; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Tree; +import com.vaadin.ui.themes.BaseTheme; + +@SuppressWarnings("serial") +public class TreeConnectors extends TestBase { + + @Override + protected void setup() { + final Tree tree = new Tree(null, createContainer()); + tree.addStyleName(BaseTheme.TREE_CONNECTORS); + for (Object rootItems : tree.rootItemIds()) { + tree.expandItemsRecursively(rootItems); + } + tree.setChildrenAllowed("Item 73", false); + + addComponent(tree); + } + + @Override + protected String getDescription() { + return "Tree nodes should be connected with lines indicating the hierarchy."; + } + + @Override + protected Integer getTicketNumber() { + return 6745; + } + + private HierarchicalContainer createContainer() { + HierarchicalContainer cont = new HierarchicalContainer(); + cont.addContainerProperty("name", String.class, ""); + + for (int i = 0; i < 20; i++) { + Item item = cont.addItem("Item " + i); + item.getItemProperty("name").setValue("Item " + i); + cont.setChildrenAllowed("Item " + i, false); + + if (i == 1 || i == 4) { + cont.setChildrenAllowed("Item " + i, true); + } + + // Add three items to item 1 + if (i > 1 && i < 4) { + cont.setParent("Item " + i, "Item 1"); + } + + // Add 5 items to item 4 + if (i > 4 && i < 10) { + cont.setChildrenAllowed("Item " + i, true); + + if (i == 7) { + item = cont.addItem("Item 71"); + item.getItemProperty("name").setValue("Item 71"); + cont.setParent("Item 71", "Item " + i); + cont.setChildrenAllowed("Item 71", false); + + item = cont.addItem("Item 72"); + item.getItemProperty("name").setValue("Item 72"); + cont.setParent("Item 72", "Item " + i); + cont.setChildrenAllowed("Item 72", true); + + item = cont.addItem("Item 73"); + item.getItemProperty("name").setValue("Item 73"); + cont.setParent("Item 73", "Item 72"); + cont.setChildrenAllowed("Item 73", true); + + item = cont.addItem("Item 74"); + item.getItemProperty("name").setValue("Item 74"); + cont.setParent("Item 74", "Item " + i); + cont.setChildrenAllowed("Item 74", true); + } + + cont.setParent("Item " + i, "Item " + (i - 1)); + + } + } + + return cont; + } +} |