| home / programming / web_apps / drag_and_drop |
[previous] [next] |
|
|
The XML configuration file for our application is shown in Listing 6.1.
Listing 6.1 com/gwtsolutions/DragAndDrop.gwt.xml
The drag-and-drop application uses GWT internationalization, so we inherit GWT's I18N module in addition to the User module.
The drag-and-drop module resides in the GWT Solutions Components module, so we inherit both of those modules in our application's configuration file.
The configuration file also includes its CSS stylesheet in the configuration file. We could have included the stylesheet with a standard link element in the application's HTML page, but including stylesheets in GWT configuration files is a more reusable solution because users can reuse your stylesheet along with your module. No one's ever going to reuse our application's module, but just the same, we prefer including stylesheets in configuration files to HTML pages in general.
Finally, we specify the entry point class for our application, com.gwtsolutions.client. DragAndDrop.
Now that we've seen how the drag-and-drop application uses the drag-and-drop module, let's look at the code for the application. We revisit the drag-and-drop module in "Drag and Drop Implementation in a GWT Module" on page 182, where we look at the module's implementation.
Listing 6.2 shows the drag-and-drop application's class.
Listing 6.2 com.gwtsolutions.client.DragAndDrop
The preceding code is straightforward. We create an absolute panel, to which we add two shopping cart panels, each wrapped in a drop target. Then we create four music players and add each of them, wrapped in music player drag sources, to the absolute panel. After that flurry of activity, we have an absolute panel with four drag sources and two drop targets. Finally, we attach a CSS style to the absolute panel and add it to the root panel of the page.
The MusicPlayer and ShoppingCartPanel classes are GWT composite widgets. Let's look at their implementations before we dive into the dnd module.
| home / programming / web_apps / drag_and_drop |
[previous] [next] |
URL: