Kamal - 2012-05-08

I want to understand the limitations (if any) of bindings used in OpenSwing as compared to JGoodies or BeansBindings. For example, with BeansBindings you can bind a control's properties to an appropriate property on a class with observable properties (i.e. a bean). To be specific, you can bind JTextField's "text" properties to a String property "xxx" of a class that makes the "xxx" property observable (it publishes propertychanged events when the property changes when it's setter is called). BeansBindings allows this binding to be two-way so that the control property updates when the beans property updates and vice versa. This also means that the binding property mapping between control containers and beans is n-n. For example, controls in a form can bind to properties on multiple beans. Similarly, the properties on a bean can be bound to controls in multiple forms.

In OpenSwing, the container class (limited to Form, I think) allows specifying the top-level value object (acts as a bean but doesn't need the properties to be observable) and then each control in the Form can bind by setting its "attribute" property to a property (or sub-property if the value object has internal objects) on the value object. The Form has pull, push functions that move the data to and from the Form. When the from is in Edit mode, I can see that making changes to the controls triggers the property setters of the bound "attribute" of the value object. However, unlike BeansBindings, text fields push updates only when "enter" is pressed (and I presume when focus is lost) but not while typing. Also, it's not clear to me how   other components in an application can "push" a change to the Form without reloading the whole Form. In BeansBinding, just calling the setter of the bean property bound to the control will trigger only the control display to update. Also, binding properties accessible to the controls in a Form are limited to the value object and whatever is accessible through it - only a single value object can be used with a Form so it is a 1-1 relationship between the container class (Form) and the bean (value object).

The problem I am trying to solve is for editing changes made in one Form to automatically trigger updates in another Form without having to overtly call a reload of the entire form. These updates are transient. The persistent data model is not affected unless the user saves the Form. Any pointers will be appreciated.