Martin,

On Sat, Jul 4, 2009 at 11:27 AM, martinhansen <
[email protected]> wrote:

>
> Hello Fred,
>
> something like:
>
> if(! LoginService.checkLogin(user, password) ) {
>    displayError();
> }
>
> will not be possible with GWT, I guess?
>

That's correct. You don't want to block by performing a synchronous test on
what is inherently an asynchronous process, i.e. client-server
communication.



>
> Furthermore, I do not understand this part:
>
> void showContact(final Contact contact) {
>  service.execute(new GetDetails(contact.getDetailIds()),
>    new GotDetails() {
>      public void got(ArrayList<ContactDetail> details) {
>        renderContact(contact);
>        renderDetails(details);
>      }
>  });
> }
>
> Where do I have to do the actual RPC call, let's say, query a remote
> database?
>

service.execute(...) is in fact the actual RPC call. The got() method will
be called when the RPC call returns successfully.

Fred






>
> On 2 Jul., 18:25, Fred Sauer <[email protected]> wrote:
> > Ray has some sample code in one of his slides:
> http://code.google.com/events/io/sessions/GoogleWebToolkitBestPractic...
> >
> > See slide 24
> >
> > http://dl.google.com/io/2009/pres/Th_0200_GoogleWebToolkitArchitectur...
> >
> > 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]
> >
> > []
> >
>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to