Title: Events on GWT Post by: marcelotmelo on October 18, 2008, 03:22:25 Hi all,
we're using puremvc for Java on a GWT project. I've wrapped my mind around almost everything, but one doubt still haunts me. How to properly handle events sent by widgets on GWT? In Flex we could create and dispatch an Event on the view, and register the mediator as a listener to this event. I thought about doing the same in GWT, but dispatching an Event from the view as is done in Flex doesn't seem like an option... What I could do is making my Mediator implement the Listener, get each widget that needs such listener from the view and add itself as a ClickListener. This seems fairly complicated to me, and I am only doing this in order to avoid a coupling between the View and Mediator on the View level, since I could add a reference to the Mediator on the view, and when creating each button I would simply add the mediator as a Listener. That would be simpler, but does not look like the PureMVC way. Anyone has a better idea? One that would be fit to the puremvc principles? Thanks! Title: Re: Events on GWT Post by: marcelotmelo on October 23, 2008, 04:47:09 Well, seems like no one is using PureMVC and GWT... I am starting to regret my decision...
Title: Re: Events on GWT Post by: puremvc on October 26, 2008, 07:12:53 Hi Marcel,
I am sorry no one caught this. I expected the Java port owner to respond. I will email him. -=Cliff> Title: Re: Events on GWT Post by: marcelotmelo on October 27, 2008, 05:10:59 I asked the same question and got a lot of answers on the GWT list, thanks.
Title: Re: Events on GWT Post by: puremvc on October 28, 2008, 07:01:05 Would you be kind enough to share those answers with us for the next weary traveller passing through?
Thanks, -=Cliff> Title: Re: Events on GWT Post by: marcelotmelo on October 28, 2008, 09:17:34 Sure!
Here's the link for the whole thread: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/67e81d9d761598e2/f7a4ec3ad0ff1725?hl=en&lnk=gst&q=puremvc#f7a4ec3ad0ff1725 Title: Re: Events on GWT Post by: puremvc on October 30, 2008, 06:17:31 Thanks!
This port is just getting off the ground which is why its still marked as in beta. We can use all the input we can get! Cheers, -=Cliff> Title: Re: Events on GWT Post by: mkn on February 11, 2009, 04:54:51 Hello,
This port is just getting off the ground which is why its still marked as in beta. Does the google code site contain the latest version (dated Septemper) ? I noticed that the demo and the library are not compatible, at least and it takes an awful lot of development time to try to fix the differences. Markku Title: Re: Events on GWT Post by: puremvc on February 11, 2009, 06:27:44 The latest code should be on the trunk. There are changes there about to be tagged 1.0.3.
Also, Anthony Quinault has produced some demos to go with it, which we are going to get into the repo publish at the same time as the new MultiCore version when he gets back from holiday. -=Cliff> Title: Re: Events on GWT Post by: mkn on February 11, 2009, 08:04:18 ...when he gets back from holiday. Ok, thanks, Cliff. I will try to find the repository and download the latest version. Looking forward to Anthony coming back :) Edit: found the repository - always forget where it is in the google code sites! Markku Title: Re: Events on GWT Post by: puremvc on February 11, 2009, 09:14:54 No, sorry. The google code site was put up before the port was moved to the PureMVC repo. The google code site should be shut down.
The url is http://trac.puremvc.org/PureMVC_Java_MultiCore -=Cliff> Title: Re: Events on GWT Post by: aquinault on May 07, 2009, 08:56:57 Hi,
I recently coded the port of EmployeeAdmin for GWT. Is anyone interested by this port and another examples? Anthony Quinault. Title: Re: Events on GWT Post by: denne on June 19, 2009, 01:26:05 I solved the situation with GWT and Java not supporting events like the examples use in ActionScript with creating my own Callback interface.
In the UI Code: And previously in the constructor of the Mediator, the Mediator has called this method on the view to register a Callback event in the mediator. Resulting in the same behaviour as in action script addEventListener. Any comments about this solution? Any better solution found? How does other people do this? Title: Re: Events on GWT Post by: aquinault on June 19, 2009, 03:17:24 I think you should use :
submitCommand.addClickHandler(new ClickHandler(){ @Override @Override Anthony. Title: Re: Events on GWT Post by: denne on June 19, 2009, 05:05:11 The best practice guide (Page 13, Notification vs Events) shows that Notifications should be used to communicate between PureMVC actors Mediators, Commands and Proxies.
Between Proxies and VOs and Mediators and View Components local means like Events or direct messages/method calls of your own choice. Title: Re: Events on GWT Post by: fede on July 02, 2009, 05:37:30 The best practice guide (Page 13, Notification vs Events) shows that Notifications should be used to communicate between PureMVC actors Mediators, Commands and Proxies. Yes this is also what i think so i've resolved this issue using the new event system of gwt 1.6 that make possible to define and fire custom event from view that are cached from the mediators: ex:
in the code above when the mediator instantiate it's view component register itself as a listener of NotificationEvents of the view. so when the view fire a NotificationEvent its onNotificationEvent gets called, now the mediator can decide if manage localli this events of send an application level Notification build from the NotificationEvent |