Property.setValue() is not working...

I have a BeanItem that is bound to a Form. The Form uses a FormFieldFactory to create the field widgets. The Form has date fields, twin column fields, checkbox fields, combo box fields and text fields.

The form also has a button to save (serialize the BeanItem classes data and a method to reload that data.

When the form is displayed and a product selected, if that product has a saved data file, then the file is loaded into the form and the data from the file is suspposed be displayed/

The problem I’m having is that item.getProperty(“prop name”).setValue(“foo”) for the textfields in the bean are not working. When I watch the code in the debugger it appears as though the attributes are being populated by the setValue() call, the field is still showing as null in the field currently bound to the bean and the UI.



Here’s a slightly better explanation.

Here’s the setup:

  1. Form with BeanItem set as the data source.
  2. First item in the form is a dropdown.
  3. When an item is selected from the dropdown, I search for a matching filename in a ValueChangeListener. The contents of the file is a serialized dump of the BeanItem object (i.e. Foo).
  4. If a filename is found, I read the contents of the file into a new instance of Foo foo.
  5. I then call item.getItemProperty(“fooProperty”).setValue(foo.getFooProperty());
  6. If fooProperty is bound to anything but a TextField (i.e. DateField, CheckBox, TwinColumnField) the value set in step 5 is displayed in the form. However, if fooProperty is bound to a TextField, the value from the saved serialized file is not shown in the form.

The ValueChangeListener is declared in the FormFieldFactory class that the form uses, thus, the item object in step 5 is one of the parameters in the FormFieldFactory’s createField method.

I’ve run this in the debugger and it looks like it is being set properly (that is, the setFooProperty method in the Foo class which is bound to the BeanItem container is being called).