I have a form where in i have a Nativeselect which is populated with Cd Objects.
When the user selects an item from the dropdown i need to populate the FormBean with the selected Cd object.
Please look at my form bean; How will i Map the selected Cd object to the bean.
My vaadin version is 6.8.0.nightly-20111122-c22085.
public class VisitInfo {
private Cd selectedVisitAction;
private List<Cd> visitActions = new ArrayList<Cd>();
}
In FormFieldFactory
if (WebAppConstants.VISIT_ACTIONS.equals(propertyId)) {
final NativeSelect typeSelect = getNativeSelect("treatmentrealization.form.action");
final BeanItemContainer<Cd> container = new BeanItemContainer<Cd>(Cd.class , visitInfo.getVisitActions());
typeSelect.setContainerDataSource(container);
typeSelect.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
typeSelect.setItemCaptionPropertyId("displayName");
typeSelect.addListener(new Property.ValueChangeListener() {
return typeSelect;
}
When the form is submitted i get
com.vaadin.data.Property$ConversionException: java.lang.NoSuchMethodException: java.util.List.(java.lang.String)
at com.vaadin.data.util.MethodProperty.convertValue(MethodProperty.java:697)
at com.vaadin.data.util.MethodProperty.setValue(MethodProperty.java:666)
at com.vaadin.ui.AbstractField.commit(AbstractField.java:258)
at com.vaadin.ui.AbstractField.setWriteThrough(AbstractField.java:378)
at com.vaadin.ui.Form.setWriteThrough(Form.java:474)
at com.logica.medi.hcmu.webapp.components.form.VisitingDataForm.commit(VisitingDataForm.java:103)