Hi Relaxo,

The simplest way is to make your RPC call from addBtn.onClick() using
an anonymous Callback where this callback's onSuccess(..) method adds
the new Group List<Group> groups and changes the view as required.
There may be reasons why this would not meet your requirements, but it
is not possible to say from your example, i.e. on the face of it you
do not need the controller interface. There isn't a single "right" way
to do asynchronous RPC - it is possible to over-engineer it and
equally it's possible to under-engineer it.

If in fact your situation is more complicated than the example
(leading to a motivation for using this controller interface),
probably best to give some idea of the overall problem to get further
advice and options (of which there are several).

regards
gregor

On Dec 2, 8:15 am, raxelo <[EMAIL PROTECTED]> wrote:
> First of all sorry for my english.
>
> I want to write simple GUI widget that will help me to add and delete
> some business groops
> like this.
>
> public class GroupWidget extends Composite implements ClickListener {
>           private Controller controller;
>           private List<Group> groups;
>
>           public GroupWidget(List<Group> groups, Controller
> controller) {
>                    this.controller = controller;
>                    //build widget skeleton
>                    //init structures
>           }
>
>           public void onClick(Widget sender) {
>                    if(sender == addBtn) {
>                          //creating group object using entered date
> such as name, picture etc...
>                          this.controller.add(group);
>                    }
>           }
>
>           static interface Controller  {
>                Group add(Group group);
>                void delete(Group group);
>           }
>
> }
>
> but, i can't understand how it must work with async requests
>
> Application that will use this widget will use async requests, so
> methods in controller must have void as
> a return type, but how can i notify widget that  group is created ?
> Should i add  such methods to widget
> onAdd(Group newlyCreatedGroup) and
> onDelete() , that controller implementor have to call after receiving
> a response or maybe there is some
> approach or pattern.
>
> Thanks a lot
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to