Native GWT drag and drop vs gwt-dnd vs other?

1,197 views
Skip to first unread message

Rori Stumpf

unread,
Jan 19, 2012, 2:17:49 PM1/19/12
to Google Web Toolkit
I need drag and drop capability, what's the best way to go? I've
looked at the GWT drag and drop demo so far, have not tried any code.
So, what do you suggest... native GWT drag and drop, or something like
gwt-dnd (which seems to be the most popular now but predates native
support)?

Thomas Broyer

unread,
Jan 20, 2012, 4:16:04 AM1/20/12
to google-we...@googlegroups.com
GWT drag-n-drop is "only" a support for existing "native" APIs (which also means you can control drags to and drops from outside the browser).
AFAIK, gwt-dnd however "emulates" DnD using mouse events (mousedown + mousemove starts a drag, and then mouseup drops), which means you can only drag things within your app.

Native DnD (as supported by GWT) can be used in most browsers though: http://caniuse.com/dragndrop
(it's unlike canvas, for instance, where oldIEs have to use a fallback or emulation)

Rori Stumpf

unread,
Jan 20, 2012, 7:32:55 AM1/20/12
to Google Web Toolkit
Thanks, I'll go with native.

Thomas Broyer

unread,
Jan 20, 2012, 9:07:17 AM1/20/12
to google-we...@googlegroups.com
While replying to another question about GWT 2.4 DnD support, I remembered about another big difference: the "native DnD" deals with data, so you cannot "drag and drop widgets" (you'll instead DnD data, and update –including disposing and creating– widgets in response).
gwt-dnd however can DnD widgets (as it's just about reparenting them in response to the final "mouseup" event)

Julien Dramaix

unread,
Jan 23, 2012, 7:36:40 AM1/23/12
to Google Web Toolkit
Another good way to implement "drag and drop widget" is o use the drag-
and-drop plugin of GWTQuery. It's very easy to use and it supports
drag and drop in cell widgets.

Examples : http://gwtquery-plugins.googlecode.com/svn/trunk/droppable/demo/GwtSimpleSample/GwtSimpleSample.html
Documentation : http://code.google.com/p/gwtquery-plugins/wiki/DragAndDropPluginForGWTDeveloppers
Reply all
Reply to author
Forward
0 new messages