In GWT, I have a FormPanel with several textfields. These fields have ChangeEvent handlers, but the thing is these handlers must perform implementation specific. They must also work using UiBinder’s @UiHandler.
There are two classes that implement this formpanel and more may come in the future. I need this form to be in one place because it will change per deployment environment of the application.
So what I want, is to override my handlers per implementation. Currently what I thought of, was to pass the class that implements the form instance through the constructor, then call methods declared in that implementing class from the textfields’ handlers, but then I’d also want to in some way force declaration of such a method in the implementing class.
I currently can’t think of how I should go about doing this, I may really be missing something here. What would be the best way to do this?
Brief example
FormPanelX
TabThatContainsFPX
PopupThatContainsFPX
The tab and popup both contain the formpanel, but the actionhandlers on the fields must perform slightly different in each case.
Why must they work using UiBinder’s @UiHandler? You don’t have to attach handlers in that fashion.
I’m guessing you have a composite that looks something like this.
The easiest way is to probably have a get method for the text field so you can attach change handlers directly to it.
Then in your TabThatContainsFPX or PopupThatContainsFPX, you could do something like..