Package com.vaadin.data

Examples of com.vaadin.data.Property$ConversionException


            throw new BindException(
                    "The given field is not part of this FieldBinder");
        }

        TransactionalPropertyWrapper<?> wrapper = null;
        Property fieldDataSource = field.getPropertyDataSource();
        if (fieldDataSource instanceof TransactionalPropertyWrapper) {
            wrapper = (TransactionalPropertyWrapper<?>) fieldDataSource;
            fieldDataSource = ((TransactionalPropertyWrapper<?>) fieldDataSource)
                    .getWrappedProperty();
View Full Code Here


            @Override
            public void buttonClick(Button.ClickEvent event) {
                // Set ItemProperty.COLUMN2 for all selected values of table
                Collection selectedIds = (Collection) table.getValue();
                for (final Object itemId : selectedIds) {
                    final Property p = table.getItem(itemId).getItemProperty(
                            ItemProperty.COLUMN2);
                    if (p.getValue() instanceof String) {
                        p.setValue(null);
                    } else {
                        p.setValue("updated");
                    }
                }
            }
        }));
View Full Code Here

        }

        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) {
                    itemProperty.setValue(new DerivedClass("derived" + i));
                } else if (types[j] == int.class) {
                    // FIXME can't set values because the int is autoboxed into
                    // an Integer and not unboxed prior to set

                    // itemProperty.setValue(i);
View Full Code Here

    }

    public void testIntegerDataSource() {
        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
        Label l = new Label("Foo");
        Property ds = new MethodProperty<Integer>(Person.createTestPerson1(),
                "age");
        l.setPropertyDataSource(ds);
        assertEquals(String.valueOf(Person.createTestPerson1().getAge()),
                l.getValue());
    }
View Full Code Here

    public void testValueChangeFiredWhenSettingPropertyDataSource() {
        // setup
        Label underTest = new Label();

        Property mockProperty = EasyMock.createMock(Property.class);

        ValueChangeListener mockListener = createStrictMock(ValueChangeListener.class);
        // record
        mockListener
                .valueChange(anyObject(com.vaadin.data.Property.ValueChangeEvent.class));

        expect(mockProperty.getType()).andReturn(String.class).atLeastOnce();
        expect(mockProperty.getValue()).andReturn("Any").atLeastOnce();

        // test

        replay(mockListener, mockProperty);
        underTest.addValueChangeListener(mockListener);
View Full Code Here

    }

    @Override
    public Field createField(Container container, Object itemId,
            Object propertyId, Component uiContext) {
        Property containerProperty = container.getContainerProperty(itemId,
                propertyId);
        Class<?> type = containerProperty.getType();
        Field<?> field = createFieldByPropertyType(type);
        field.setCaption(createCaptionByPropertyId(propertyId));
        return field;
    }
View Full Code Here

                caption = itemId.toString();
            }
            break;

        case ITEM_CAPTION_MODE_PROPERTY:
            final Property p = getContainerProperty(itemId,
                    getItemCaptionPropertyId());
            if (p != null) {
                caption = p.toString();
            }
            break;
        }

        // All items must have some captions
View Full Code Here

        if (getItemIconPropertyId() == null) {
            return null;
        }

        final Property ip = getContainerProperty(itemId,
                getItemIconPropertyId());
        if (ip == null) {
            return null;
        }
        final Object icon = ip.getValue();
        if (icon instanceof Resource) {
            return (Resource) icon;
        }

        return null;
View Full Code Here

                    captionChangeNotifiers.add(i);
                }
                Collection<?> pids = i.getItemPropertyIds();
                if (pids != null) {
                    for (Iterator<?> it = pids.iterator(); it.hasNext();) {
                        Property p = i.getItemProperty(it.next());
                        if (p != null
                                && p instanceof Property.ValueChangeNotifier) {
                            ((Property.ValueChangeNotifier) p)
                                    .addListener(getCaptionChangeListener());
                            captionChangeNotifiers.add(p);
                        }
                    }

                }
                break;
            case ITEM_CAPTION_MODE_PROPERTY:
                final Property p = getContainerProperty(itemId,
                        getItemCaptionPropertyId());
                if (p != null && p instanceof Property.ValueChangeNotifier) {
                    ((Property.ValueChangeNotifier) p)
                            .addListener(getCaptionChangeListener());
                    captionChangeNotifiers.add(p);
View Full Code Here

        final int count = metadata.getColumnCount();
        final ArrayList<String> list = new ArrayList<String>(count);
        for (int i = 1; i <= count; i++) {
            final String columnName = metadata.getColumnName(i);
            list.add(columnName);
            final Property p = getContainerProperty(new Integer(1), columnName);
            propertyTypes.put(columnName,
                    p == null ? Object.class : p.getType());
        }
        propertyIds = Collections.unmodifiableCollection(list);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.data.Property$ConversionException

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.