Quote Originally Posted by oliverhutchison
Your domain object needs to fire property change events so that the form model can be notified of external changes, unfortunatly there's no magic way for the form model to just know that the domain object has been modified.

Code:
class DomainObject implements PropertyChangePublisher {
...
    private PropertyChangeSupport pcs = new PropertyChangeSupport (this);
...

    public void setSomeProperty(String someProperty ) {
         String oldValue = this.someProperty;
         this.someProperty = someProperty;
         pcs.firePropertyChange("someProperty", oldValue, someProperty);
    }

...

}
I'll leave the rest of the implementation to you If your know AOP resonable well or are feeling adventurous you could also implement a PropertyChangePublisher mixin which in the long run would save you lots of code and effort.

Ollie
I noticed a lot of the binding code in Spring merely looks for the prescence of the PropertyChangePublisher interface on the domain object. Perhaps instead of tying the domain objects to the Spring framework in such a way, a better approach could be to use reflection to check for the presence of methods with the signatures...

Code:
addPropertyChangeListener(PropertyChangeListener)
removePropertyChangeListener(PropertyChangeListener)
... for global notification, and ...

Code:
addPropertyChangeListener(String, PropertyChangeListener)
removePropertyChangeListener(String, PropertyChangeListener)
... for individual property notification.

I believe this is the approach the JGoodies binding framwork takes, and it looks quite simple to achieve. It would probably be a matter of externalizing all such code to a more convenient utilities class.

-Scott