问题
I know very little about Drag n Drop in Gwt. I searched on internet & it seems that there are 2 different packages (or 2 options) for doing drag n Drop.
https://code.google.com/p/gwtquery-plugins/wiki/DragAndDropPluginForGWTDeveloppers
&
https://code.google.com/p/gwt-dnd/source/browse/DragDrop/
Why Google developed 2 different strategies for DnD? Which one is better?
回答1:
The GWT drag&drop implementation is based on the HTML5 D&D API. Such API basically allows you to transfer data using native drag&drop. That means you can, for instance, drag things from outside the browser. Simplifing, you need to setup a drag element, a drop target and the DataTransfer object which will hold the actual data to transfer. I guess it can also be used to simulate drag&drop of DOM elements (say, widgets) within an app by creating&destroying (on dragstart and on dragend), but its purpose is different.
Since this API is rather new, not every browser natively support it. See http://caniuse.com/dragndrop. See also this video along with its presentation to get you started.
On the other side gwt-dnd was meant to really drag&drop widgets within an application. So you can, out of the box, move things around. Also, this library is not developed directly by Google (although its author work/ed for the company). See its wiki and showcase.
Another relatively recent library, is the drag&drop plugin for GwtQuery. GwtQuery is a jQuery-like library for GWT, and its d&d support is via the previous plugin. It also support d&d between cell widgets. See its showcase. Also in this case, such library is meant to provide d&d capabilities to native GWT widgets.
来源:https://stackoverflow.com/questions/16250178/in-gwt-there-are-2-different-packages-or-2-options-for-doing-drag-n-drop-whi