Package com.vaadin.ui

Examples of com.vaadin.ui.TreeTable$ContainerStrategy


public class ProgrammaticCollapse extends TestBase {

    @Override
    protected void setup() {
        VerticalLayout layout = new VerticalLayout();
        final TreeTable table = new TreeTable();
        table.setPageLength(10);
        table.addContainerProperty("A", String.class, null);
        table.addContainerProperty("B", String.class, null);
        for (int i = 1; i <= 100; ++i) {
            int parentid = i;
            table.addItem(new Object[] { "A" + i, "B" + i }, parentid);
            for (int j = 1; j < 5; ++j) {
                int id = 1000 * i + j;
                table.addItem(new Object[] { "A" + i + "." + j,
                        "B" + i + "." + j }, id);
                table.setParent(id, parentid);
            }
        }
        layout.addComponent(table);
        layout.addComponent(new Button("Expand / Collapse",
                new ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        boolean collapsed = !table.isCollapsed(1);
                        Notification.show("set collapsed: " + collapsed);
                        table.setCollapsed(1, collapsed);
                    }
                }));
        layout.addComponent(new Button("Expand / Collapse last",
                new ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        boolean collapsed = !table.isCollapsed(100);
                        Notification.show("set collapsed: " + collapsed);
                        table.setCollapsed(100, collapsed);
                    }
                }));
        layout.addComponent(new Button("Expand / Collapse multiple",
                new ClickListener() {
                    private boolean collapsed = true;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        collapsed = !collapsed;
                        Notification.show("set collapsed: " + collapsed);
                        for (int i = 0; i < 50; ++i) {
                            table.setCollapsed(i * 2, collapsed);
                        }
                    }
                }));
        addComponent(layout);
    }
View Full Code Here


                    }
                }));
    }

    private void createTreeTableAndPopulate() {
        TreeTable tt = new TreeTable();
        tt.addContainerProperty("Foo", String.class, "");
        tt.addContainerProperty("Bar", String.class, "");

        Object item1 = tt.addItem(new Object[] { "Foo", "Bar" }, null);
        Object item2 = tt.addItem(new Object[] { "Foo2", "Bar2" }, null);

        tt.setParent(item2, item1);

        tt.setCollapsed(item1, false);

        addComponent(tt);
    }
View Full Code Here

public class ProgrammaticSelect extends TestBase {

    @Override
    protected void setup() {
        final TreeTable tt = new TreeTable();
        tt.setContainerDataSource(buildDataSource(10, 100, 50));
        tt.setSelectable(true);
        addComponent(tt);

        Button selectItem = new Button("Select first row",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        Object id = tt.getItemIds().iterator().next();
                        tt.select(id);
                    }
                });

        addComponent(selectItem);
    }
View Full Code Here

    private HierarchicalContainer treeContainer;

    @Override
    protected void setup() {
        treetable = new TreeTable();
        treeContainer = new HierarchicalContainer();
        // Create the treetable
        treetable.setSelectable(true);
        treetable.setSizeFull();
View Full Code Here

    @Override
    protected void setup() {
        VerticalLayout content = getLayout();
        content.setSizeFull();

        t = new TreeTable() {
            {
                setSizeFull();
                fillTreeTable(this);
            }
        };
View Full Code Here

                "../runo/icons/16/ok.png")));
        layout.addComponent(createTreeTableAndPopulate(FontAwesome.ANDROID));
    }

    private TreeTable createTreeTableAndPopulate(Resource icon) {
        TreeTable tt = new TreeTable();
        tt.addContainerProperty("Foo", String.class, "");
        tt.setColumnWidth("Foo", 100);
        tt.addContainerProperty("Bar", String.class, "");
        tt.setColumnWidth("Bar", 100);
        tt.setIcon(icon);
        tt.setHeight(400, PIXELS);

        Object item1 = tt.addItem(new Object[] { "Foo", "Bar" }, null);
        Object item2 = tt.addItem(new Object[] { "Foo2", "Bar2" }, null);
        tt.setItemIcon(item1, icon);
        tt.setItemIcon(item2, icon);

        tt.setParent(item2, item1);

        tt.setCollapsed(item1, false);

        return tt;
    }
View Full Code Here

    @Override
    protected void setup() {
        getLayout().setWidth("100%");

        // Create the treetable
        treetable = new TreeTable();
        treetable.setWidth("100%");
        treetable.addListener((Tree.ExpandListener) this);
        treetable.addListener((Tree.CollapseListener) this);

        addComponent(treetable);
View Full Code Here

public class TreeTablePartialUpdatesPageLength0 extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        setTheme("reindeer-tests");
        TreeTable tt = new TreeTable();
        tt.addStyleName("table-equal-rowheight");
        tt.setPageLength(0);
        tt.setContainerDataSource(makeHierarchicalContainer());
        tt.setWidth("300px");
        addComponent(tt);
        tt.getParent().setHeight(null);
        tt.getParent().getParent().setHeight(null);
    }
View Full Code Here

    @Override
    protected void setup() {
        Layout grid = getGridLayout();

        TreeTable t = getTreeTable(null);
        grid.addComponent(t);

        t = getTreeTable("small");
        grid.addComponent(t);

        t = getTreeTable("big");
        grid.addComponent(t);

        t = getTreeTable("striped");
        grid.addComponent(t);

        t = getTreeTable("small striped");
        grid.addComponent(t);

        t = getTreeTable("big striped");
        grid.addComponent(t);

        t = getTreeTable("strong");
        grid.addComponent(t);

        t = getTreeTable("small strong");
        grid.addComponent(t);

        t = getTreeTable("big strong");
        grid.addComponent(t);

        t = getTreeTable("borderless");
        grid.addComponent(t);

        t = getTreeTable("striped");
        t.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
        t.setCaption(t.getCaption() + ", hidden headers");
        grid.addComponent(t);

        addComponent(grid);
    }
View Full Code Here

        grid.setStyleName("preview-grid");
        return grid;
    }

    public TreeTable getTreeTable(String style) {
        TreeTable t = new TreeTable();
        t.setAnimationsEnabled(true);
        t.setWidth("250px");
        t.setPageLength(5);
        t.setSelectable(true);
        t.setColumnCollapsingAllowed(true);
        t.setColumnReorderingAllowed(true);

        if (style != null) {
            t.setStyleName(style);
            t.setCaption("Table.addStyleName(\"" + style + "\")");
        }

        t.addContainerProperty("First", String.class, null);
        t.addContainerProperty("Second", String.class, null);
        t.addContainerProperty("Third", String.class, null);

        for (int j = 1; j < 100; j++) {
            t.addItem(new Object[] { "Foo " + j, "Bar " + j, "Lorem " + j }, j);
        }
        Hierarchical hc = t.getContainerDataSource();
        hc.setChildrenAllowed(2, true);
        for (int j = 4; j < 100; j++) {
            hc.setParent(j, 2);
        }

        t.setColumnIcon("Third", new ThemeResource(
                "../runo/icons/16/document.png"));
        t.select(1);

        return t;
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.TreeTable$ContainerStrategy

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.