Package com.vaadin.ui

Examples of com.vaadin.ui.Tree$ItemStyleGenerator


    private NavigationPanelListener listener;

    private final Tree tree;

    public NavigationPanelView() {
        tree = new Tree();
    }
View Full Code Here


        VerticalLayout pl = new VerticalLayout();
        pl.setMargin(true);
        Panel p = new Panel("Tree test", pl);
        p.setSizeFull();

        Tree t = new Tree();

        t.addItem("Foo");
        t.addItem("Bar");

        final VerticalLayout events = new VerticalLayout();

        t.addListener(new ItemClickEvent.ItemClickListener() {
            @Override
            public void itemClick(ItemClickEvent event) {
                events.addComponent(new Label(new Label("Click:"
                        + (event.isDoubleClick() ? "double" : "single")
                        + " button:" + event.getButtonName() + " propertyId:"
View Full Code Here

        return new Label("<b>Components without a test:</B><br/>"
                + missingTests, ContentMode.HTML);
    }

    private Component createMenu() {
        naviTree = new Tree();
        naviTree.setItemStyleGenerator(new ItemStyleGenerator() {

            @Override
            public String getStyle(Tree source, Object itemId) {
                Class<?> cls = (Class<?>) itemId;
View Full Code Here

        smi = mi.addItem("Item", icon, null);
        smi = smi.addItem("Item", icon, null);
        gl.addComponent(menu);

        // Tree, caption + item + subitem + action icons
        Tree tree = new Tree("Tree");
        tree.addItem("Root");
        tree.setItemIcon("Root", icon);
        tree.addItem("Leaf");
        tree.setItemIcon("Leaf", icon);
        tree.setParent("Leaf", "Root");
        tree.expandItemsRecursively("Root");
        tree.addActionHandler(actionHandler);
        gl.addComponent(tree);

        // All of FontAwesome
        String allIcons = "";
        for (FontIcon ic : FontAwesome.values()) {
View Full Code Here

        main.addComponent(new Label(
                "Some test cases for trees. Events panel logs events that happen server side."));

        main.addComponent(new Button("commit"));

        Tree t;

        t = createTestTree();
        t.setCaption("Default settings");
        main.addComponent(createTestBench(t));

        t = createTestTree();
        t.setCaption("Multiselect settings");
        t.setMultiSelect(true);
        main.addComponent(createTestBench(t));

        t = createTestTree();
        t.setCaption("Multiselect and immediate");
        t.setImmediate(true);
        t.setMultiSelect(true);
        main.addComponent(createTestBench(t));

        t = createTestTree();
        t.setCaption("immediate");
        t.setImmediate(true);
        main.addComponent(createTestBench(t));

        t = createTestTree();
        t.setCaption("with actions");
        t.setImmediate(true);
        t.addActionHandler(this);
        final AbstractOrderedLayout ol = (AbstractOrderedLayout) createTestBench(t);
        al = new VerticalLayout();
        al.setMargin(true);
        ol.addComponent(new Panel("action log", al));
        main.addComponent(ol);
View Full Code Here

        main.addComponent(b);

    }

    public Tree createTestTree() {
        Tree t = new Tree("Tree");
        final String[] names = new String[100];
        for (int i = 0; i < names.length; i++) {
            names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                    + " "
                    + lastnames[(int) (Math.random() * (lastnames.length - 1))];
        }

        // Create tree
        t = new Tree("Organization Structure");
        for (int i = 0; i < 100; i++) {
            t.addItem(names[i]);
            final String parent = names[(int) (Math.random() * (names.length - 1))];
            if (t.containsId(parent)) {
                t.setParent(names[i], parent);
            }
        }

        // Forbid childless people to have children (makes them leaves)
        for (int i = 0; i < 100; i++) {
            if (!t.hasChildren(names[i])) {
                t.setChildrenAllowed(names[i], false);
            }
        }
        return t;
    }
View Full Code Here

        // setting either width or height fixes the issue
        // p.setWidth(500);
        // p.setHeight(800);

        // Tree with a few items
        tree = new Tree();
        tree.setImmediate(true);
        // we'll use a property for caption instead of the item id ("value"),
        // so that multiple items can have the same caption
        tree.addContainerProperty(CAPTION_PROPERTY, String.class, "");
        tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
View Full Code Here

        populateContainer(hier);

        // sort(indexedContainer);

        tree1 = new Tree("Tree with wrapped IndexedContainer");
        tree1.setContainerDataSource(hier);
        tree1.setItemCaptionPropertyId("name");
        for (Object id : hier.rootItemIds()) {
            tree1.expandItemsRecursively(id);
        }
View Full Code Here

            s.addItem(name);
        }
    }

    public Tree createTestTree() {
        Tree t = new Tree("Tree");
        final String[] names = new String[100];
        for (int i = 0; i < names.length; i++) {
            names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                    + " "
                    + lastnames[(int) (Math.random() * (lastnames.length - 1))];
        }

        // Create tree
        t = new Tree("Organization Structure");
        for (int i = 0; i < 100; i++) {
            t.addItem(names[i]);
            final String parent = names[(int) (Math.random() * (names.length - 1))];
            if (t.containsId(parent)) {
                t.setParent(names[i], parent);
            }
        }

        // Forbid childless people to have children (makes them leaves)
        for (int i = 0; i < 100; i++) {
            if (!t.hasChildren(names[i])) {
                t.setChildrenAllowed(names[i], false);
            }
        }
        return t;
    }
View Full Code Here

        tt.setSelectable(true);
        tt.addContainerProperty("foo", String.class, "bar");
        tt.addItem();

        fields.add(tt);
        Tree tree = new Tree();
        tree.addItem("Item 1");
        fields.add(tree);
        fields.add(new TwinColSelect());
        fields.add(new PasswordField());
        fields.add(new TextField());
        fields.add(new TextArea());
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Tree$ItemStyleGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.