Google Web Toolkit Solutions: Implement Drag and Drop in Your Web Apps
The ultimate in user interactivity, drag and drop is taken for granted in desktop applications but is a litmus test of sorts for web applications: If you can easily implement drag and drop with your web application framework, then you know you've got something special.
In this solution, we explore drag-and-drop implementation with GWT. We implement drag and drop in a module of its own so that you can easily incorporate drag and drop into your applications.
Stuff You're Going to Learn
This solution explores the following aspects of GWT:
- Implementing composite widgets with the Composite class (page 174)
- Removing widgets from panels (page 169)
- Changing cursors for widgets with CSS styles (page 200)
- Implementing a GWT module (page 182)
- Adding multiple listeners to a widget (page 186)
- Using the AbsolutePanel class to place widgets by pixel location (page 211)
- Capturing and releasing events for a specific widget (page 191)
- Using an event preview to inhibit browser reactions to events (page 196)
See Solution 1 and Solution 2 for more in-depth discussions of implementing GWT modules and implementing composite widgets, respectively.