Re: UiHandler and how to do it right?
Thanks for the clarification! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
UiHandler and how to do it right?
I try to get a button working using UiBinder with UiHandler. Unfortunately the screen shows up fine but the button does not react on any clicks. While searching for some good examples how to use the UiHandler annotation I got confused. The tutorial on the official gwt site says: @UiHandler(button) void handleClick(ClickEvent e) { Window.alert(Hello, AJAX); } http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiBinder.html The UiHandler Java doc point to some test code telling me: @UiHandler({buttonClick, labelClick}) void doClick(ClickEvent event) { eventMessage(event); } http://code.google.com/p/google-web-toolkit/source/browse/releases/2.0/user/test/com/google/gwt/uibinder/test/client/HandlerDemo.java?spec=svn6557r=6557 Searching this group I got totaly lost, because it looks like some implicit naming convention: @UiHandler(lastName) void onLastNameBlur(BlurEvent event) { // code from UpperCase goes here } http://groups.google.com/group/google-web-toolkit/browse_thread/thread/d6e21d5b4c1b4f00?tvc=2q=UiHandler Thanks in advance for any clarification. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: UiHandler and how to do it right?
The value to the @UiHandler annotation is the ui:field value in your UiBinder. So in the first example, they Button must have been named button. There is no implicit naming convention on the method names. The argument to that method is what determines when that method runs (e.g. on a ClickEvent, or on a BlurEvent, etc.). -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/nIs6EiXUWssJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: UiHandler and how to do it right?
Do you have a corresponding field in your UIBinder ui.xml with the same ui:field property? For example, in your ui.xml you should have: g:Button ui:field=buttonClick Me/g:Button In the corresponding Java class you should have: @UiField Button button; @UiHandler(button) void clickButton(ClickEvent e) { Window.alert(Hello World); } As Steve said, the method name on the UiHandler can be anything. The parameter to the method determines the event being handled. As long as your ui:field property, the variable name on the UIField, and the quoted text on the @UiHandler annotation match everything should work fine. On Sep 8, 6:55 am, Volker volker.kinderm...@googlemail.com wrote: I try to get a button working using UiBinder with UiHandler. Unfortunately the screen shows up fine but the button does not react on any clicks. While searching for some good examples how to use the UiHandler annotation I got confused. The tutorial on the official gwt site says: @UiHandler(button) void handleClick(ClickEvent e) { Window.alert(Hello, AJAX);} http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiBin... The UiHandler Java doc point to some test code telling me: @UiHandler({buttonClick, labelClick}) void doClick(ClickEvent event) { eventMessage(event); } http://code.google.com/p/google-web-toolkit/source/browse/releases/2 Searching this group I got totaly lost, because it looks like some implicit naming convention: @UiHandler(lastName) void onLastNameBlur(BlurEvent event) { // code from UpperCase goes here} http://groups.google.com/group/google-web-toolkit/browse_thread/threa... Thanks in advance for any clarification. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.