Level: Advanced
Date: Originally published 10/07
Author: Richard Bondi,
Date: Originally published 10/07
Author: Richard Bondi,
In GWT, a listener object A may attach itself to many other widgets. These widgets will call A's onChange (or similar) method, and pass themselves as onChange's only parameter. Inside onChange, A must then decide which widget called it. The problem at this point is for a programmer unfamiliar with the code: there is no easy way for her to tell which of the widget's many methods and properties are intended to be used by A. The solution given here is to create an interface, named [widget's name]Event, that has only methods to be used inside of onChange. This makes for clean and understandable code.
The full text of this post is available at http://docs.google.com/Doc?id=dw2zgx2_331ns4qh527.