I’m using 6.3 nightly and must not be doing something right when using a TwinColSelect. I am able to populate it nicely so that I see the full list of choices on the left side, with the selected ones appearing on the right side.
But when I do a Form.commit(), I get an exception:
com.vaadin.data.Property$ConversionException: java.lang.NoSuchMethodException: java.util.HashSet.(java.lang.String)
at com.vaadin.data.util.MethodProperty.setValue(MethodProperty.java:709)
at com.vaadin.ui.AbstractField.commit(AbstractField.java:226)
at com.vaadin.ui.Form.commit(Form.java:312)
This should be auto-set on commit by my BeanItemContainer, which it is doing for all fields until it reaches the selection box.
My bean field that drives the selection list is:
public HashSet<String> getPermGroupListIds() {
return createIdHashSet( group.getPermGroupList(user()) );
}
public void setPermGroupListIds(HashSet<String> v) {
System.out.println("v.size: " + v.size());
}
I noted in the debugger that AbstractField.commit() calls:
dataSource.setValue(newValue);
The ‘newValue’ at this point is a Collections$UnmodifiableSet apparently of a HashSet type and shows a size of 2 (for the two I’ve selected and appear in the right side as normal).
There is a test in MethodProperty.setValue that says:
// Try to assign the compatible value directly
if (newValue == null || type.isAssignableFrom(newValue.getClass())) {
But it fails this test, which is disappointing since it seems I support accepting a HashSet in my setPermGroupListIds() method. Then the exception is thrown on the call:
final Constructor constr = getType().getConstructor(
new Class[] { String.class });
What am I doing wrong with my bean’s set method to accept the values from the TwinColSelection?