aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/tree
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/components/tree
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz
vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/tree')
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/ActionsOnTreeBackground.html105
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/CtrlShiftMultiselect.java120
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.html66
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.java120
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/ItemStyleGenerator.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.html27
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.java36
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeConnectors-base.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeConnectors-chameleon.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeConnectors-reindeer.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeConnectors-runo.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeConnectors.java142
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeContainerChange47
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeContainerChange.java104
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeContextMenuAndIcons.html156
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.html87
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java120
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeFiltering.html81
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java134
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.html77
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.java65
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.html103
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java87
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html82
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.html81
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java62
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScroll.html87
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java66
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.html97
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.java49
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.html42
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.java44
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreePerformanceTest.java75
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeScrolling.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeScrolling.java54
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.html76
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java72
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeShiftMultiSelectNodes.html47
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeToolTips.java90
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeTooltip.html52
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.html62
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java69
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeWithPreselectedItemNotShown.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/Trees.java407
44 files changed, 3577 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/tree/ActionsOnTreeBackground.html b/uitest/src/com/vaadin/tests/components/tree/ActionsOnTreeBackground.html
new file mode 100644
index 0000000000..8b679208d0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/ActionsOnTreeBackground.html
@@ -0,0 +1,105 @@
+<?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>actions-on-table-background</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">actions-on-table-background</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.Trees?restartApplication</td>
+ <td></td>
+</tr>
+<!--Set tree height so we get empty space-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_Smenu#item0</td>
+ <td>26,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[0]/VMenuBar[0]#item2</td>
+ <td>6,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>15,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[2]/VMenuBar[0]#item4</td>
+ <td>9,11</td>
+</tr>
+<!--Add context menu item-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_Smenu#item0</td>
+ <td>25,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>6,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>60,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>54,12</td>
+</tr>
+<!--Open context menu on empty space-->
+<tr>
+ <td>contextmenu</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertVisible</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VContextMenu[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VContextMenu[0]#option0</td>
+ <td>8,10</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_SLog_row_0</td>
+ <td>2. Action No icon performed on null</td>
+</tr>
+<!--Open context menu on item-->
+<tr>
+ <td>contextmenu</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertVisible</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VContextMenu[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VContextMenu[0]#option0</td>
+ <td>12,5</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_SLog_row_0</td>
+ <td>3. Action No icon performed on Item 2</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/CtrlShiftMultiselect.java b/uitest/src/com/vaadin/tests/components/tree/CtrlShiftMultiselect.java
new file mode 100644
index 0000000000..03645557f2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/CtrlShiftMultiselect.java
@@ -0,0 +1,120 @@
+package com.vaadin.tests.components.tree;
+
+import java.util.Set;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Tree;
+
+public class CtrlShiftMultiselect extends TestBase {
+
+ private final Tree tree = new Tree();
+ private final Label valueLbl = new Label("No selection");
+
+ @Override
+ protected void setup() {
+
+ getLayout().setSpacing(true);
+
+ tree.setContainerDataSource(createContainer());
+ tree.setItemCaptionPropertyId("name");
+ tree.setWidth("300px");
+ tree.setImmediate(true);
+ tree.setSelectable(true);
+ tree.setMultiSelect(true);
+ tree.expandItemsRecursively("Item 1");
+ tree.expandItemsRecursively("Item 4");
+
+ tree.addListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if (tree.getValue() instanceof Set) {
+ @SuppressWarnings("unchecked")
+ // safe cast after instanceof check
+ Set<Object> itemIds = (Set<Object>) tree.getValue();
+ if (itemIds.size() == 0) {
+ valueLbl.setValue("No selection");
+ } else {
+ valueLbl.setValue(itemIds);
+ }
+ } else {
+ valueLbl.setValue(tree.getValue());
+ }
+ }
+ });
+
+ addComponent(tree);
+
+ valueLbl.setWidth("300px");
+ valueLbl.setHeight("600px");
+ addComponent(valueLbl);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Add ctlr+shift multi selection in Tree";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4259;
+ }
+
+ 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;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.html b/uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.html
new file mode 100644
index 0000000000..8bb51204aa
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.html
@@ -0,0 +1,66 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.ExpandCollapseTree?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>initial</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeExpandCollapseTree::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]/n[0]/n[0]/n[0]/expand</td>
+ <td>6,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeExpandCollapseTree::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]/n[0]/n[0]/expand</td>
+ <td>9,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeExpandCollapseTree::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[1]/expand</td>
+ <td>9,10</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>collapsed-1-6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeExpandCollapseTree::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]/n[0]/n[0]/expand</td>
+ <td>9,9</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>collapsed-1-7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeExpandCollapseTree::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]/n[0]/n[0]/n[0]/expand</td>
+ <td>8,9</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>collapsed-1</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.java b/uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.java
new file mode 100644
index 0000000000..d5c3654b4e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/ExpandCollapseTree.java
@@ -0,0 +1,120 @@
+package com.vaadin.tests.components.tree;
+
+import java.util.Set;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Tree;
+
+public class ExpandCollapseTree extends TestBase {
+
+ private final Tree tree = new Tree();
+ private final Label valueLbl = new Label("No selection");
+
+ @Override
+ protected void setup() {
+
+ getLayout().setSpacing(true);
+
+ tree.setContainerDataSource(createContainer());
+ tree.setItemCaptionPropertyId("name");
+ tree.setWidth("300px");
+ tree.setImmediate(true);
+ tree.setSelectable(true);
+ tree.setMultiSelect(true);
+ tree.expandItemsRecursively("Item 1");
+ tree.expandItemsRecursively("Item 4");
+
+ tree.addListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if (tree.getValue() instanceof Set) {
+ @SuppressWarnings("unchecked")
+ // safe cast after instanceof check
+ Set<Object> itemIds = (Set<Object>) tree.getValue();
+ if (itemIds.size() == 0) {
+ valueLbl.setValue("No selection");
+ } else {
+ valueLbl.setValue(itemIds);
+ }
+ } else {
+ valueLbl.setValue(tree.getValue());
+ }
+ }
+ });
+
+ addComponent(tree);
+
+ valueLbl.setWidth("300px");
+ valueLbl.setHeight("600px");
+ addComponent(valueLbl);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Test collapsing and expansion of tree nodes";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5439;
+ }
+
+ 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;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/ItemStyleGenerator.java b/uitest/src/com/vaadin/tests/components/tree/ItemStyleGenerator.java
new file mode 100644
index 0000000000..33bd4cef65
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/ItemStyleGenerator.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CustomLayout;
+import com.vaadin.ui.Tree;
+
+public class ItemStyleGenerator extends TestBase {
+
+ private Component styles;
+ private String css = "<style type=\"text/css\">"
+ + ".v-tree-node-red {color: red;}"
+ + ".v-tree-node-green {color: green;}"
+ + ".v-tree-node-caption-blue {color:blue;}" //
+ + "</style>";
+
+ @Override
+ protected String getDescription() {
+ return "Item Style generator can be used to style items.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3070;
+ }
+
+ @Override
+ protected void setup() {
+ styles = new CustomLayout(css);
+ addComponent(styles);
+
+ Tree tree = new Tree();
+
+ tree.setItemStyleGenerator(new Tree.ItemStyleGenerator() {
+ @Override
+ public String getStyle(Object itemId) {
+ // simple return itemId as css style name
+ return itemId.toString();
+ }
+ });
+
+ tree.addItem("red");
+ tree.setChildrenAllowed("red", false);
+ tree.addItem("green");
+ tree.addItem("green children");
+ tree.setParent("green children", "green");
+ tree.addItem("blue");
+ tree.addItem("non-blue-childnode");
+ tree.setParent("non-blue-childnode", "blue");
+
+ addComponent(tree);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.html b/uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.html
new file mode 100644
index 0000000000..7f8bb408aa
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.html
@@ -0,0 +1,27 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.PreselectedTreeVisible</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.java b/uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.java
new file mode 100644
index 0000000000..b812c9e955
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/PreselectedTreeVisible.java
@@ -0,0 +1,36 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Tree;
+
+@SuppressWarnings("serial")
+public class PreselectedTreeVisible extends TestBase {
+
+ @Override
+ protected void setup() {
+
+ String itemId1 = "Item 1";
+ String itemId2 = "Item 2";
+
+ Tree tree = new Tree();
+
+ tree.addItem(itemId1);
+ tree.addItem(itemId2);
+
+ // Removing this line causes the tree to show normally in Firefox
+ tree.select(itemId1);
+ addComponent(tree);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tree should be visible when a item has been selected.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5396;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-base.html b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-base.html
new file mode 100644
index 0000000000..8b9aaab2f7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-base.html
@@ -0,0 +1,36 @@
+<?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&amp;restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>default</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTreeConnectors::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+ <td>7,13</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>connectors</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-chameleon.html b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-chameleon.html
new file mode 100644
index 0000000000..0200c31b4a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-chameleon.html
@@ -0,0 +1,36 @@
+<?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=chameleon&amp;restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>default</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTreeConnectors::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+ <td>7,13</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>connectors</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-reindeer.html b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-reindeer.html
new file mode 100644
index 0000000000..f69dde73e4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-reindeer.html
@@ -0,0 +1,36 @@
+<?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=reindeer&amp;restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>default</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTreeConnectors::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+ <td>7,13</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>connectors</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-runo.html b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-runo.html
new file mode 100644
index 0000000000..46d12bfb9d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors-runo.html
@@ -0,0 +1,36 @@
+<?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=runo&amp;restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>default</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTreeConnectors::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+ <td>7,13</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>connectors</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeConnectors.java b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors.java
new file mode 100644
index 0000000000..ab9bcd9a99
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeConnectors.java
@@ -0,0 +1,142 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.acceptcriteria.AcceptAll;
+import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.Tree.TreeDragMode;
+import com.vaadin.ui.themes.BaseTheme;
+
+@SuppressWarnings("serial")
+public class TreeConnectors extends TestBase {
+
+ private Tree tree = createTree();
+
+ @Override
+ protected void setup() {
+ CheckBox cb = new CheckBox("Connectors");
+ cb.setValue(false);
+ cb.setImmediate(true);
+ cb.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if ((Boolean) event.getProperty().getValue()) {
+ tree.addStyleName(BaseTheme.TREE_CONNECTORS);
+ } else {
+ tree.removeStyleName(BaseTheme.TREE_CONNECTORS);
+ }
+ }
+ });
+ addComponent(cb);
+ addComponent(tree);
+ }
+
+ private Tree createTree() {
+ final Tree tree = new Tree(null, createContainer());
+ tree.setWidth("300px");
+ for (Object rootItems : tree.rootItemIds()) {
+ tree.expandItemsRecursively(rootItems);
+ }
+ tree.setChildrenAllowed("Item 73", false);
+
+ tree.setDragMode(TreeDragMode.NODE);
+ tree.setDropHandler(new DropHandler() {
+
+ @Override
+ public void drop(DragAndDropEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return AcceptAll.get();
+ }
+
+ });
+
+ tree.setItemIcon("Item 1", new ThemeResource(
+ "../runo/icons/32/folder.png"));
+ tree.setItemIcon("Item 3", new ThemeResource(
+ "../runo/icons/32/document.png"));
+ tree.setItemIcon("Item 13", new ThemeResource(
+ "../runo/icons/64/user.png"));
+ tree.setItemIcon("Item 72", new ThemeResource(
+ "../runo/icons/64/users.png"));
+ tree.setItemIcon("Item 17", new ThemeResource(
+ "../runo/icons/16/document-pdf.png"));
+
+ return tree;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The second tree's nodes should be connected with lines indicating the hierarchy. The first tree should be without connectors.";
+ }
+
+ @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;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeContainerChange b/uitest/src/com/vaadin/tests/components/tree/TreeContainerChange
new file mode 100644
index 0000000000..8ea2dcc107
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeContainerChange
@@ -0,0 +1,47 @@
+<?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>TreeContainerChange</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TreeContainerChange</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeContainerChange?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeContainerChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeContainerChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTree[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>24,5</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>ds1-selected-value-ds1-3</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeContainerChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>ds2-selected-value-null</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeContainerChange.java b/uitest/src/com/vaadin/tests/components/tree/TreeContainerChange.java
new file mode 100644
index 0000000000..f4374ca2ee
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeContainerChange.java
@@ -0,0 +1,104 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Tree;
+
+@SuppressWarnings("serial")
+public class TreeContainerChange extends TestBase {
+
+ private Tree tree;
+
+ @Override
+ protected void setup() {
+ final IndexedContainer ds1 = new IndexedContainer();
+ // ds1.addContainerProperty("caption", String.class, "");
+ for (int i = 0; i < 32; i++) {
+ ds1.addItem("ds1-" + i);
+ }
+
+ final IndexedContainer ds2 = new IndexedContainer();
+ // ds2.addContainerProperty("caption", String.class, "");
+ for (int i = 0; i < 32; i++) {
+ ds2.addItem("ds2-" + i);
+ }
+
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.setWidth("100%");
+
+ tree = new Tree();
+ tree.setImmediate(true);
+ hl.addComponent(tree);
+ HorizontalLayout state = new HorizontalLayout();
+ state.setSpacing(true);
+ hl.addComponent(state);
+
+ final Label currentValue = new Label();
+ currentValue.setCaption("Current Value:");
+ currentValue.setSizeUndefined();
+ final Label currentDS = new Label();
+ currentDS.setCaption("Current DS:");
+ currentDS.setSizeUndefined();
+ state.addComponent(currentValue);
+ state.addComponent(currentDS);
+
+ Table t = new Table("ds1");
+ t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
+ t.setContainerDataSource(ds1);
+ state.addComponent(t);
+
+ Button b = new Button("Use ds1");
+ b.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ tree.setContainerDataSource(ds1);
+ currentDS.setValue("ds1");
+ }
+ });
+ state.addComponent(b);
+
+ t = new Table("ds2");
+ t.setContainerDataSource(ds2);
+ t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
+ state.addComponent(t);
+
+ b = new Button("Use ds2");
+ b.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ tree.setContainerDataSource(ds2);
+ currentDS.setValue("ds2");
+ }
+ });
+ state.addComponent(b);
+
+ addComponent(hl);
+
+ tree.addListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ currentValue.setValue(event.getProperty().getValue());
+ }
+ });
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A test for tree and its container changes. Value should be cleared on container change.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5281;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeContextMenuAndIcons.html b/uitest/src/com/vaadin/tests/components/tree/TreeContextMenuAndIcons.html
new file mode 100644
index 0000000000..6f9b5e81c3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeContextMenuAndIcons.html
@@ -0,0 +1,156 @@
+<?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="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.Trees?restartApplication</td>
+ <td></td>
+</tr>
+<!--Hide event log-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_Smenu#item1</td>
+ <td>19,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>32,7</td>
+</tr>
+<!--Simple context menu-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_Smenu#item0</td>
+ <td>28,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>57,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>68,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>69,7</td>
+</tr>
+<tr>
+ <td>contextMenuAt</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>contextmenu-noicon</td>
+</tr>
+<!--Two actions, without and with icon-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_Smenu#item0</td>
+ <td>42,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>52,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>53,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>31,4</td>
+</tr>
+<tr>
+ <td>contextMenuAt</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>caption-only-and-has-icon</td>
+</tr>
+<!--Large icon-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_Smenu#item0</td>
+ <td>42,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>52,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>53,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[2]/VMenuBar[0]#item3</td>
+ <td>31,4</td>
+</tr>
+<tr>
+ <td>contextMenuAt</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>large-icon</td>
+</tr>
+<!--Simple context menu again to ensure it is properly updated (icons removed)-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_Smenu#item0</td>
+ <td>28,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>57,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>68,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>69,7</td>
+</tr>
+<tr>
+ <td>contextMenuAt</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>contextmenu-noicon</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.html b/uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.html
new file mode 100644
index 0000000000..b093bd90d6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.html
@@ -0,0 +1,87 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeDragAndDropFromTable?restartApplication</td>
+ <td></td>
+</tr>
+<!--Dragging row 1 from table to tree Item 1-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>16,12</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[0]</td>
+ <td>29,11</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[0]/n[3]</td>
+ <td>Row 1</td>
+</tr>
+<!--Dragging Row 2 from Table to Tree Item 2-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>23,13</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[1]</td>
+ <td>29,9</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[1]/n[3]</td>
+ <td>Row 2</td>
+</tr>
+<!--Draggin Row 3 from Table to Tree Item 3-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>29,11</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[2]</td>
+ <td>15,4</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[2]/n[3]</td>
+ <td>Row 3</td>
+</tr>
+<!--Trying to drag Row 5 from Table to Tree lead -> Should fail-->
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>30,13</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeDragAndDropFromTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[0]/n[1]</td>
+ <td>29,10</td>
+</tr>
+<!--Table should container 4 rows-->
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>TableHas4RowsLeft</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java b/uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java
new file mode 100644
index 0000000000..7aa3933752
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeDragAndDropFromTable.java
@@ -0,0 +1,120 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Container;
+import com.vaadin.event.DataBoundTransferable;
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractSelect.AbstractSelectTargetDetails;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.TableDragMode;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.Tree.TargetItemAllowsChildren;
+
+public class TreeDragAndDropFromTable extends TestBase {
+
+ @Override
+ protected void setup() {
+
+ HorizontalLayout h = new HorizontalLayout();
+ addComponent(h);
+
+ Table table = new Table();
+ table.addContainerProperty("Column 1", String.class, "Row");
+ table.setDragMode(TableDragMode.ROW);
+
+ table.addItem("Row 1");
+ table.addItem("Row 2");
+ table.addItem("Row 3");
+ table.addItem("Row 4");
+ table.addItem("Row 5");
+ table.addItem("Row 6");
+ table.addItem("Row 7");
+
+ h.addComponent(table);
+
+ final Tree tree = new Tree();
+ tree.setDropHandler(new DropHandler() {
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return TargetItemAllowsChildren.get();
+ }
+
+ @Override
+ public void drop(DragAndDropEvent dropEvent) {
+ // criteria verify that this is safe
+ DataBoundTransferable t = (DataBoundTransferable) dropEvent
+ .getTransferable();
+ Container sourceContainer = t.getSourceContainer();
+ Object sourceItemId = t.getItemId();
+ System.out.println(sourceItemId);
+
+ AbstractSelectTargetDetails dropData = ((AbstractSelectTargetDetails) dropEvent
+ .getTargetDetails());
+ Object targetItemId = dropData.getItemIdOver();
+
+ // move item from table to category'
+ tree.addItem(sourceItemId);
+ tree.setParent(sourceItemId, targetItemId);
+ tree.setChildrenAllowed(sourceItemId, false);
+ sourceContainer.removeItem(sourceItemId);
+
+ }
+ });
+
+ tree.addItem("Item 1");
+ tree.addItem("Item 11");
+ tree.setChildrenAllowed("Item 11", false);
+ tree.setParent("Item 11", "Item 1");
+ tree.addItem("Item 12");
+ tree.setChildrenAllowed("Item 12", false);
+ tree.setParent("Item 12", "Item 1");
+ tree.addItem("Item 13");
+ tree.setChildrenAllowed("Item 13", false);
+ tree.setParent("Item 13", "Item 1");
+
+ tree.addItem("Item 2");
+ tree.addItem("Item 21");
+ tree.setChildrenAllowed("Item 21", false);
+ tree.setParent("Item 21", "Item 2");
+ tree.addItem("Item 22");
+ tree.setChildrenAllowed("Item 22", false);
+ tree.setParent("Item 22", "Item 2");
+ tree.addItem("Item 23");
+ tree.setChildrenAllowed("Item 23", false);
+ tree.setParent("Item 23", "Item 2");
+
+ tree.addItem("Item 3");
+ tree.addItem("Item 31");
+ tree.setChildrenAllowed("Item 31", false);
+ tree.setParent("Item 31", "Item 3");
+ tree.addItem("Item 32");
+ tree.setChildrenAllowed("Item 32", false);
+ tree.setParent("Item 32", "Item 3");
+ tree.addItem("Item 33");
+ tree.setChildrenAllowed("Item 33", false);
+ tree.setParent("Item 33", "Item 3");
+
+ tree.expandItemsRecursively("Item 1");
+ tree.expandItemsRecursively("Item 2");
+ tree.expandItemsRecursively("Item 3");
+
+ h.addComponent(tree);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Test that childred can be dragged "
+ + "from the Table to the tree and that TargetItemAllowsChildren limits "
+ + "the drops to nodes which allows children";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7687;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.html b/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.html
new file mode 100644
index 0000000000..2b08cdf865
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.html
@@ -0,0 +1,81 @@
+<?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="http://artur-laptop.office.itmill.com:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TreeFiltering</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeFiltering?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>unfiltered</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFiltering::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>all-removed</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFiltering::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>unfiltered</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFiltering::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>filter-0</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFiltering::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td>
+ <td>69,10</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>filter-0-no-parents</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFiltering::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td>
+ <td>69,10</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFiltering::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>all-removed</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java b/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java
new file mode 100644
index 0000000000..be65a335be
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java
@@ -0,0 +1,134 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+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.CheckBox;
+import com.vaadin.ui.Tree;
+
+public class TreeFiltering extends TestBase {
+
+ @Override
+ public void setup() {
+
+ final Tree ccTree = new Tree();
+ addComponent(ccTree);
+ final HierarchicalContainer cont = new HierarchicalContainer();
+ cont.addContainerProperty("caption", String.class, "");
+
+ Item item;
+ for (int i = 0; i < 5; i++) {
+ item = cont.addItem(i);
+ item.getItemProperty("caption").setValue("Number " + i);
+ cont.setParent(i, i - 1);
+ }
+
+ for (int i = 0; i < 5; i++) {
+ Object id = cont.addItem();
+ item = cont.getItem(id);
+ item.getItemProperty("caption").setValue("0-" + i);
+ cont.setParent(id, 0);
+ }
+
+ ccTree.setContainerDataSource(cont);
+ ccTree.setItemCaptionPropertyId("caption");
+
+ for (final Object o : ccTree.getItemIds()) {
+ ccTree.expandItem(o);
+ }
+
+ final CheckBox filterType = new CheckBox(
+ "Include parent when filtering", true);
+ filterType.setImmediate(true);
+ filterType.addListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ cont.setIncludeParentsWhenFiltering((Boolean) ((CheckBox) event
+ .getProperty()).getValue());
+ ccTree.markAsDirty();
+ }
+ });
+ addComponent(filterType);
+
+ final Button b = new Button("Add filter 'foo'", new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ cont.addContainerFilter("caption", "foo", true, false);
+
+ }
+ });
+ addComponent(b);
+ final Button b2 = new Button("Add filter 'Num'", new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ cont.addContainerFilter("caption", "Num", true, false);
+
+ }
+ });
+
+ addComponent(b2);
+ final Button num = new Button("Add filter '0'", new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ cont.addContainerFilter("caption", "0", true, false);
+
+ }
+ });
+
+ addComponent(num);
+ final Button num2 = new Button("Add filter '0-'", new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ cont.addContainerFilter("caption", "0-", true, false);
+
+ }
+ });
+
+ addComponent(num2);
+ final Button num3 = new Button("Add filter 'Number 4'",
+ new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ cont.addContainerFilter("caption", "Number 4", true,
+ false);
+
+ }
+ });
+
+ addComponent(num3);
+ final Button p1 = new Button("Set Number 3 parent to Number 0",
+ new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ cont.setParent(3, 0);
+
+ }
+ });
+ addComponent(p1);
+ final Button r = new Button("Remove filters", new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ cont.removeAllContainerFilters();
+
+ }
+ });
+ addComponent(r);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Filtering in a tree should work as expected. Roots and their children which match the filter should be shown. Other nodes should be hidden";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4192;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.html b/uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.html
new file mode 100644
index 0000000000..74a69ec203
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.html
@@ -0,0 +1,77 @@
+<?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>TreeFocusGaining</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TreeFocusGaining</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeFocusGaining?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
+ <td>57,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
+ <td>57,13</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
+ <td>foo</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTree[0]#n[0]</td>
+ <td>24,12</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::PID_SLog_row_1</td>
+ <td>1. TF value now:foo</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::PID_SLog_row_0</td>
+ <td>2. Tree value now:Item1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
+ <td>-18,10</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
+ <td>bar</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTree[0]#n[0]</td>
+ <td>4,9</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::PID_SLog_row_1</td>
+ <td>3. TF value now:bar</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeFocusGaining::PID_SLog_row_0</td>
+ <td>4. Item click event</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.java b/uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.java
new file mode 100644
index 0000000000..dd407fd62a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeFocusGaining.java
@@ -0,0 +1,65 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Tree;
+
+@SuppressWarnings("serial")
+public class TreeFocusGaining extends TestBase {
+
+ @Override
+ protected void setup() {
+ final Log log = new Log(5);
+
+ TextField textField = new TextField(
+ "My value should get to server when tree is clicked");
+ addComponent(textField);
+ textField.addListener(new Property.ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ log.log("TF value now:" + event.getProperty().getValue());
+ }
+ });
+
+ Tree tree = new Tree("Simple selectable tree (immediate)");
+ tree.addItem("Item1");
+ addComponent(tree);
+ tree.addListener(new Property.ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ log.log("Tree value now:" + event.getProperty().getValue());
+ }
+ });
+ tree.setImmediate(true);
+
+ tree = new Tree("Simple tree with itemm click listener");
+ tree.addItem("Item1");
+ tree.addListener(new ItemClickEvent.ItemClickListener() {
+ @Override
+ public void itemClick(ItemClickEvent event) {
+ log.log("Item click event");
+ }
+ });
+ addComponent(tree);
+
+ addComponent(log);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tree should get focus before sending variables to server.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6374;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.html b/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.html
new file mode 100644
index 0000000000..8e882e215d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.html
@@ -0,0 +1,103 @@
+<?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="http://arturwin.office.itmill.com:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeHorizontalResize?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[0]</td>
+ <td>57,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[0]</td>
+ <td>71,6</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>all-expanded-gx240-focused</td>
+</tr>
+<!--Collapse all tree nodes-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/expand</td>
+ <td>11,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[1]/expand</td>
+ <td>11,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]/expand</td>
+ <td>10,11</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>all-collapsed-nothing-focused</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/expand</td>
+ <td>9,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[0]</td>
+ <td>57,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[0]</td>
+ <td>64,6</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>desktops-expanded-gx240-focused</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[1]/expand</td>
+ <td>6,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]/expand</td>
+ <td>8,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[0]</td>
+ <td>45,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeHorizontalResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[0]</td>
+ <td>57,7</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>all-expanded-gx240-focused-2</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java b/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java
new file mode 100644
index 0000000000..1fa73ccd6d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java
@@ -0,0 +1,87 @@
+package com.vaadin.tests.components.tree;
+
+import java.util.Iterator;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.Tree;
+
+public class TreeHorizontalResize extends TestBase {
+
+ // copied from Sampler to eliminate dependency
+ public static final Object hw_PROPERTY_NAME = "name";
+ public static final Object hw_PROPERTY_ICON = "icon";
+ private static final String[][] hardware = { //
+ { "Desktops", "Dell OptiPlex GX240", "Dell OptiPlex GX260",
+ "Dell OptiPlex GX280" },
+ { "Monitors", "Benq T190HD", "Benq T220HD", "Benq T240HD" },
+ { "Laptops", "IBM ThinkPad T40", "IBM ThinkPad T43",
+ "IBM ThinkPad T60" } };
+
+ @Override
+ protected void setup() {
+ Panel treePanel = new Panel();
+ treePanel.setHeight("500px");
+ treePanel.setWidth(null);
+ treePanel.getContent().setSizeUndefined();
+ addComponent(treePanel);
+
+ Tree tree = new Tree();
+ tree.setContainerDataSource(getHardwareContainer());
+ tree.setItemCaptionPropertyId(hw_PROPERTY_NAME);
+ for (Iterator<?> it = tree.rootItemIds().iterator(); it.hasNext();) {
+ tree.expandItemsRecursively(it.next());
+ }
+ treePanel.addComponent(tree);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The Tree should be properly resized horizontally when collapsing/expanding nodes. The height is fixed to 500px.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6230;
+ }
+
+ public static HierarchicalContainer getHardwareContainer() {
+ Item item = null;
+ int itemId = 0; // Increasing numbering for itemId:s
+
+ // Create new container
+ HierarchicalContainer hwContainer = new HierarchicalContainer();
+ // Create containerproperty for name
+ hwContainer.addContainerProperty(hw_PROPERTY_NAME, String.class, null);
+ // Create containerproperty for icon
+ hwContainer.addContainerProperty(hw_PROPERTY_ICON, ThemeResource.class,
+ new ThemeResource("../runo/icons/16/document.png"));
+ for (int i = 0; i < hardware.length; i++) {
+ // Add new item
+ item = hwContainer.addItem(itemId);
+ // Add name property for item
+ item.getItemProperty(hw_PROPERTY_NAME).setValue(hardware[i][0]);
+ // Allow children
+ hwContainer.setChildrenAllowed(itemId, true);
+ itemId++;
+ for (int j = 1; j < hardware[i].length; j++) {
+ if (j == 1) {
+ item.getItemProperty(hw_PROPERTY_ICON).setValue(
+ new ThemeResource("../runo/icons/16/folder.png"));
+ }
+ // Add child items
+ item = hwContainer.addItem(itemId);
+ item.getItemProperty(hw_PROPERTY_NAME).setValue(hardware[i][j]);
+ hwContainer.setParent(itemId, itemId - j);
+ hwContainer.setChildrenAllowed(itemId, false);
+
+ itemId++;
+ }
+ }
+ return hwContainer;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html
new file mode 100644
index 0000000000..bf83a1acdb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html
@@ -0,0 +1,82 @@
+<?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>TreeItemClickAndValueChange</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TreeItemClickAndValueChange</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/Trees?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::PID_Smenu#item0</td>
+ <td>19,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>23,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>38,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::PID_Smenu#item0</td>
+ <td>52,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>53,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>50,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::PID_StestComponent#n[0]</td>
+ <td>22,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runTrees::PID_StestComponent#n[1]</td>
+ <td>20,6</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runTrees::PID_SLog_row_0</td>
+ <td>5. ValueChangeEvent, new value: '[Item 2]'</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runTrees::PID_SLog_row_1</td>
+ <td>4. left click on source: [Item 1], client: [*];, relative: [-1,-1], itemId: Item 2, propertyId: null</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runTrees::PID_SLog_row_2</td>
+ <td>3. ValueChangeEvent, new value: '[Item 1]'</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runTrees::PID_SLog_row_3</td>
+ <td>2. left click on source: [], client: [*];, relative: [-1,-1], itemId: Item 1, propertyId: null</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.html b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.html
new file mode 100644
index 0000000000..841565df2f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.html
@@ -0,0 +1,81 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeItemClickListening?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]</td>
+ <td>36,7</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::PID_SLog_row_0</td>
+ <td>1. Left Click</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[1]</td>
+ <td>45,7</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::PID_SLog_row_0</td>
+ <td>2. Left Click</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]</td>
+ <td>37,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::PID_SLog_row_0</td>
+ <td>3. Left Click</td>
+</tr>
+<tr>
+ <td>mouseDownRight</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[3]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseUpRight</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[3]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::PID_SLog_row_0</td>
+ <td>4. Right Click</td>
+</tr>
+<tr>
+ <td>mouseDownRight</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[4]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseUpRight</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[4]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeItemClickListening::PID_SLog_row_0</td>
+ <td>5. Right Click</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java
new file mode 100644
index 0000000000..182bc97c44
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java
@@ -0,0 +1,62 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Tree;
+
+public class TreeItemClickListening extends TestBase {
+
+ private int clickCounter = 0;
+
+ private Log log = new Log(5);
+
+ @Override
+ protected void setup() {
+
+ Tree tree = new Tree();
+ tree.setImmediate(true);
+
+ tree.addContainerProperty("caption", String.class, "");
+ for (int i = 1; i <= 10; i++) {
+ String item = "Node " + i;
+ tree.addItem(item);
+ tree.getContainerProperty(item, "caption").setValue("Caption " + i);
+ tree.setChildrenAllowed(item, false);
+ }
+ tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
+ tree.setItemCaptionPropertyId("caption");
+
+ tree.addListener(new ItemClickEvent.ItemClickListener() {
+ @Override
+ public void itemClick(ItemClickEvent event) {
+ clickCounter++;
+ switch (event.getButton()) {
+ case ItemClickEvent.BUTTON_LEFT:
+ log.log("Left Click");
+ break;
+ case ItemClickEvent.BUTTON_RIGHT:
+ log.log("Right Click");
+ break;
+ case ItemClickEvent.BUTTON_MIDDLE:
+ log.log("Middle Click");
+ break;
+ }
+ }
+ });
+
+ addComponent(tree);
+ addComponent(log);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Item click event should be triggered from all mouse button clicks";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6845;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScroll.html b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScroll.html
new file mode 100644
index 0000000000..0f0db2b71e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScroll.html
@@ -0,0 +1,87 @@
+<?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>TreeKeyboardNavigationScroll</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeKeyboardNavigationScrolls?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]</td>
+ <td>6,7</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>right</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>right</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>right</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationScrolls::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>noscroll</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java
new file mode 100644
index 0000000000..ff3e52505f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.AlwaysFailValidator;
+import com.vaadin.ui.Tree;
+
+public class TreeKeyboardNavigationScrolls extends TestBase {
+
+ @Override
+ protected void setup() {
+ Tree tree = new Tree();
+ tree.setContainerDataSource(generateHierarchicalContainer());
+ tree.setImmediate(true);
+ tree.addValidator(new AlwaysFailValidator("failed"));
+ addComponent(tree);
+ }
+
+ private Container generateHierarchicalContainer() {
+ HierarchicalContainer cont = new HierarchicalContainer();
+ for (int i = 1; i < 6; i++) {
+ cont.addItem(i);
+ for (int j = 1; j < 3; j++) {
+ String id = i
+ + " foo bar baz make this node really wide so that we don't have to fiddle with resizing the browser window -> "
+ + "what would you do if you had one of your legs on backwards? it's legs time! everybody get your legs! "
+ + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore "
+ + "et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut "
+ + "aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum "
+ + "dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui "
+ + "officia deserunt mollit anim id est laborum." + j;
+ cont.addItem(id);
+ cont.setChildrenAllowed(id, false);
+ cont.setParent(id, i);
+ }
+ }
+ return cont;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The tree scrolls right if the focused node is too wide when navigating with the keyboard";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7230;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.html b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.html
new file mode 100644
index 0000000000..2439079d09
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.html
@@ -0,0 +1,97 @@
+<?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>TreeKeyboardNavigationValidators</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeKeyboardNavigationValidators?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]</td>
+ <td>7,10</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>right</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>right</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>right</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeKeyboardNavigationValidators::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#fe</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>5-2-sel</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.java b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.java
new file mode 100644
index 0000000000..9204f0495b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationValidators.java
@@ -0,0 +1,49 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.AlwaysFailValidator;
+import com.vaadin.ui.Tree;
+
+public class TreeKeyboardNavigationValidators extends TestBase {
+
+ @Override
+ protected void setup() {
+ addComponent(getTree());
+ }
+
+ private Tree getTree() {
+ Tree tree = new Tree();
+ tree.setSizeFull();
+ tree.setContainerDataSource(generateHierarchicalContainer());
+ tree.setImmediate(true);
+ tree.addValidator(new AlwaysFailValidator("failed"));
+ return tree;
+ }
+
+ private Container generateHierarchicalContainer() {
+ HierarchicalContainer cont = new HierarchicalContainer();
+ for (int i = 1; i < 6; i++) {
+ cont.addItem(i);
+ for (int j = 1; j < 3; j++) {
+ String id = i + " -> " + j;
+ cont.addItem(id);
+ cont.setChildrenAllowed(id, false);
+ cont.setParent(id, i);
+ }
+ }
+ return cont;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Keyboard navigation should still work in a tree with validators.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7057;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.html b/uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.html
new file mode 100644
index 0000000000..f98482f4c7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.html
@@ -0,0 +1,42 @@
+<?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>TreeNodeCaptionWrapping</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TreeNodeCaptionWrapping</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeNodeCaptionWrapping</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>A very long item that should not wrap</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Subitem - also long</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.java b/uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.java
new file mode 100644
index 0000000000..f885e1d1da
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Tree;
+
+public class TreeNodeCaptionWrapping extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The text should not wrap to the following line but instead be cut off when there is too little horizontal space.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3098;
+ }
+
+ @Override
+ protected void setup() {
+ setTheme("runo");
+ Tree tree = new Tree();
+ tree.setWidth("100px");
+
+ tree.addItem("1");
+ tree.setItemIcon("1", new ThemeResource("../runo/icons/16/ok.png"));
+
+ String mainItem = "A very long item that should not wrap";
+ String subItem = "Subitem - also long";
+
+ tree.addItem(mainItem);
+ tree.setItemIcon(mainItem, new ThemeResource(
+ "../runo/icons/16/error.png"));
+
+ tree.addItem(subItem);
+ tree.setParent(subItem, mainItem);
+
+ tree.expandItem("1");
+ tree.expandItem(mainItem);
+ tree.expandItem(subItem);
+
+ addComponent(tree);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreePerformanceTest.java b/uitest/src/com/vaadin/tests/components/tree/TreePerformanceTest.java
new file mode 100644
index 0000000000..892b7e669a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreePerformanceTest.java
@@ -0,0 +1,75 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
+
+public class TreePerformanceTest extends AbstractTestCase {
+
+ @Override
+ protected String getDescription() {
+ return "Trees rendering type may become slow escpecially with FF and big tree in a deep component tree.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ @Override
+ public void init() {
+ LegacyWindow w = new LegacyWindow();
+ setMainWindow(w);
+
+ Layout layout = null;
+
+ for (int i = 0; i < getLayoutCount(); i++) {
+ Layout newlayout = createLayout();
+ // newlayout.setHeight("100%");
+ if (i == 0) {
+ w.setContent(newlayout);
+ } else {
+ layout.addComponent(newlayout);
+ }
+ layout = newlayout;
+ }
+
+ Tree tree = new Tree();
+
+ for (int i = 0; i < getItemCount(); i++) {
+ String text = "ITEM " + i;
+ tree.addItem(text);
+ for (int j = 0; j < getSubItemCount(); j++) {
+ String subtext = " SUBITEM " + j + " for " + text;
+ tree.addItem(subtext);
+ tree.setParent(subtext, text);
+ }
+ tree.expandItemsRecursively(text);
+ }
+
+ // One can test that the slugginesh is actually verticallayout issue
+ // Table testTable = TestForTablesInitialColumnWidthLogicRendering
+ // .getTestTable(12, 60);
+ // testTable.setPageLength(0);
+ layout.addComponent(tree);
+
+ }
+
+ private Layout createLayout() {
+ return new VerticalLayout();
+ }
+
+ private int getLayoutCount() {
+ return 10;
+ }
+
+ private int getSubItemCount() {
+ return 3;
+ }
+
+ private int getItemCount() {
+ return 200;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrolling.html b/uitest/src/com/vaadin/tests/components/tree/TreeScrolling.html
new file mode 100644
index 0000000000..880d52ed75
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrolling.html
@@ -0,0 +1,36 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeScrolling?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>initial</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeScrolling::/VVerticalLayout[0]/ChildComponentContainer[2]/VTree[0]#n[0]/n[14]</td>
+ <td>67,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>selected-0-14</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrolling.java b/uitest/src/com/vaadin/tests/components/tree/TreeScrolling.java
new file mode 100644
index 0000000000..70c2d5d433
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrolling.java
@@ -0,0 +1,54 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
+
+public class TreeScrolling extends AbstractTestCase {
+
+ @Override
+ public void init() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setSizeUndefined();
+ LegacyWindow w = new LegacyWindow("", layout);
+ setMainWindow(w);
+
+ TextField filler1 = new TextField();
+ RichTextArea filler2 = new RichTextArea();
+ Tree tree = new Tree();
+ for (int i = 0; i < 20; i++) {
+ String parentId = "Item " + i;
+ // Item parentItem =
+ tree.addItem(parentId);
+ for (int j = 0; j < 20; j++) {
+ String subId = "Item " + i + " - " + j;
+ // Item subItem =
+ tree.addItem(subId);
+ tree.setParent(subId, parentId);
+ }
+
+ }
+
+ for (Object id : tree.rootItemIds()) {
+ tree.expandItemsRecursively(id);
+ }
+
+ layout.addComponent(filler1);
+ layout.addComponent(filler2);
+ layout.addComponent(tree);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tests what happens when a tree is partly out of view when an item is selected";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5400;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.html b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.html
new file mode 100644
index 0000000000..bd8e944c32
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.html
@@ -0,0 +1,76 @@
+<?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="http://arturwin.office.itmill.com:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeScrollingOnSelection?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeScrollingOnSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[4]</td>
+ <td>32,7</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>epsilon-selected</td>
+</tr>
+<tr>
+ <td>scroll</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeScrollingOnSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/domChild[1]</td>
+ <td>256</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>300</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeScrollingOnSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[21]</td>
+ <td>18,-245</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>scrolled-down-chi-selected</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeScrollingOnSelection?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>scroll</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeScrollingOnSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/domChild[1]</td>
+ <td>500</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>300</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeScrollingOnSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/n[11]</td>
+ <td>14,-248</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>scrolled-down-my-selected</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java
new file mode 100644
index 0000000000..b3ab5c2b01
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java
@@ -0,0 +1,72 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.Tree;
+
+public class TreeScrollingOnSelection extends TestBase {
+ private static final long serialVersionUID = 4082075610259697145L;
+
+ private static final String GREEK_ALPHABET = "greek alphabet";
+
+ private static final String[] ALPHABET = { "Alpha", "Beta", "Gamma",
+ "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa",
+ "Lambda", "My", "Ny", "Xi", "Omikron", "Pi", "Rho", "Sigma", "Tau",
+ "Ypsilon", "Phi", "Chi", "Psi", "Omega" };
+
+ @Override
+ public void setup() {
+ final Label charLabel = new Label();
+ charLabel.setWidth("200px");
+
+ Tree tree = new Tree("alphabets", getContainer());
+ tree.expandItem(GREEK_ALPHABET);
+ tree.addListener(new ItemClickListener() {
+
+ private static final long serialVersionUID = 5955518276555388126L;
+
+ @Override
+ public void itemClick(ItemClickEvent event) {
+ charLabel.setValue(event.getItemId().toString());
+ }
+ });
+ tree.setImmediate(true);
+
+ Panel panel = new Panel();
+ panel.addComponent(tree);
+ panel.setWidth("200px");
+ panel.setHeight("300px");
+
+ addComponent(panel);
+
+ addComponent(charLabel);
+ }
+
+ private HierarchicalContainer getContainer() {
+ HierarchicalContainer container = new HierarchicalContainer();
+
+ container.addItem(GREEK_ALPHABET);
+
+ for (String character : ALPHABET) {
+ container.addItem(character);
+ container.setChildrenAllowed(character, false);
+ container.setParent(character, GREEK_ALPHABET);
+ }
+
+ return container;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Selecting an item in the tree inside the Panel should not cause the panel scroll position to change.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6731;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeShiftMultiSelectNodes.html b/uitest/src/com/vaadin/tests/components/tree/TreeShiftMultiSelectNodes.html
new file mode 100644
index 0000000000..53709b2a64
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeShiftMultiSelectNodes.html
@@ -0,0 +1,47 @@
+<?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="http://localhost:8067" />
+<title>TreeShiftMultiSelectNodes</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TreeShiftMultiSelectNodes</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.Trees/?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]/expand</td>
+ <td>9,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]/n[2]/expand</td>
+ <td>9,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]/n[0]</td>
+ <td>23,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTrees::PID_StestComponent#n[1]/n[2]/n[1]</td>
+ <td>28,8:shift</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>all-items-inside-selection-are-selected</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeToolTips.java b/uitest/src/com/vaadin/tests/components/tree/TreeToolTips.java
new file mode 100644
index 0000000000..4b892c2150
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeToolTips.java
@@ -0,0 +1,90 @@
+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.AbstractSelect;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Tree;
+
+public class TreeToolTips extends TestBase {
+
+ @Override
+ protected void setup() {
+ final Tree tree = new Tree(null, createContainer());
+ tree.setItemDescriptionGenerator(new AbstractSelect.ItemDescriptionGenerator() {
+ @Override
+ public String generateDescription(Component source, Object itemId,
+ Object propertyId) {
+ return "This is a tooltip for item id '" + itemId + "'";
+ }
+ });
+
+ for (Object rootItems : tree.rootItemIds())
+ tree.expandItemsRecursively(rootItems);
+
+ addComponent(tree);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tree items should have tooltips";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6637;
+ }
+
+ 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;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeTooltip.html b/uitest/src/com/vaadin/tests/components/tree/TreeTooltip.html
new file mode 100644
index 0000000000..afebdaacd5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeTooltip.html
@@ -0,0 +1,52 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeToolTips?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeToolTips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]</td>
+ <td>20,9</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td>1000</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeToolTips::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>This is a tooltip for item id 'Item 0'</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeToolTips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[2]/n[0]/n[0]/n[0]</td>
+ <td>25,8</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td>1000</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeToolTips::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>This is a tooltip for item id 'Item 7'</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.html b/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.html
new file mode 100644
index 0000000000..0b01807054
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.html
@@ -0,0 +1,62 @@
+<?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>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.TreeWithIcons?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>large-icon</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeWithIcons::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[0]/expand</td>
+ <td>9,6</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>two-large-icons</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeTreeWithIcons::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTree[0]#n[1]/expand</td>
+ <td>8,9</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>huge-and-two-large-icons</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java b/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java
new file mode 100644
index 0000000000..99618c0e5d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java
@@ -0,0 +1,69 @@
+package com.vaadin.tests.components.tree;
+
+import java.util.Date;
+
+import com.vaadin.server.Sizeable;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.LoremIpsum;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.themes.Reindeer;
+
+public class TreeWithIcons extends TestBase {
+
+ @Override
+ protected void setup() {
+ ThemeResource notCachedFolderIconHuge = new ThemeResource(
+ "../runo/icons/64/folder.png?" + new Date().getTime());
+ ThemeResource notCachedFolderIconLarge = new ThemeResource(
+ "../runo/icons/32/folder.png?" + new Date().getTime());
+ ThemeResource notCachedFolderIconLargeOther = new ThemeResource(
+ "../runo/icons/32/ok.png?" + new Date().getTime());
+ Tree t = new Tree();
+ t.setImmediate(true);
+
+ t.addItem("Root 1");
+ t.addItem("Root 11");
+ t.addItem("Root 111");
+ t.addItem("Root 1111");
+ t.addItem("Sub 1");
+ t.setItemIcon("Sub 1", notCachedFolderIconLargeOther);
+ t.setParent("Sub 1", "Root 1");
+ String longItemId = LoremIpsum.get(50);
+ t.addItem(longItemId);
+ t.setItemIcon(longItemId, notCachedFolderIconHuge);
+ t.setParent(longItemId, "Root 11");
+ t.addItem("abcdefghijklmn");
+
+ String first = "abcdefghijklmnop";
+ String second = "abcdefghijklmnopqrst";
+ t.addItem(first);
+ t.addItem(second);
+ t.setParent(second, first);
+ t.setItemIcon(first, notCachedFolderIconLarge);
+
+ HorizontalLayout hlay = new HorizontalLayout();
+ hlay.setStyleName(Reindeer.LAYOUT_BLUE);
+ hlay.addComponent(t);
+ hlay.setWidth(-1, Sizeable.UNITS_PIXELS);
+
+ Panel p = new Panel();
+ p.setSizeUndefined();
+ p.setContent(hlay);
+
+ addComponent(p);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A tree with icons should resize itself correctly so the nodes are not cut either horizontally or vertically.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3529;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeWithPreselectedItemNotShown.java b/uitest/src/com/vaadin/tests/components/tree/TreeWithPreselectedItemNotShown.java
new file mode 100644
index 0000000000..8da6759b20
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeWithPreselectedItemNotShown.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.Window;
+
+public class TreeWithPreselectedItemNotShown extends TestBase {
+
+ @Override
+ protected void setup() {
+ Button open = new Button("Open modal window with tree",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ getMainWindow().addWindow(new SubwindowWithTree());
+ }
+ });
+
+ addComponent(open);
+ }
+
+ private class SubwindowWithTree extends Window {
+
+ private SubwindowWithTree() {
+ super("Tree here");
+
+ String itemId1 = "Item 1";
+ String itemId2 = "Item 2";
+
+ Tree tree = new Tree();
+
+ tree.addItem(itemId1);
+ tree.addItem(itemId2);
+
+ // todo error here
+ tree.select(itemId1);
+
+ addComponent(tree);
+ }
+ }
+
+ @Override
+ protected String getDescription() {
+ return "IE8 doesn't display a tree if an item has been selected before the tree becomes visible";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6878;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/Trees.java b/uitest/src/com/vaadin/tests/components/tree/Trees.java
new file mode 100644
index 0000000000..3ee1d7b0de
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/Trees.java
@@ -0,0 +1,407 @@
+package com.vaadin.tests.components.tree;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Hierarchical;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.tests.components.select.AbstractSelectTestCase;
+import com.vaadin.ui.AbstractSelect.MultiSelectMode;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.Tree.CollapseEvent;
+import com.vaadin.ui.Tree.CollapseListener;
+import com.vaadin.ui.Tree.ExpandEvent;
+import com.vaadin.ui.Tree.ExpandListener;
+import com.vaadin.ui.Tree.ItemStyleGenerator;
+
+public class Trees extends AbstractSelectTestCase<Tree> implements
+ ExpandListener, CollapseListener {
+
+ private int rootItemIds = 3;
+
+ private ItemStyleGenerator rootGreenSecondLevelRed = new com.vaadin.ui.Tree.ItemStyleGenerator() {
+
+ @Override
+ public String getStyle(Object itemId) {
+ Hierarchical c = (Container.Hierarchical) getComponent()
+ .getContainerDataSource();
+ if (c.isRoot(itemId)) {
+ return "green";
+ }
+
+ Object parent = c.getParent(itemId);
+ if (!c.isRoot(parent)) {
+ return "red";
+ }
+
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return "Root green, second level red";
+ };
+
+ };
+
+ private ItemStyleGenerator evenItemsBold = new com.vaadin.ui.Tree.ItemStyleGenerator() {
+
+ @Override
+ public String getStyle(Object itemId) {
+ Hierarchical c = (Container.Hierarchical) getComponent()
+ .getContainerDataSource();
+ int idx = 0;
+
+ for (Iterator<?> i = c.getItemIds().iterator(); i.hasNext();) {
+ Object id = i.next();
+ if (id == itemId) {
+ if (idx % 2 == 1) {
+ return "bold";
+ } else {
+ return null;
+ }
+ }
+
+ idx++;
+ }
+
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return "Even items bold";
+ };
+
+ };
+
+ private Command<Tree, ContextMenu> contextMenuCommand = new Command<Tree, ContextMenu>() {
+
+ @Override
+ public void execute(Tree c, final ContextMenu value, Object data) {
+ c.removeAllActionHandlers();
+ if (value != null) {
+ c.addActionHandler(new Handler() {
+
+ @Override
+ public void handleAction(Action action, Object sender,
+ Object target) {
+ log("Action " + action.getCaption() + " performed on "
+ + target);
+ }
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ return value.getActions(target, sender);
+ }
+ });
+ }
+ }
+ };
+
+ @Override
+ protected Class<Tree> getTestClass() {
+ return Tree.class;
+ }
+
+ @Override
+ protected void createActions() {
+ super.createActions();
+
+ // Causes container changes so doing this first..
+ createRootItemSelectAction(CATEGORY_DATA_SOURCE);
+
+ createExpandCollapseActions(CATEGORY_FEATURES);
+ createSelectionModeSelect(CATEGORY_SELECTION);
+ createChildrenAllowedAction(CATEGORY_DATA_SOURCE);
+
+ createListeners(CATEGORY_LISTENERS);
+ createItemStyleGenerator(CATEGORY_FEATURES);
+ createContextMenuAction(CATEGORY_FEATURES);
+ // TODO: DropHandler
+ // TODO: DragMode
+ // TODO: ActionHandler
+
+ }
+
+ private void createContextMenuAction(String category) {
+ LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<String, ContextMenu>();
+ options.put("None", null);
+ options.put("Item without icon", new ContextMenu("No icon", null));
+ ContextMenu cm = new ContextMenu();
+ cm.addItem("Caption only", null);
+ cm.addItem("Has icon", ICON_16_USER_PNG_UNCACHEABLE);
+ options.put("With and without icon", cm);
+ options.put("Only one large icon", new ContextMenu("Icon",
+ ICON_64_EMAIL_REPLY_PNG_UNCACHEABLE));
+
+ createSelectAction("Context menu", category, options, "None",
+ contextMenuCommand, true);
+ }
+
+ private void createItemStyleGenerator(String category) {
+
+ LinkedHashMap<String, com.vaadin.ui.Tree.ItemStyleGenerator> options = new LinkedHashMap<String, com.vaadin.ui.Tree.ItemStyleGenerator>();
+
+ options.put("-", null);
+ options.put(rootGreenSecondLevelRed.toString(), rootGreenSecondLevelRed);
+ options.put(evenItemsBold.toString(), evenItemsBold);
+
+ createSelectAction("Item Style generator", category, options, "-",
+ itemStyleGeneratorCommand);
+
+ }
+
+ private void createListeners(String category) {
+ createBooleanAction("Expand listener", category, false,
+ expandListenerCommand);
+ createBooleanAction("Collapse listener", category, false,
+ collapseListenerCommand);
+ createBooleanAction("Item click listener", category, false,
+ itemClickListenerCommand);
+
+ }
+
+ private enum SelectMode {
+ NONE, SINGLE, MULTI_SIMPLE, MULTI;
+ }
+
+ protected void createSelectionModeSelect(String category) {
+ LinkedHashMap<String, SelectMode> options = new LinkedHashMap<String, SelectMode>();
+ options.put("None", SelectMode.NONE);
+ options.put("Single", SelectMode.SINGLE);
+ options.put("Multi - simple", SelectMode.MULTI_SIMPLE);
+ options.put("Multi - ctrl/shift", SelectMode.MULTI);
+
+ createSelectAction("Selection Mode", category, options,
+ "Multi - ctrl/shift", new Command<Tree, SelectMode>() {
+
+ @Override
+ public void execute(Tree t, SelectMode value, Object data) {
+ switch (value) {
+ case NONE:
+ t.setSelectable(false);
+ break;
+ case SINGLE:
+ t.setMultiSelect(false);
+ t.setSelectable(true);
+ break;
+ case MULTI_SIMPLE:
+ t.setSelectable(true);
+ t.setMultiSelect(true);
+ t.setMultiselectMode(MultiSelectMode.SIMPLE);
+ break;
+ case MULTI:
+ t.setSelectable(true);
+ t.setMultiSelect(true);
+ t.setMultiselectMode(MultiSelectMode.DEFAULT);
+ break;
+ }
+ }
+ });
+ }
+
+ @Override
+ protected Container createContainer(int properties, int items) {
+ return createHierarchicalContainer(properties, items, rootItemIds);
+ }
+
+ private Container.Hierarchical createHierarchicalContainer(int properties,
+ int items, int roots) {
+ Container.Hierarchical c = new HierarchicalContainer();
+
+ populateContainer(c, properties, items);
+
+ if (items <= roots) {
+ return c;
+ }
+
+ // "roots" roots, each with
+ // "firstLevel" children, two with no children (one with childAllowed,
+ // one without)
+ // ("firstLevel"-2)*"secondLevel" children ("secondLevel"/2 with
+ // childAllowed, "secondLevel"/2 without)
+
+ // N*M+N*(M-2)*C = items
+ // items=N(M+MC-2C)
+
+ // Using secondLevel=firstLevel/2 =>
+ // items = roots*(firstLevel+firstLevel*firstLevel/2-2*firstLevel/2)
+ // =roots*(firstLevel+firstLevel^2/2-firstLevel)
+ // = roots*firstLevel^2/2
+ // => firstLevel = sqrt(items/roots*2)
+
+ int firstLevel = (int) Math.ceil(Math.sqrt(items / roots * 2.0));
+ int secondLevel = firstLevel / 2;
+
+ while (roots * (1 + 2 + (firstLevel - 2) * secondLevel) < items) {
+ // Increase something so we get enough items
+ secondLevel++;
+ }
+
+ List<Object> itemIds = new ArrayList<Object>(c.getItemIds());
+
+ int nextItemId = roots;
+ for (int rootIndex = 0; rootIndex < roots; rootIndex++) {
+ // roots use items 0..roots-1
+ Object rootItemId = itemIds.get(rootIndex);
+
+ // force roots to be roots even though they automatically should be
+ c.setParent(rootItemId, null);
+
+ for (int firstLevelIndex = 0; firstLevelIndex < firstLevel; firstLevelIndex++) {
+ if (nextItemId >= items) {
+ break;
+ }
+ Object firstLevelItemId = itemIds.get(nextItemId++);
+ c.setParent(firstLevelItemId, rootItemId);
+
+ if (firstLevelIndex < 2) {
+ continue;
+ }
+
+ // firstLevelChildren 2.. have child nodes
+ for (int secondLevelIndex = 0; secondLevelIndex < secondLevel; secondLevelIndex++) {
+ if (nextItemId >= items) {
+ break;
+ }
+
+ Object secondLevelItemId = itemIds.get(nextItemId++);
+ c.setParent(secondLevelItemId, firstLevelItemId);
+ }
+ }
+ }
+
+ return c;
+ }
+
+ private void createRootItemSelectAction(String category) {
+ LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
+ for (int i = 1; i <= 10; i++) {
+ options.put(String.valueOf(i), i);
+ }
+ options.put("20", 20);
+ options.put("50", 50);
+ options.put("100", 100);
+
+ createSelectAction("Number of root items", category, options, "3",
+ rootItemIdsCommand);
+ }
+
+ private void createExpandCollapseActions(String category) {
+ LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+
+ for (Object id : getComponent().getItemIds()) {
+ options.put(id.toString(), id);
+ }
+ createMultiClickAction("Expand", category, options, expandItemCommand,
+ null);
+ createMultiClickAction("Expand recursively", category, options,
+ expandItemRecursivelyCommand, null);
+ createMultiClickAction("Collapse", category, options,
+ collapseItemCommand, null);
+
+ }
+
+ private void createChildrenAllowedAction(String category) {
+ LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+
+ for (Object id : getComponent().getItemIds()) {
+ options.put(id.toString(), id);
+ }
+ createMultiToggleAction("Children allowed", category, options,
+ setChildrenAllowedCommand, true);
+
+ }
+
+ /*
+ * COMMANDS
+ */
+ private Command<Tree, Integer> rootItemIdsCommand = new Command<Tree, Integer>() {
+
+ @Override
+ public void execute(Tree c, Integer value, Object data) {
+ rootItemIds = value;
+ updateContainer();
+ }
+ };
+
+ private Command<Tree, Object> expandItemCommand = new Command<Tree, Object>() {
+
+ @Override
+ public void execute(Tree c, Object itemId, Object data) {
+ c.expandItem(itemId);
+ }
+ };
+ private Command<Tree, Object> expandItemRecursivelyCommand = new Command<Tree, Object>() {
+
+ @Override
+ public void execute(Tree c, Object itemId, Object data) {
+ c.expandItemsRecursively(itemId);
+ }
+ };
+
+ private Command<Tree, Object> collapseItemCommand = new Command<Tree, Object>() {
+
+ @Override
+ public void execute(Tree c, Object itemId, Object data) {
+ c.collapseItem(itemId);
+ }
+ };
+
+ private Command<Tree, Boolean> setChildrenAllowedCommand = new Command<Tree, Boolean>() {
+
+ @Override
+ public void execute(Tree c, Boolean areChildrenAllowed, Object itemId) {
+ c.setChildrenAllowed(itemId, areChildrenAllowed);
+ }
+ };
+
+ private Command<Tree, Boolean> expandListenerCommand = new Command<Tree, Boolean>() {
+ @Override
+ public void execute(Tree c, Boolean value, Object data) {
+ if (value) {
+ c.addListener((ExpandListener) Trees.this);
+ } else {
+ c.removeListener((ExpandListener) Trees.this);
+ }
+ }
+ };
+
+ private Command<Tree, Boolean> collapseListenerCommand = new Command<Tree, Boolean>() {
+ @Override
+ public void execute(Tree c, Boolean value, Object data) {
+ if (value) {
+ c.addListener((CollapseListener) Trees.this);
+ } else {
+ c.removeListener((CollapseListener) Trees.this);
+ }
+ }
+ };
+
+ private Command<Tree, com.vaadin.ui.Tree.ItemStyleGenerator> itemStyleGeneratorCommand = new Command<Tree, com.vaadin.ui.Tree.ItemStyleGenerator>() {
+
+ @Override
+ public void execute(Tree c,
+ com.vaadin.ui.Tree.ItemStyleGenerator value, Object data) {
+ c.setItemStyleGenerator(value);
+
+ }
+ };
+
+ @Override
+ public void nodeCollapse(CollapseEvent event) {
+ log(event.getClass().getSimpleName() + ": " + event.getItemId());
+ }
+
+ @Override
+ public void nodeExpand(ExpandEvent event) {
+ log(event.getClass().getSimpleName() + ": " + event.getItemId());
+ }
+
+}