Are there special restrictions for naming an event handler under GWT UIBinder?
UI template:
<g:Button ui:field="myButton" />
Below are some of valid variants i've seen, for naming the click
event handler of the button
('/' symbolically separates different method names),
@UiHandler("myButton")
public void onClick / onClickButton / handleClick(ClickEvent e) {}
It seems to me that the event handler can be named at will. It is identified rather by the annotation
and the event parameter
than the method name
, i.e. "myButton" and "ClickEvent" instead of "onClick/onClickButton/handleClick" for the example above.
Did i miss anything?
@EDIT
Two handlers must be named differently of course, if they happen to be of the same type of event parameter
.
There are no restrictions on the name of the method. It cannot however be private. The widget it applies to is determined by the value of the annotation and the type of event handled is determined by the parameter of the method. This post has a nice answer on this subject : Documentation for @UiHandler