Package com.vaadin.ui

Examples of com.vaadin.ui.TreeTable$CollapsibleStrategy


public class TreeTableOutOfSync extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        TreeTable tt = new TreeTable();
        tt.addContainerProperty("i", Integer.class, null);
        tt.addGeneratedColumn("text", new Table.ColumnGenerator() {
            @Override
            public Object generateCell(Table source, Object itemId,
                    Object columnId) {
                if ("text".equals(columnId)) {
                    Button button = new Button("text "
                            + source.getContainerDataSource().getItem(itemId)
                                    .getItemProperty("i").getValue());
                    button.addClickListener(new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {
                            Notification.show("click");
                        }
                    });
                    return button;
                }
                return null;
            }
        });

        Object item1 = tt.addItem(new Object[] { 1 }, null);
        Object item2 = tt.addItem(new Object[] { 2 }, null);
        tt.addItem(new Object[] { 3 }, null);
        tt.setParent(item2, item1);

        addComponent(tt);
    }
View Full Code Here


public class TreeTableItemDescriptionGeneratorUI extends
        TableItemDescriptionGeneratorUI {

    @Override
    protected Table createTable() {
        return new TreeTable();
    }
View Full Code Here

    @Override
    protected void setup() {
        final HierarchicalContainer container = new HierarchicalContainer();
        container.addContainerProperty("value", String.class, "");

        final TreeTable tt = new TreeTable(null, container);
        tt.setSizeFull();
        int parentId = counter++;
        Item parent = container.addItem(parentId);
        tt.setCollapsed(parentId, false);
        parent.getItemProperty("value").setValue("parent " + (counter++) + "");
        addComponent(tt);
        Button repopulate = new Button("Repopulate", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                // repopulate the container and expand root item
                container.removeAllItems();
                int parentId = counter++;
                Item parent = container.addItem(parentId);
                tt.setCollapsed(parentId, false);
                parent.getItemProperty("value").setValue(
                        "parent " + (counter++) + "");
                for (int i = 0; i < 4; i++) {
                    int childId = counter++;
                    Item child = container.addItem(childId);
View Full Code Here

                treeTable
                        .setCacheRate((Integer) event.getProperty().getValue());
            }
        });
        addComponent(cacheRateSelect);
        treeTable = new TreeTable();
        treeTable.addStyleName("table-equal-rowheight");
        testBeanContainer = new BeanItemContainer<TestBean>(TestBean.class);

        Map<String, Integer> hasChildren = new HashMap<String, Integer>();
        hasChildren.put("1", 5);
View Full Code Here

    protected void setup() {
        HorizontalLayout layout = new HorizontalLayout();
        layout.setWidth("310px");
        layout.setHeight("300px");

        final Table table = new TreeTable();
        table.setSizeFull();

        table.addGeneratedColumn("parameterId", new EmptyColumnGenerator());
        table.addGeneratedColumn("wordingTextId", new TypeColumnGenerator());
        table.addGeneratedColumn("parameterTypeId", new TypeColumnGenerator());

        table.setColumnWidth("parameterId", 26);

        table.addItem(new TestObject("name 1", "value 1"));
        table.addItem(new TestObject("name 2", "value 2"));
        table.addItem(new TestObject("name 3", "value 3"));
        table.addItem(new TestObject("name 4", "value 4"));
        table.addItem(new TestObject("name 5", "value 5"));

        layout.addComponent(table);

        Button button = new Button("Add");
        button.setId("button");
        button.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                table.addItem(new TestObject("name 6-1", "value 6-1"));
                table.addItem(new TestObject("name 6-2", "value 6-2"));
                table.addItem(new TestObject("name 6-3", "value 6-3"));
                table.addItem(new TestObject("name 6-4", "value 6-4"));
                table.addItem(new TestObject("name 6-5", "value 6-5"));
                table.addItem(new TestObject("name 6-6", "value 6-6"));
                table.addItem(new TestObject("name 6-7", "value 6-7"));
                table.addItem(new TestObject("name 6-8", "value 6-8"));
                table.addItem(new TestObject("name 6-9", "value 6-9"));
                table.addItem(new TestObject("name 6-9", "value 6-10"));
            }
        });

        addComponent(layout);
        addComponent(button);
View Full Code Here

    protected void setup() {
        HorizontalLayout layout = new HorizontalLayout();
        layout.setWidth("300px");
        layout.setHeight("300px");

        final TreeTable table = new TreeTable();
        table.setSizeFull();

        table.addGeneratedColumn("parameterId", new HierarchyColumnGenerator());
        table.addGeneratedColumn("wordingTextId", new TypeColumnGenerator());
        table.addGeneratedColumn("parameterTypeId", new TypeColumnGenerator());

        table.setColumnWidth("parameterId", 26);

        table.addItem(new TestObject("name 1", "value 1"));
        table.addItem(new TestObject("name 2", "value 2"));
        table.addItem(new TestObject("name 3", "value 3"));
        table.addItem(new TestObject("name 4", "value 4"));
        table.addItem(new TestObject("name 5", "value 5"));
        final TestObject parent = new TestObject("name 6", "value 6");
        table.addItem(parent);
        table.setFooterVisible(true);
        for (int i = 1; i <= 10; ++i) {
            TestObject child = new TestObject("name 6-" + i, "value 6-" + i);
            table.addItem(child);
            table.setParent(child, parent);
        }
        table.setVisibleColumns(new Object[] { "wordingTextId", "parameterId",
                "parameterTypeId" });
        table.setColumnHeaders(new String[] { "", "", "" });
        table.setHierarchyColumn("parameterId");

        layout.addComponent(table);

        Button button = new Button("Toggle");
        button.setId("button");
        button.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                table.setCollapsed(parent, !table.isCollapsed(parent));
                Notification.show("collapsed: " + table.isCollapsed(parent));
            }
        });

        addComponent(layout);
        addComponent(button);
View Full Code Here

        fields.add(new InlineDateField());
        OptionGroup og = new OptionGroup();
        og.addItem("Item 1");
        og.addItem("Item 2");
        fields.add(og);
        TreeTable tt = new TreeTable();
        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);
View Full Code Here

import com.vaadin.ui.TreeTable;

public class TreeTableSetContainerNull extends TestCase {

    public void testNullContainer() {
        TreeTable treeTable = new TreeTable();

        // should not cause an exception
        treeTable.setContainerDataSource(null);
    }
View Full Code Here

import com.vaadin.ui.TreeTable;

public class EmptyTreeTable extends TestCase {
    public void testLastId() {
        TreeTable treeTable = new TreeTable();

        assertFalse(treeTable.isLastId(treeTable.getValue()));
    }
View Full Code Here

public class ComponentsInTreeTable extends TestBase {

    @Override
    protected void setup() {
        TreeTable tt = new TreeTable();
        tt.setWidth("300px");
        tt.setHeight("300px");
        addComponent(tt);

        tt.addContainerProperty("component", Component.class, "");
        tt.addContainerProperty("type", String.class, "bar");

        Layout l = new HorizontalLayout();
        l.addComponent(new Label("bar"));
        l.addComponent(new Label("bar"));
        tt.addItem(new Object[] { l, "HorizontalLayout" }, 1);

        l = new VerticalLayout();
        l.addComponent(new Label("baz"));
        l.addComponent(new Label("baz"));
        tt.addItem(new Object[] { l, "VerticalLayout" }, 2);

        Label lbl = new Label("<b>foo</b><br/><i>bar</i>");
        lbl.setContentMode(Label.CONTENT_XHTML);
        tt.addItem(new Object[] { lbl, "Label" }, 3);

        tt.addItem(new Object[] { new Button("Test"), "Button" }, 4);
        tt.setParent(4, 3);
    }
View Full Code Here

TOP

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

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.