Search code examples
gwtdata-bindingrequestfactory

Entity Proxy Change Listener in GWT Request Factory


I wish to achieve birectional binding of UI and data using Request Factory Proxies, and for that part I need a way to listen to the changes in a EntityProxy or a ValueProxy. If they were ordinary models, I could have attached my view to the model's change listener, but in request factory, the models or "proxies" are interfaces and I can't figure out, how to let the view know when a "setter" method is called.

Is there a way I can do this, without wrapping the proxy and delegating the setters to proxy, while at the same time raise events ? I want the functionality to be "plugged in" directly into the proxy.


Solution

  • We have actually come up with a workaround. We tapped into the GWT generator code and added a Listener field in the autobean proxy. After that we appended a listener.execute() in each of the generated setter methods. So now we can attach change listeners to the proxy and listen to them.

    The only thing that worries me, is a JSNI call used to call a protected method and also tapping into the GWT generator code. How fine is this?