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