Package com.vaadin.data

Examples of com.vaadin.data.Item


        t.addGeneratedColumn("col 3 (green)", new ColumnGenerator() {

            @Override
            public Component generateCell(Table source, Object itemId,
                    Object columnId) {
                Item item = source.getItem(itemId);
                String col1 = (String) item.getItemProperty("col 1 (red)")
                        .getValue();
                String col2 = (String) item.getItemProperty("col 2").getValue();
                return new Label(col1 + "-" + col2);
            }
        });

        t.addContainerProperty("col 4", String.class, "");
View Full Code Here


        }

        private IndexedContainer initSlaveOptionContainer(Integer masterId) {
            IndexedContainer containerToReturn = new IndexedContainer();
            Object defaultValue = null;
            Item itemAdded;
            List<String> options;

            options = slaveOptionMapping.get(controllerOptionMap.get(masterId));
            containerToReturn.addContainerProperty(NAME_PROPERTY_ID,
                    String.class, defaultValue);

            for (String option : options) {
                itemAdded = containerToReturn.addItem(option);
                itemAdded.getItemProperty(NAME_PROPERTY_ID).setValue(option);
            }

            return containerToReturn;
        }
View Full Code Here

        Button b = new Button("Add item", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Object id = rightTable.addItem();
                Item item = rightTable.getItem(id);
                item.getItemProperty("name").setValue("Role");
                item.getItemProperty("info").setValue(new Button("Button"));

            }
        });
        addComponent(b);
View Full Code Here

        BrokenContainer container = new BrokenContainer();
        for (int j = 1; j <= cols; j++) {
            container.addContainerProperty("prop" + j, String.class, null);
        }
        for (int i = 1; i <= rows; i++) {
            Item item = container.addItem("item" + i);
            for (int j = 1; j <= cols; j++) {
                item.getItemProperty("prop" + j).setValue(
                        "item" + i + "/prop" + j);
            }
        }
        return container;
    }
View Full Code Here

        table = new Table();
        table.addContainerProperty(PROPERTY_1, String.class, "");
        table.setPageLength(4);

        Item item = table.addItem("1");
        item.getItemProperty(PROPERTY_1).setValue("Row 1");
        item = table.addItem("2");
        item.getItemProperty(PROPERTY_1).setValue("Row 2");

        Filterable filterable = (Container.Filterable) table
                .getContainerDataSource();
        filterable.addContainerFilter(new SimpleStringFilter(PROPERTY_1, "Row",
                true, false));
View Full Code Here

    protected void addItem() {
        Filterable filterable = (Container.Filterable) table
                .getContainerDataSource();

        Item i = table.addItem("abc");
        String res = "";
        if (i == null) {
            res = "FAILED";
        } else {
            res = "OK!";
View Full Code Here

        for (int i = 0; i < ids.length; ++i) {
            container.addContainerProperty(ids[i], types[i], "");
        }

        for (int i = 0; i < 100; i++) {
            Item item = container.addItem("item " + i);
            for (int j = 0; j < ids.length; ++j) {
                Property itemProperty = item.getItemProperty(ids[j]);
                if (types[j] == String.class) {
                    itemProperty.setValue(ids[j].toString() + i);
                } else if (types[j] == BaseClass.class) {
                    itemProperty.setValue(new BaseClass("base" + i));
                } else if (types[j] == DerivedClass.class) {
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

    public void testCompareInteger() {
        int negative = -1;
        int zero = 0;
        int positive = 1;

        Item itemNegative = new PropertysetItem();
        itemNegative.addItemProperty(PROPERTY1, new ObjectProperty<Integer>(
                negative, Integer.class));
        Item itemZero = new PropertysetItem();
        itemZero.addItemProperty(PROPERTY1, new ObjectProperty<Integer>(zero,
                Integer.class));
        Item itemPositive = new PropertysetItem();
        itemPositive.addItemProperty(PROPERTY1, new ObjectProperty<Integer>(
                positive, Integer.class));

        Filter equalZero = new Equal(PROPERTY1, zero);
        Assert.assertFalse(equalZero.passesFilter(null, itemNegative));
        Assert.assertTrue(equalZero.passesFilter(null, itemZero));
View Full Code Here

        BigDecimal zero = new BigDecimal(0);
        BigDecimal positive = new BigDecimal(1);
        positive.setScale(1);
        BigDecimal positiveScaleTwo = new BigDecimal(1).setScale(2);

        Item itemNegative = new PropertysetItem();
        itemNegative.addItemProperty(PROPERTY1, new ObjectProperty<BigDecimal>(
                negative, BigDecimal.class));
        Item itemZero = new PropertysetItem();
        itemZero.addItemProperty(PROPERTY1, new ObjectProperty<BigDecimal>(
                zero, BigDecimal.class));
        Item itemPositive = new PropertysetItem();
        itemPositive.addItemProperty(PROPERTY1, new ObjectProperty<BigDecimal>(
                positive, BigDecimal.class));
        Item itemPositiveScaleTwo = new PropertysetItem();
        itemPositiveScaleTwo.addItemProperty(PROPERTY1,
                new ObjectProperty<BigDecimal>(positiveScaleTwo,
                        BigDecimal.class));

        Filter equalZero = new Equal(PROPERTY1, zero);
        Assert.assertFalse(equalZero.passesFilter(null, itemNegative));
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.