Drag and Drop API in GWT 2.4

1,495 views
Skip to first unread message

stagirus

unread,
Jan 19, 2012, 10:33:40 PM1/19/12
to Google Web Toolkit
I am glad to see that GWT team has introduced Drag and Drop support in
GWT 2.4. We have been using SmartGWT just for Drag and Drop
functionality in one module. We are just switching to GWT 2.4 and
tried to implement DnD functionality using GWT 2.4 API. Most of the
API seems pretty friendly. But I am highly surprised to learn that
none of the panels (except SimplePanel) supports drag & drop. Panels
(Absolute, Vertical, etc.) play an extremely importat role in GWT. Was
it an oversight not support drag and drop for complex panels? In our
requirements, panels act as drop targets.

I understand GWT drag and drop is still an experimental/developmental
API. I hope my above coments would help improve it further.

Can anybody suggest any panel or widget that could act as drop target
and also can hold (as parent) for several child widgets?
Alternatively, is there a simple way to introduce drag and drop
behavior to AbsolutePanel?

Thomas Broyer

unread,
Jan 20, 2012, 5:03:35 AM1/20/12
to google-we...@googlegroups.com
Er, put an AbsolutePanel in a FocusPanel, and add a DropHandler on the FocusPanel to handle the drop (and do whatever you want with the wrapped AbsolutePanel)?

Note that GWT's support for DnD is via the native browser API/events, so you transport "data", not "widgets", so what would a panel do with that? See http://dev.w3.org/html5/spec/dnd.html#the-drag-data-store

If you want to drag and drop widgets, you can use gwt-dnd instead (much lighter weight than SmartGWT)

stagirus

unread,
Jan 20, 2012, 11:15:40 AM1/20/12
to Google Web Toolkit
Thank you Thomas. I will try your suggestion of AbsolutePanel within a
FocusPanel. I suppose the container FocusPanel receives the drop
(mouse) events that actually occur within the child AbsolutePanel.

I am also intrigued by your comment on gwt-dnd. It does look promising
for our requirements. Thanks to Allen Sauer. I got the impression that
GWT 2.4 is natively trying to support the same functionality offered
by gwt-dnd. I noticed Allen Sauer joined Google's DND team/project.
(What is your plan Allen?)

Again, thank you Thomas for your helpful reply!


On Jan 20, 3:03 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> Er, put an AbsolutePanel in a FocusPanel, and add a DropHandler on the
> FocusPanel to handle the drop (and do whatever you want with the wrapped
> AbsolutePanel)?
>
> Note that GWT's support for DnD is via the native browser API/events, so
> you transport "data", not "widgets", so what would a panel do with that?
> Seehttp://dev.w3.org/html5/spec/dnd.html#the-drag-data-store

Martones

unread,
Feb 25, 2012, 5:55:47 AM2/25/12
to Google Web Toolkit
Hi Stagirus, if you dont need to drag Widgets you shall be
theoretically able to drag / dragOver / drop any widget.

For that, use widget.addDomHandler (as explained here
http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/fr//events/io/2011/static/presofiles/gwt_html5_a_web_develops_dream.pdf)

But if you need to drag the widget itself you need to use dnd or
gwtquery. The latter has support for cells which I didnt manage to get
working with the native dnd.

Ludovit

On 20 jan, 17:15, stagirus <mohanam...@gmail.com> wrote:
> Thank you Thomas. I will try your suggestion of AbsolutePanel within a
> FocusPanel. I suppose the container FocusPanel receives thedrop
> (mouse) events that actually occur within the child AbsolutePanel.
>
> I am also intrigued by your comment on gwt-dnd. It does look promising
> for our requirements. Thanks to Allen Sauer. I got the impression that
> GWT 2.4 is natively trying to support the same functionality offered
> by gwt-dnd. I noticed Allen Sauer joined Google's DND team/project.
> (What is your plan Allen?)
>
> Again, thank you Thomas for your helpful reply!
>
> On Jan 20, 3:03 am, Thomas Broyer <t.bro...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Er, put an AbsolutePanel in a FocusPanel, and add a DropHandler on the
> > FocusPanel to handle thedrop(and do whatever you want with the wrapped
> > AbsolutePanel)?
>
> > Note that GWT's support for DnD is via the native browser API/events, so
> > you transport "data", not "widgets", so what would a panel do with that?
> > Seehttp://dev.w3.org/html5/spec/dnd.html#the-drag-data-store
>
> > If you want todraganddropwidgets, you can use gwt-dnd instead (much
> > lighter weight than SmartGWT)

Haja RAVELOMANANA

unread,
Apr 6, 2012, 5:36:59 AM4/6/12
to Google Web Toolkit
Hello Ludovit,

As you said, gwtquery supports dnd cell to cell. Is there any plan in
GWT to manage it in native ? if so, on which version ?
Thanks,

Haja

On 25 fév, 12:55, Martones <ludovit.marton...@gmail.com> wrote:
> Hi Stagirus, if you dont need to drag Widgets you shall be
> theoretically able to drag / dragOver / drop any widget.
>
> For that, use widget.addDomHandler (as explained herehttp://static.googleusercontent.com/external_content/untrusted_dlcp/w...)
>
> But if you need to drag the widget itself you need to usedndor
> gwtquery. The latter has support for cells which I didnt manage to get
> working with the nativednd.
>
> Ludovit
>
> On 20 jan, 17:15, stagirus <mohanam...@gmail.com> wrote:
>
>
>
> > Thank you Thomas. I will try your suggestion of AbsolutePanel within a
> > FocusPanel. I suppose the container FocusPanel receives thedrop
> > (mouse) events that actually occur within the child AbsolutePanel.
>
> > I am also intrigued by your comment on gwt-dnd. It does look promising
> > for our requirements. Thanks to Allen Sauer. I got the impression that
> > GWT 2.4 is natively trying to support the same functionality offered
> > by gwt-dnd. I noticed Allen Sauer joined Google'sDNDteam/project.
> > (What is your plan Allen?)
>
> > Again, thank you Thomas for your helpful reply!
>
> > On Jan 20, 3:03 am, Thomas Broyer <t.bro...@gmail.com> wrote:
>
> > > Er, put an AbsolutePanel in a FocusPanel, and add a DropHandler on the
> > > FocusPanel to handle thedrop(and do whatever you want with the wrapped
> > > AbsolutePanel)?
>
> > > Note that GWT's support forDnDis via the native browser API/events, so
> > > you transport "data", not "widgets", so what would a panel do with that?
> > > Seehttp://dev.w3.org/html5/spec/dnd.html#the-drag-data-store
>
> > > If you want todraganddropwidgets, you can use gwt-dndinstead (much
> > > lighter weight than SmartGWT)
Reply all
Reply to author
Forward
0 new messages