Hi, Gregor! Thanks forreply. I understand that i can't simply use rpc call right in widget event handler, but i want to separate this transport/business layer from widget.
My widget simply shows list of items of some class(Group) and provide control elements to manupulate them: edit, delete, add etc. I am simply interested in a approach. maybe there is some standart way advices For now - i provide two methods for widget client - void add(Group) void onAdd/onSuccessAdd(Group) maybe there is some more cultural way ? =) On 2 дек, 13:37, gregor <[EMAIL PROTECTED]> wrote: > 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 GUIwidgetthat 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; > > //buildwidgetskeleton > > //init structures > > } > > > public void onClick(Widgetsender) { > > 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 thiswidgetwill use async requests, so > > methods in controller must have void as > > a return type, but how can i notifywidgetthat group is created ? > > Should i add such methods towidget > > 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 -~----------~----~----~----~------~----~------~--~---