本文整理汇总了Java中com.vaadin.v7.ui.Tree类的典型用法代码示例。如果您正苦于以下问题:Java Tree类的具体用法?Java Tree怎么用?Java Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tree类属于com.vaadin.v7.ui包,在下文中一共展示了Tree类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TreeTest
import com.vaadin.v7.ui.Tree; //导入依赖的package包/类
public TreeTest() {
Tree tree = new Tree();
tree.addItem(ITEM_1);
tree.setChildrenAllowed(ITEM_1, true);
tree.addItem(ITEM_1_1);
tree.setParent(ITEM_1_1, ITEM_1);
tree.setChildrenAllowed(ITEM_1_1, true);
tree.addItem(ITEM_1_1_1);
tree.setChildrenAllowed(ITEM_1_1_1, false);
tree.setParent(ITEM_1_1_1, ITEM_1_1);
tree.addItem(ITEM_1_1_2);
tree.setChildrenAllowed(ITEM_1_1_2, false);
tree.setParent(ITEM_1_1_2, ITEM_1_1);
tree.addItem(ITEM_2);
tree.setChildrenAllowed(ITEM_2, true);
tree.addItem(ITEM_2_1);
tree.setParent(ITEM_2_1, ITEM_2);
tree.setChildrenAllowed(ITEM_2_1, false);
tree.expandItemsRecursively(ITEM_1);
tree.expandItemsRecursively(ITEM_2);
addComponent(tree);
}
示例2: JunkYard
import com.vaadin.v7.ui.Tree; //导入依赖的package包/类
public JunkYard() {
// setMargin(true);
setWidth("100%");
TextField textField = new TextField("Textfield");
textField.setInputPrompt("prompt");
addComponent(textField);
/**
* ComboBox
*/
ComboBox cb = new ComboBox();
cb.setWidth("100%");
cb.setInputPrompt("Prompt");
for (int i = 1; i <= 100; i++) {
cb.addItem("Item " + i);
}
cb.setItemIcon("Item " + 1, new ThemeResource(
"../runo/icons/64/document.png"));
addComponent(cb);
/**
* DateField
*/
DateField df = new DateField();
df.setWidth("100%");
addComponent(df);
df = new InlineDateField();
addComponent(df);
/**
* Tree
*/
Tree tree = new Tree(null, createContainer());
for (Object rootItems : tree.rootItemIds()) {
tree.expandItemsRecursively(rootItems);
}
tree.setChildrenAllowed("Item 73", false);
addComponent(tree);
/**
* Table
* */
Table table = new Table();
table.addContainerProperty("Property", String.class, "value");
table.addContainerProperty("Another", String.class, "value");
table.addContainerProperty("Third", String.class, "value");
for (int i = 0; i < 100; i++) {
table.addItem();
}
table.setColumnCollapsingAllowed(true);
table.setColumnReorderingAllowed(true);
table.setSelectable(true);
addComponent(table);
}