Package com.vaadin.data

Examples of com.vaadin.data.Item


        t.setVisibleColumns(new Object[] { "col1", "col2" });

        t.addItem(new Object[] { "foo", "bar" }, "4");

        // workaround to add item with all values
        Item i = t.addItem("5");
        i.getItemProperty("col1").setValue("jep");
        i.getItemProperty("col2").setValue("foo");
        i.getItemProperty("col3").setValue("bar");

        mainWin.addComponent(t);

        Button b = new Button("Toggle col3");
        b.addListener(new Button.ClickListener() {
View Full Code Here


            myCombo.setHeight("-1px");
            myCombo.addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(ValueChangeEvent event) {
                    if (myCombo.getValue() != null) {
                        Item item = myCombo.getItem(event.getProperty()
                                .getValue());
                        String selected = item.getItemProperty("MYFIELD")
                                .getValue().toString();
                        System.out.println("Selected " + selected);
                    }
                }
            });
View Full Code Here

        container.removeAllItems();
        String[] strings = new String[] { "Text 1", "Text 2", "true", "false",
                "Caption 1", "Caption 2" };
        for (String s : strings) {
            Object id = container.addItem();
            Item item = container.getItem(id);
            item.getItemProperty(STRING).setValue(s);
            item.getItemProperty(BUTTON).setValue(new Button(s));
            item.getItemProperty(CHECKBOX).setValue(
                    new CheckBox("", s.equals("true")));
        }

    }
View Full Code Here

        HierarchicalContainer container = new HierarchicalContainer();
        container.addContainerProperty("t1", String.class, "");
        container.addContainerProperty("t2", String.class, "");

        Item item = container.addItem("r1");
        item.getItemProperty("t1").setValue("Row1 t1");
        item.getItemProperty("t2").setValue("Row1 t2");

        item = container.addItem("r2");
        item.getItemProperty("t1").setValue("Row2 t1");
        item.getItemProperty("t2").setValue("Row2 t2");

        MyForm form = new MyForm();
        MyTable table = new MyTable(form, container);

        VerticalSplitPanel splitPanel = new VerticalSplitPanel();
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private static void addItem(Container c, Object... properties) {
        Object itemId = c.addItem();
        Item item = c.getItem(itemId);
        int i = 0;
        Iterator<?> propIter = c.getContainerPropertyIds().iterator();
        while (propIter.hasNext()) {
            Object propertyId = propIter.next();
            item.getItemProperty(propertyId).setValue(properties[i]);
            i++;
        }
    }
View Full Code Here

            addValueChangeListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(
                        com.vaadin.data.Property.ValueChangeEvent event) {
                    final Item item = getItem(getValue());
                    form.setItemDataSource(item);
                }

            });
        }
View Full Code Here

    private void createUI(AbstractOrderedLayout layout) {
        ComboBox combo = new ComboBox("Combobox caption");
        combo.addContainerProperty("blah", String.class, "");
        combo.setItemCaptionPropertyId("blah");

        Item item;
        for (int i = 0; i < 100; i++) {
            item = combo.addItem(new Object());
            item.getItemProperty("blah").setValue("Item " + i);
        }

        layout.addComponent(combo);

        combo = new ComboBox("Combobox caption");
        combo.addContainerProperty("blah", String.class, "");
        combo.setItemCaptionPropertyId("blah");

        for (int i = 0; i < 5; i++) {
            item = combo.addItem(new Object());
            item.getItemProperty("blah").setValue("Item " + i);
        }

        layout.addComponent(combo);
    }
View Full Code Here

            layout.addComponent(b);
        }

        {
            selectWithNullItem = createSelect();
            Item nullItem = selectWithNullItem.addItem(NULL_ITEM_ID);
            nullItem.getItemProperty(PROPERTY_ID).setValue("NULL");
            selectWithNullItem.setNullSelectionItemId(NULL_ITEM_ID);

            layout.addComponent(selectWithNullItem);
            selectWithNullItem.setCaption("Select with null item id");
            Button b = new Button("Select NULL_PROPERTY", new ClickListener() {
View Full Code Here

    @Override
    public void valueChange(ValueChangeEvent event) {

        Property<?> property = event.getProperty();
        if (property == testList) {
            Item item = testList.getItem(testList.getValue());

            if (item != testForm.getItemDataSource()) {
                testForm.setItemDataSource(item);
            }
        }
View Full Code Here

    private Select createSelect() {
        Select select = new Select();
        select.addContainerProperty(PROPERTY_ID, String.class, "");
        select.setItemCaptionPropertyId(PROPERTY_ID);

        Item item1 = select.addItem("1");
        item1.getItemProperty(PROPERTY_ID).setValue("1");
        Item item2 = select.addItem("2");
        item2.getItemProperty(PROPERTY_ID).setValue("2");

        select.setNullSelectionAllowed(true);

        return select;
    }
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.