com.vaadin.data.TreeData Java Examples

The following examples show how to use com.vaadin.data.TreeData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextMenuUI.java    From context-menu with Apache License 2.0 6 votes vote down vote up
private void addTree(VerticalLayout layout) {
    TreeData<String> data = new TreeData<>();
    data.addItem(null, "Dad");
    data.addItem("Dad", "Daughter");
    data.addItem("Daughter", "Granddaughter");
    data.addItem("Dad", "Son");
    data.addItem("Daughter", "Grandson");

    Tree<String> tree = new Tree<>("A family", data);
    TreeContextMenu<String> treeContextMenu = new TreeContextMenu<>(tree);
    treeContextMenu.addTreeContextMenuListener(e -> {
        treeContextMenu.removeItems();
        //The path is /resources/images/kitten.jpg
        ClassResource ico = new ClassResource("/images/kitten.jpg");
        treeContextMenu.addItem("Who?",ico, menuItem -> Notification.show(e.getItem()));
    });

    layout.addComponent(tree);
}
 
Example #2
Source File: CubaFoldersPane.java    From cuba with Apache License 2.0 4 votes vote down vote up
private <T extends Folder> FoldersDataProvider<T> createTreeDataProvider() {
    TreeData<T> treeData = new TreeData<>();
    return new FoldersDataProvider<>(treeData);
}
 
Example #3
Source File: CubaFoldersPane.java    From cuba with Apache License 2.0 4 votes vote down vote up
public FoldersDataProvider(TreeData<T> treeData) {
    super(treeData);
}
 
Example #4
Source File: WebTree.java    From cuba with Apache License 2.0 4 votes vote down vote up
public EmptyTreeDataProvider() {
    super(new TreeData<>());
}
 
Example #5
Source File: WebTreeDataGrid.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected DataProvider<E, ?> createEmptyDataProvider() {
    return new TreeDataProvider<>(new TreeData<>());
}