Hi Neo,

>
> I would like to put all my RPC calling logic in some sort of a
> delegate class and let the delegate class return the values to my
> Client class. But I doubt if that will work out as the return type of
> the onSuccess method is void :(
>
> To summerize, this is what I would like to have :
> Client (Design Layout, Call delegate method) ---------------->
> Delegate (make RPC calls, return value to Client) ------------->
> Server (Implement DAO logic, return value to delegate)
>
> Is it possible to achieve this sort of a design with GWT apps ?
>

What I think is causing you a problem is the asynchronous nature of
AJAX server calls and GWT RPC in particular. You cannot avoid this, so
you cannot have your server call simply return a value to the method
that originated it  - you have to call a method on your widget
somewhere (or something else) from the callback, i.e. onSuccess().

As Miroslav demonstrates, you can use a full blown MVC design to
encapsulate this process. In this case the view (i.e. widgets) will
delegate the task of calling the server to a controller which now
handles the asynch call details and updates the Model. An model change
event is then fired that the widgets listen out for and update their
displays accordingly.

IMO opinion the real value in this approach is if you have more than
one widget, or UI component, that uses the same model objects (and
therefore would ideally share server calls) since this makes for
significant reuse and also keeps multiple views of the same model data
in line. Otherwise it can make for more work and more complicated
code.

Whatever, the thing is you cannot avoid the asynchronous nature of RPC
calls, you have to live with them.

regards
gregor

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