After successfully building the eventBus, I decided to extend the application to use the MVP (Model-View-Presenter) pattern. The use of this pattern is nicely explained on the google testing blog. Since it’s quite a new way of doing this, there is very little example code available.
Since the gwt best practices are mostly focused on testing, and testing is an invaluable part of application design, we’ll write the test first. I’m not going in detail about Test Driven Development, there are plenty of good books around.
(more…)
GWT 1.6 MVP and testing, part 1
GWT: capturing mouse position, drag and drop
If you need to use drag and drop in your GWT application, there is a wonderful library available: gwt-dnd. Check out the demo: it offers almost everything one might expect from drag&drop.
Sometimes though, such a vast and feature-rich library is too much. I needed to create a custom scrollbar, and to do this with gwt-dnd is not that simple, since its constraint panel only affects the dropzone while the draggable element can still be dragged anywhere in the main AbsolutePanel.
So I looked for another way, and in fact it isn’t hard at all:
(more…)
Building a GWT 1.6 application: Managing events with an eventBus
GWT 1.6 gets rid of all the Listener classes, and replaces them with the new Handler classes. For a comparison of the two, Jason from Lemming Technology Blog has a good overview.
At Google I/O, Ray Ryan talks about best practices for architecting your GWT app. There he mentions using an Eventbus to manage your events, and even provides some example code. Still, it all seemed a bit confusing, so I made a little testapplication to test it out.
(more…)