Package com.vaadin.data

Examples of com.vaadin.data.Item


        Table t = new Table("A table with a text column and a Label column");
        t.addContainerProperty("text", String.class, null);
        t.addContainerProperty("label", Label.class, null);

        for (int i = 0; i < 20; i++) {
            Item item = t.addItem("" + i);
            item.getItemProperty("text").setValue("Text " + i);
            item.getItemProperty("label").setValue(new Label("Label " + i));
        }
        addComponent(t);
    }
View Full Code Here


        main.addComponent(refreshTable);
    }

    public void fill(IndexedContainer container, int size, String prefix) {
        for (int i = 0; i < size; i++) {
            Item item = container.addItem(new Integer(i));
            VerticalLayout layout = new VerticalLayout();
            layout.addComponent(new Button(prefix + i));
            item.getItemProperty("layout").setValue(layout);
        }
    }
View Full Code Here

        t.addContainerProperty("Name", TextField.class, null);
        t.addContainerProperty("Button", Button.class, null);

        for (int i = 0; i < 3; i++) {
            Item item = t.addItem(i);
            TextField tf = new TextField("", String.valueOf(i + 1));
            tf.setColumns(10);
            item.getItemProperty("Name").setValue(tf);

            Button b = new Button("OK");
            item.getItemProperty("Button").setValue(b);
        }

    }
View Full Code Here

        // Add a generated column with a link to Google
        table.addGeneratedColumn("Search", new Table.ColumnGenerator() {
            @Override
            public Component generateCell(Table source, Object itemId,
                    Object columnId) {
                Item item = source.getItem(itemId);
                String name = (String) item.getItemProperty("Name").getValue();
                return new Link("Google for " + name, new ExternalResource(
                        "http://www.google.co.uk/search?q=" + name));
            }
        });
View Full Code Here

        container.addContainerProperty("col1", String.class, "");
        container.addContainerProperty("col2", String.class, "");
        container.addContainerProperty("col3", String.class, "");

        for (int i = 0; i < 100; i++) {
            Item item = container.addItem("item " + i);
            item.getItemProperty("col1").setValue("first" + i);
            item.getItemProperty("col2").setValue("middle" + i);
            item.getItemProperty("col3").setValue("last" + i);
        }

        return container;
    }
View Full Code Here

        c.removeAllItems();
        for (int i = 1; i <= properties; i++) {
            c.addContainerProperty("Property " + i, String.class, "");
        }
        for (int i = 1; i <= items; i++) {
            Item item = c.addItem("Item " + i);
            for (int j = 1; j <= properties; j++) {
                item.getItemProperty("Property " + j).setValue(
                        "Item " + i + "," + j);
            }
        }

    }
View Full Code Here

        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);
                    child.getItemProperty("value").setValue(childId + "");
                    container.setParent(childId, parentId);
                }
            }
        });
        addComponent(repopulate);
View Full Code Here

        addComponent(t);

        t.addContainerProperty("Name", TextField.class, null);

        for (int i = 0; i < 3; i++) {
            Item item = t.addItem(i);
            TextField tf = new TextField("", String.valueOf(i + 1));
            tf.setColumns(10);
            item.getItemProperty("Name").setValue(tf);
        }

    }
View Full Code Here

        }

        private IndexedContainer initMasterOptionContainer() {
            IndexedContainer containerToReturn = new IndexedContainer();
            Object defaultValue = null;
            Item itemAdded;

            containerToReturn.addContainerProperty(NAME_PROPERTY_ID,
                    String.class, defaultValue);

            for (Integer optionId : controllerOptionMap.keySet()) {
                itemAdded = containerToReturn.addItem(optionId);
                itemAdded.getItemProperty(NAME_PROPERTY_ID).setValue(
                        controllerOptionMap.get(optionId));
            }

            return containerToReturn;
        }
View Full Code Here

            container.addContainerProperty(NAME, String.class, null);
            container.addContainerProperty(ID, Integer.class, null);
            for (int i = 0; i < 264; i++) {
                String name = NAME + i;
                int id = i;
                Item item = container.addItem(id);
                item.getItemProperty(NAME).setValue(name);
                item.getItemProperty(ID).setValue(id);
            }
            container.sort(new Object[] { ID }, new boolean[] { true });
            return container;
        }
View Full Code Here

TOP

Related Classes of com.vaadin.data.Item

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.