.v-tree-node-caption:focus {
outline: none;
}
+div.v-tree-node-leaf {
+ background: transparent;
+}
+.v-tree-connectors .v-tree-node-leaf,
+.v-tree-connectors .v-tree-node-leaf:hover {
+ background: transparent url(img/connector-item.png) no-repeat 8px 0;
+}
+.v-tree-connectors .v-tree-node-leaf-last,
+.v-tree-connectors .v-tree-node-leaf-last:hover {
+ background: transparent url(img/connector-item-last.png) no-repeat 8px 0;
+}
.v-tree-node-expanded {
- background-position: -5px -10px;
+ background: transparent url(../common/img/sprites.png) no-repeat -5px -10px;
}
-div.v-tree-node-leaf {
+.v-tree-connectors .v-tree-node-children {
+ background: transparent url(img/connector.png) repeat-y 8px bottom;
+}
+.v-tree-connectors .v-tree-node-children-last {
background: transparent;
}
.v-tree-node-caption {
childTree.childNodeContainer.addStyleDependentName("root");
}
if (childTree != null) {
- childTree.addStyleDependentName("last");
+ boolean leaf = !uidl.getTag().equals("node");
+ childTree.addStyleDependentName(leaf ? "leaf-last" : "last");
childTree.childNodeContainer.addStyleDependentName("last");
}
final String selectMode = uidl.getStringAttribute("selectmode");
childNodeContainer.add(childTree);
}
if (!i.hasNext()) {
- childTree
- .addStyleDependentName(childTree.isLeaf() ? "leaf-last"
- : "last");
+ childTree.addStyleDependentName(childTree.isLeaf()
+ ? "leaf-last" : "last");
childTree.childNodeContainer.addStyleDependentName("last");
}
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="/" />
+<title>TreeConnectors</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TreeConnectors</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/TreeConnectors?theme=base</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>base</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/TreeConnectors?theme=reindeer</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>reindeer</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/TreeConnectors?theme=runo</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>runo</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/TreeConnectors?theme=liferay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>liferay</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/TreeConnectors?theme=chameleon</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>chameleon</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.themes.BaseTheme;
+
+@SuppressWarnings("serial")
+public class TreeConnectors extends TestBase {
+
+ @Override
+ protected void setup() {
+ final Tree tree = new Tree(null, createContainer());
+ tree.addStyleName(BaseTheme.TREE_CONNECTORS);
+ for (Object rootItems : tree.rootItemIds()) {
+ tree.expandItemsRecursively(rootItems);
+ }
+ tree.setChildrenAllowed("Item 73", false);
+
+ addComponent(tree);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tree nodes should be connected with lines indicating the hierarchy.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6745;
+ }
+
+ private HierarchicalContainer createContainer() {
+ HierarchicalContainer cont = new HierarchicalContainer();
+ cont.addContainerProperty("name", String.class, "");
+
+ for (int i = 0; i < 20; i++) {
+ Item item = cont.addItem("Item " + i);
+ item.getItemProperty("name").setValue("Item " + i);
+ cont.setChildrenAllowed("Item " + i, false);
+
+ if (i == 1 || i == 4) {
+ cont.setChildrenAllowed("Item " + i, true);
+ }
+
+ // Add three items to item 1
+ if (i > 1 && i < 4) {
+ cont.setParent("Item " + i, "Item 1");
+ }
+
+ // Add 5 items to item 4
+ if (i > 4 && i < 10) {
+ cont.setChildrenAllowed("Item " + i, true);
+
+ if (i == 7) {
+ item = cont.addItem("Item 71");
+ item.getItemProperty("name").setValue("Item 71");
+ cont.setParent("Item 71", "Item " + i);
+ cont.setChildrenAllowed("Item 71", false);
+
+ item = cont.addItem("Item 72");
+ item.getItemProperty("name").setValue("Item 72");
+ cont.setParent("Item 72", "Item " + i);
+ cont.setChildrenAllowed("Item 72", true);
+
+ item = cont.addItem("Item 73");
+ item.getItemProperty("name").setValue("Item 73");
+ cont.setParent("Item 73", "Item 72");
+ cont.setChildrenAllowed("Item 73", true);
+
+ item = cont.addItem("Item 74");
+ item.getItemProperty("name").setValue("Item 74");
+ cont.setParent("Item 74", "Item " + i);
+ cont.setChildrenAllowed("Item 74", true);
+ }
+
+ cont.setParent("Item " + i, "Item " + (i - 1));
+
+ }
+ }
+
+ return cont;
+ }
+}