Ray has some sample code in one of his slides: http://code.google.com/events/io/sessions/GoogleWebToolkitBestPractices.html
See slide 24 http://dl.google.com/io/2009/pres/Th_0200_GoogleWebToolkitArchitecture-BestPracticesForArchitectingYourGWTApp.pdf On Fri, Jun 26, 2009 at 5:58 AM, martinhansen < [email protected]> wrote: > > Hello, > > how can I reuse an AsyncCallback Class? Is there any concept? > For example, I have the following AsyncCallback defined in a GUI > class: > > > AsyncCallback<LoginResult> callback = new > AsyncCallback<LoginResult>() > { > public void onFailure( Throwable caught ) > { > // Show error message > } > public void onSuccess( LoginResult result ) > { > // Show success message > } > }; > > loginService.loginUser(user, password, callback); > > > And I want to use the same functionality in another GUI class, how can > I accomplish this? I have a lot of code duplication and I want to > reduce it. In the end, I'd like to have something like: > > LoginResult result = LoginUtil.loginUser(user, password) > if (result == error) doSomething; > if(result == success) doSomething; > > Thanks in advance > > > -- Fred Sauer [email protected] [] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
