Update multiple components from POJO

Hi,

For a dummy project I am trying to implement the following.

I want a selectable table with data. Also I want a few fields and labels of which the value is determined by the selected table row. Also, when the data is altered in any of the fields, the other components need to be updated.

Thus, one java object, with three components displaying it, all updated whenever the object changes.

I could implement this using a lot of listeners back and forth, but I was wondering if there is some easier way to do so.

Hi!

For a completely automated solution try using BeanItems and building a Form for your fields. This way when the form is commit():ed the table should be instructed that an item has changed. (I hope :))

This also works if you manually update your pojos
through the BeanItem
(e.g. item.getProperty(“myField”).setValue(newFieldValue)). All Items have the observer pattern (listeners back and forth) implemented and the item containers listen for events from these.

HTH,
/Jonatan

Hey, thanks. Got it to work… :slight_smile: