Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I achieved something on these lines for our project. I wanted a event-driven mechanism (think of PropertyChangeSupport and PropertyChangeListener of standard jdk lib) which were missing. I believe there is an extension module and decided to go ahead with my own. You can google it for propertychangesupport gwt and use it or go with my approach.</p> <p>My approach involved logic centred around MessageHandler and GWTEvent. These serve the same purpose as that of PropertyChangeListener and PropertyChangeEvent respectively. I had to customize them for reasons explained later. My design involved a MessageExchange, MessageSender and MessageListener. The exchange acts as a broadcast service dispatching all events to all listeners. Each sender fires events that are listened by the Exchange and the exchange the fires the events again. Each listener listens to the exchange and can decide for themselves (to process or not to process) based on the event.</p> <p>Unfortunately MessageHandlers in GWT suffer from a problem: "While a event is being consumed, no new handlers can be hooked". Reason given in the GWT form: The backing iterator holding the handlers cannot be concurrently modified by another thread. I had to rewrite custom implementation of the GWT classes. That is the basic idea.</p> <p>I would've posted the code, but I am on my way to airport right now, will try to post the code as soon as I can make time.</p> <p><strong>Edit1:</strong></p> <p>Not yet able to get the actual code, got hold of some power-point slides I was working on for design documentation and created a blog entry. </p> <p>Posting a link to my blog article: <a href="http://questzen.blogspot.com/2010/05/event-handling-in-gxt-gwt.html" rel="nofollow noreferrer">GXT-GWT App</a></p> <p><strong>Edit2:</strong></p> <p>Finally some code soup. <a href="http://questzen.blogspot.com/2010/05/gxt-gwt-code-nuggets.html" rel="nofollow noreferrer">Posting 1</a> <a href="http://questzen.blogspot.com/2010/05/gwt-gxt-building-message-event.html" rel="nofollow noreferrer">Posting 2</a> <a href="http://questzen.blogspot.com/2010/05/gwt-illustrating-usage-of-previous.html" rel="nofollow noreferrer">Posting 3</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COThank you for your answer. Could you compare your MessageExchange to Banang's EventBus? I'm not sure at the moment what you get by making all the listeners evaluate every event application-wide to see if it's something they should handle, which is how I understood the MessageExchange approach to work...
      singulars
    2. COQuick answer; some call it potaatoe, some call it potaytoe! I really did not try to achieve MVP in the first place. I was trying to achieve an event-driven solution. My team-member has later directed me towards Martin Fowler's article on MVP. I was glad that the design was sane and was actually fitting into a paradigm. The key difference from MVP: In MVP view listens to presentors. In my case any entity can listen to any (chaining of listeners/models). The communication is via events Exception: Server-side communication, I wrote a dispatch controller layer (for unit test sake) contd:
      singulars
    3. CORational: I visualised my design as an telephone exchange. In real world, we can not have a telephone line between every handset: NC2 lines or N(N-1)/2. We connect to an exchange so only N lines are needed. Think of each line as a reference to listener, the object-reference propagation would be drastically reduced. IMO, MVP actually doesn't ask for a centralized exchange/bus. One can easily see the benefit of event bus (while coding) and use it. Banang's solution is a nice one. My solution was based on composition where as she used inheritance. A difference of opinion, I guess.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload