Today, I try to upgrate my code from Vaadin 7.3.8 to Vaadin 7.4.2, but getting FieldGroup Binding Exception:
com.vaadin.data.Property$ReadOnlyException
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:471)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:451)
at com.vaadin.ui.AbstractTextField.setValue(AbstractTextField.java:455)
at com.vaadin.ui.TextField.clear(TextField.java:146)
at com.vaadin.data.fieldgroup.FieldGroup.bind(FieldGroup.java:261)
Trace to to code:
if (itemDataSource == null) {
// Clear any possible existing binding to clear the field
field.setPropertyDataSource(null);
field.clear();
// Will be bound when data source is set
return;
}
Read only is… read only, you can’t change its value… And when you bind it - you change its value.
If you need to edit such field, you can just use:
field.setReadOnly(false);
field.setPropertyDataSource(null);
field.clear();
field.setReadOnly(true);
Is there any problem with this?
I am facing the same problem in versioni 7.4.2, but things are working fine in 7.3.6 version.
What I have found out is inside FieldGroup bind method
field.setPropertyDataSource(null);
when above specified code get executed it goes to AbstractFiled setPropertyDataSource(), and as per the implemention of this method it call getInternalValue() which we generally override to get the values from BeanItemContainer which is NULL till this point… so it leads to NULL pointer Exception.
field.setPropertyDataSource(null); is not there in 7.3.6 version.
Please let me know if you found any solution for this.
I am facing the same problem in versioni 7.4.2, but things are working fine in 7.3.6 version.
What I have found out is inside FieldGroup bind method
field.setPropertyDataSource(null);
when above specified code get executed it goes to AbstractFiled setPropertyDataSource(), and as per the implemention of this method it call getInternalValue() which we generally override to get the values from BeanItemContainer which is NULL till this point… so it leads to NULL pointer Exception.
field.setPropertyDataSource(null); is not there in 7.3.6 version.
Please let me know if you found any solution for this.
The most major one I think is that FieldGroup should not always overwrite the enabled/readOnly state of fields but allow the state to be configured by the user
Is there a planned date to release the fix for this? We use the setting to null in many places and this creates errors all the time since we upgraded from 7.3 to 7.4.
Our code generally looks like this:
fieldGroup.setItemDataSource(null);
We also have some old Form subclassing in which the code is:
super.setItemDataSource(null);