.
public class TodoScreen extends VerticalLayout implements View {
private static final long serialVersionUID = -7005445336418613611L;
@SuppressWarnings("unused")
public TodoScreen () {
Label label = new Label ("Hello, Todo Screen!");
label.addStyleName (ValoTheme.LABEL_H1);
addComponent (label);
setComponentAlignment (label, Alignment.TOP_CENTER);
Object[][]
groupCategories = new Object
{
new Object{“Group Categories”, “Language”, “Products”, “Roles”},new Object
{“Group”, “Language1”, “Products1”, “Roles1”}};
Tree tree = new Tree();
/* Add groupCategories as root items in the tree. */
for (int i=0; i<groupCategories.length; i++) {
String categories = (String) (groupCategories[i]
[0]
);
tree.addItem(categories);
if (groupCategories[i]
.length == 1) {
// The categories has no item(s) so make it a leaf.
tree.setChildrenAllowed(categories, true);
} else {
// Add children (item) under the categories.
for (int j=1; j<groupCategories[i]
.length; j++) {
String item = (String) groupCategories[i]
[j]
;
// Add the item as a regular item.
tree.addItem(item);
// Set it to be a child.
tree.setParent(item, categories);
// Make the moons look like leaves.
tree.setChildrenAllowed(item, false);
}
// Expand the subtree.
tree.expandItemsRecursively(groupCategories);
}
}
addComponent(tree);
}
}
i want to add subroot to languages, how do i implement that?
Object
groupCategories = new Object
{
new Object{“Group Categories”, "
Languages
", “Products”, “Roles”},new Object{“Group”, “Language1”, “Products1”, “Roles1”}};