Package com.vaadin.data.util

Examples of com.vaadin.data.util.PropertysetItem


        setDate(date);
        date.setLocale(new Locale("fi", "fi"));
        date.setShowISOWeekNumbers(true);
        row.addComponent(date);

        PropertysetItem item = new PropertysetItem();
        item.addItemProperty("date", new ObjectProperty<Date>(getDefaultDate()));

        FormLayout form = new FormLayout();
        form.setMargin(false);

        FieldGroup binder = new FieldGroup(item);
View Full Code Here


    public static final String ITEM_2_ID = "2";
    public static final String PROPERTY_1_ID = "property 1";
    public static final String PROPERTY_2_ID = "property 2";

    private void loadItems() {
        final PropertysetItem item1 = new PropertysetItem();
        item1.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>(
                "value 1", String.class));
        item1.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>(
                "name 1", String.class));
        items.put(ITEM_1_ID, item1);

        final PropertysetItem item2 = new PropertysetItem();
        item2.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>(
                "value 2", String.class));
        item2.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>(
                "name 2", String.class));
        items.put(ITEM_2_ID, item2);
    }
View Full Code Here

    public static final String PROPERTY_1_ID = "property 1";
    public static final String PROPERTY_2_ID = "property 2";

    private void loadItems() {
        for (int i = 1; i < 15; i++) {
            final PropertysetItem item = new PropertysetItem();
            item.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>(
                    "value " + i, String.class));
            item.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>(
                    "name " + i, String.class));
            items.put(String.valueOf(i), item);
        }
    }
View Full Code Here

        assertTrue("Jack".equals(form.firstName.getValue()));
    }

    @Test
    public void perfectMatchPriority() {
        PropertysetItem item = new PropertysetItem();
        item.addItemProperty("first_name", new ObjectProperty<String>(
                "Not this"));
        item.addItemProperty("firstName", new ObjectProperty<String>("This"));

        class MyForm extends FormLayout {
            TextField firstName = new TextField("First name");

            public MyForm() {
View Full Code Here

    protected final Filter lessEqualNull = new LessOrEqual(PROPERTY1, null);

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        itemNull = new PropertysetItem();
        itemNull.addItemProperty(PROPERTY1, new ObjectProperty<String>(null,
                String.class));
        itemEmpty = new PropertysetItem();
        itemEmpty.addItemProperty(PROPERTY1, new ObjectProperty<String>("",
                String.class));
        itemA = new PropertysetItem();
        itemA.addItemProperty(PROPERTY1, new ObjectProperty<String>("a",
                String.class));
        itemB = new PropertysetItem();
        itemB.addItemProperty(PROPERTY1, new ObjectProperty<String>("b",
                String.class));
        itemC = new PropertysetItem();
        itemC.addItemProperty(PROPERTY1, new ObjectProperty<String>("c",
                String.class));
    }
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

        // new Date() is only accurate to the millisecond, so repeating it gives
        // the same date
        Date earlier = new Date(now.getTime() - 1);
        Date later = new Date(now.getTime() + 1);

        Item itemEarlier = new PropertysetItem();
        itemEarlier.addItemProperty(PROPERTY1, new ObjectProperty<Date>(
                earlier, Date.class));
        Item itemNow = new PropertysetItem();
        itemNow.addItemProperty(PROPERTY1, new ObjectProperty<Date>(now,
                Date.class));
        Item itemLater = new PropertysetItem();
        itemLater.addItemProperty(PROPERTY1, new ObjectProperty<Date>(later,
                Date.class));

        Filter equalNow = new Equal(PROPERTY1, now);
        Assert.assertFalse(equalNow.passesFilter(null, itemEarlier));
        Assert.assertTrue(equalNow.passesFilter(null, itemNow));
View Full Code Here

import com.vaadin.data.util.PropertysetItem;

public class IsNullFilterTest extends AbstractFilterTest<IsNull> {

    public void testIsNull() {
        Item item1 = new PropertysetItem();
        item1.addItemProperty("a", new ObjectProperty<String>(null,
                String.class));
        item1.addItemProperty("b",
                new ObjectProperty<String>("b", String.class));
        Item item2 = new PropertysetItem();
        item2.addItemProperty("a",
                new ObjectProperty<String>("a", String.class));
        item2.addItemProperty("b", new ObjectProperty<String>(null,
                String.class));

        Filter filter1 = new IsNull("a");
        Filter filter2 = new IsNull("b");
View Full Code Here

public class FieldNamedDescription {

    @Test
    public void bindReadOnlyPropertyToFieldGroup() {
        // Create an item
        PropertysetItem item = new PropertysetItem();
        item.addItemProperty("name", new ObjectProperty<String>("Zaphod"));
        item.addItemProperty("description", new ObjectProperty<String>(
                "This is a description"));

        // Define a form as a class that extends some layout
        class MyForm extends FormLayout {
            // Member that will bind to the "name" property
View Full Code Here

TOP

Related Classes of com.vaadin.data.util.PropertysetItem

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.