Hi all,
I’m just starting with Vaadin and I’m surprised how well things seem to be working.
Yesterday, however, my progress stopped as I was trying to use a NativeSelect to manage the Department of a Person (Person.department) within an editable Table.
I use the JPAContainer together with Vaadin 7.2.6 to access the persistent entities.
Here my overridden createField method of the TableFieldFactory:
@Override
public Field createField(Container container, Object itemId,
Object propertyId, Component uiContext) {
Field retVal = super.createField(container, itemId, propertyId, uiContext);
if (“department”.equals(propertyId)) {
retVal = new NativeSelect(null, container);
NativeSelect selector = (NativeSelect)retVal;
Property prop = container.getContainerProperty(itemId, propertyId);
selector.setPropertyDataSource(prop);
selector.setItemCaptionPropertyId(propertyId);
selector.setImmediate(true);
selector.setReadThrough(true);
selector.setWriteThrough(true);
selector.setNullSelectionAllowed(true);
}
return retVal;
}
All persons have a department assigned, but the NativeSelects are empty, EmptySelects.jpg.
Available departments are displayed properly, but cannot be used to department for the person, AvailableValues.jpg.
If I try, I get an Exception:
Caused by: com.vaadin.data.Property$ConversionException: java.lang.NoSuchMethodException:
com.vaadin.data.Buffered$SourceException
tabletest.domain.Department.(java.lang.String)
at com.vaadin.addon.jpacontainer.JPAContainerItem$ItemProperty.setValue(JPAContainerItem.java:276)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:525)
… 29 more
Caused by: java.lang.NoSuchMethodException: tabletest.domain.Department.(java.lang.String)
at java.lang.Class.getConstructor0(Class.java:2810)
Any help appreciated…
Cheers
Håkan
16447.java (1.07 KB)
16448.java (908 Bytes)
16449.java (655 Bytes)
16451.java (2.43 KB)