本文整理匯總了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);
}