concept drag - and - drop system in category gwt

appears as: drag-and-drop system
GWT in Practice

This is an excerpt from Manning's book GWT in Practice.

The final step in bringing our little example to fruition is writing the entry point. This is shown in listing 6.16, and it demonstrates how a drag-and-drop system that instruments classes in place, rather than requiring the developer to implement special drag-and-drop enabled classes, is easy to use. If you have worked with a very complex DnD system like Java Swing, the simplicity of using this kind of system is obvious.

There are a few things we need to do to the chapter 9 application to make this happen. First, we need to secure our administration tool and create a separate service for customers. Next, we need to build a drag-and-drop system using only the GWT APIs. Also, because the storefront is the customer-facing portion of our application, it should be pretty—we’ll look at adapting a JavaScript library to create reflections for our cover images, as if they were sitting on a reflective surface (see figure 10.3). Finally, we’ll bring it all together and construct a basic shopping cart system.

10.2. Building a drag-and-drop system

When we were looking at JSNI in chapter 6, we used the Script.aculo.us drag-and-drop system as an integration example. While this does work, it has certain drawbacks. First, it uses a separate JavaScript file that must be updated with new versions to support new browsers. One of the big advantages of using GWT is that when new versions are released, a simple recompile brings in all the new browser compatibility tweaks without changing or updating files. The second drawback is that those Script.aculo.us JavaScript files aren’t optimized by the GWT compiler, which includes obfuscation and compression. Since we depend on friendly named JavaScript methods, they can’t be compressed into bandwidth-friendly but non-human-readable versions. The obvious solution is to build a drag-and-drop system with GWT.