Example usage for com.vaadin.ui Tree Tree

List of usage examples for com.vaadin.ui Tree Tree

Introduction

In this page you can find the example usage for com.vaadin.ui Tree Tree.

Prototype

public Tree() 

Source Link

Document

Constructs a new Tree Component.

Usage

From source file:org.vaadin.addons.javaee.navigation.SideMenu.java

License:Apache License

@PostConstruct
public void init() {
    tree = new Tree();
    tree.setNullSelectionAllowed(false);
    tree.setId("SideMenu");
    tree.setSelectable(true);// www  . j  a  v  a 2  s . co  m
    tree.setImmediate(true);
    listener = new ValueChangeListenerImplementation();
    tree.addValueChangeListener(listener);
    setContent(tree);
    addDisabledStyleGenerator();
}

From source file:org.vaadin.spring.samples.mvp.ui.view.NavigationPanelView.java

License:Apache License

public NavigationPanelView() {
    tree = new Tree();
}

From source file:org.vaadin.tori.view.listing.thread.ThreadMoveComponent.java

License:Apache License

private Tree createCategories(final List<Category> allCategories, final long threadId,
        final Long threadCategoryId) {
    final Tree tree = new Tree();

    for (final Category category : allCategories) {
        tree.addItem(category.getId());//from w w  w . j ava 2  s . c o  m
        tree.setItemCaption(category.getId(), category.getName());
        tree.setChildrenAllowed(category.getId(), false);

        Category parent = category.getParentCategory();
        if (parent != null) {
            tree.setChildrenAllowed(parent.getId(), true);
            tree.setParent(category.getId(), parent.getId());
            tree.expandItem(parent.getId());
        }
    }

    tree.setValue(threadCategoryId);
    tree.setImmediate(true);
    return tree;
}

From source file:ro.zg.open_groups.gui.components.CausalHierarchyContainer.java

License:Apache License

private void init() {
    /* start depth combo */
    CssLayout startDepthContainer = new CssLayout();
    startDepthContainer.setWidth("100%");
    startDepthContainer.setHeight("22px");
    startDepthContainer.addStyleName(OpenGroupsStyles.HIERARCHY_FILTERS_BAR);

    Label startDepthLabel = new Label(OpenGroupsResources.getMessage("hierarchy.start.depth"));
    startDepthLabel.setSizeUndefined();/*from  w  ww .j  av a 2 s  .co m*/
    startDepthLabel.addStyleName(OpenGroupsStyles.HORIZONTAL);

    startDepthSelect = new ComboBox();
    startDepthSelect.setInvalidAllowed(false);
    startDepthSelect.setNullSelectionAllowed(false);
    startDepthSelect.setNewItemsAllowed(false);
    startDepthSelect.addStyleName(OpenGroupsStyles.HORIZONTAL);
    startDepthSelect.setWidth("55px");
    startDepthSelect.setImmediate(true);

    startDepthContainer.addComponent(startDepthLabel);
    startDepthContainer.addComponent(startDepthSelect);

    // CssLayout hierarchyTitleBar = new CssLayout();
    // hierarchyTitleBar.setWidth("100%");
    // hierarchyTitleBar.addStyleName(OpenGroupsStyles.HIERARCHY_TITLE_BAR);
    // Label title = new Label("Ierarhie cauzal");
    // title.addStyleName(OpenGroupsStyles.TITLE_LINK);
    // hierarchyTitleBar.addComponent(title);

    // addComponent(hierarchyTitleBar);
    addComponent(startDepthContainer);

    /* the tree */
    hierarchyTree = new Tree();
    hierarchyTree.addStyleName(OpenGroupsStyles.HIERARCHY_TREE);
    hierarchyTree.setMultiSelect(false);
    hierarchyTree.setImmediate(true);
    hierarchyTree.setNullSelectionAllowed(true);
    hierarchyTree.setSizeUndefined();
    hierarchyTree.setContainerDataSource(new HierarchicalContainer());
    hierarchyTree.addContainerProperty("depth", Integer.class, null);
    hierarchyTree.addListener(new CollapseListener() {

        @Override
        public void nodeCollapse(CollapseEvent event) {
            Object itemId = event.getItemId();
            /* remove the subhierarchy */
            removeSubhierarchy(itemId);
        }
    });

    CssLayout treeContainer = new CssLayout();
    treeContainer.addStyleName("hierarchy-tree-container");
    treeContainer.setWidth("100%");
    treeContainer.setHeight("93%");
    treeContainer.addComponent(hierarchyTree);
    addComponent(treeContainer);
    // setExpandRatio(hierarchyTree, 1);
}

From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.components.configeditor.NodeSelector.java

License:Open Source License

/**
 * Creates a new NodeSelector./*w w w.j  a v  a  2s  .co  m*/
 */
public NodeSelector() {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setMargin(true);
    verticalLayout.setStyleName(CSS.APS_CONFIG_NODE_SELECTOR);

    setContent(verticalLayout);

    this.configNodeTree = new Tree();
    this.configNodeTree.setImmediate(true);
    this.configNodeTree.setSelectable(true);
    this.configNodeTree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    this.configNodeTree.setItemCaptionPropertyId(HierarchicalModel.getDefaultCaption());
    this.configNodeTree.setItemDescriptionGenerator(this); // For tooltips.
    this.configNodeTree.setHeight("100%");
    this.configNodeTree.setWidth(null);

    this.itemSelectListener = new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            itemSelected((ID) event.getProperty().getValue());
        }
    };

    this.configNodeTree.addListener(this.itemSelectListener);

    verticalLayout.addComponent(this.configNodeTree);
}

From source file:Uni.Menu.Menu.java

private Menu() {
    mainMenuItems = new ArrayList<>(MenuDefinitions.get_MainMenuItems());
    mainMenuSubOptions = new HashMap<>();
    mainMenuTree = new Tree();

    init();//from   ww w  . jav a 2 s  .co  m
    createTreeMenu();
}