fredsa / gwt-dnd

Library providing easy to use mouse or touch based drag-and-drop capabilities to GWT
43 stars 41 forks source link

All drop controllers other than BoundaryDropController are ignored? #108

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to create a DnD-compatible Tree with the usual folder/contents
hierarchy. However, when I register DropControllers for the folders, the
PickupDragController ignores them in favor of the built-in
BoundaryDropController.

What version of GWT are you using? 1.3.3? 1.4.60? Other? 1.6.x

What version of the gwt-dnd jar file or library file are you using? 2.6.5

What operating system(s) are you using? Windows

Does the issue occur in web mode, hosted mode, both or don't know? Web;
haven't tried in hosted

What browser(s) do you use? Firefox

What is the browser version (if you know) from Help->About? 3.6

What steps will reproduce the problem? Please attach sample code if you
can.
1. Compile and run the attached Java class. It's a GWT Tree subclass with a
couple of methods added to it: makeDraggable(TreeItem), which does just
what it says, and makeDroppable(TreeItem), which registers a custom
DropController for the item.

What is the expected output? What do you see instead?
I have GWT logging turned on, and I expect to see my "onDrop()" string
printed to the console when I drop a leaf node onto a folder. However, I
see nothing. Walking through the code using Firebug, it seems that when
PickupDragController.resetCache() is called by
PickupDragController.dragMove(), it checks the registered DropControllers
to see whether any of them intersect with the dragged widget's coordinates,
but it never finds that any of the folders' DropControllers intersect. Why
not? What have I done wrong?

Do you have a workaround?
No.

Please provide any additional information below.

Original issue reported on code.google.com by nrit...@gmail.com on 23 Mar 2010 at 5:50

Attachments:

GoogleCodeExporter commented 9 years ago
You can use CSS to temporarily highlight all the boundaries of the drop 
targets. That 
may help diagnosing the issue.

Original comment by fredsa@google.com on 26 Mar 2010 at 6:24

GoogleCodeExporter commented 9 years ago
Hi, Fred. I did that, and I also investigated this further. It turns out that 
the
culprit is using RootPanel.get() for the PickupDragController's constructor 
instead
of some other AbsolutePanel. In Firefox, none of the DropControllers were found 
to
overlap any boundaries with the PickupDragController's constructor argument, 
because
RootPanel.get() wasn't reporting the correct size: in my case, it said it 
stretched
from (0,0) to (922,2). In IE, the size was correct. I wound up working around 
this by
adding my Tree to an AbsolutePanel that contained only it, and that 
AbsolutePanel was
then passed to the PickupDragController that the tree uses. It's possible that
another workaround is to assign Drag- and DropControllers to components only 
*after*
they've all been added (on the assumption that the RootPanel will size itself
correctly), but that wasn't feasible in my case.

I haven't yet determined whether the bug is in GWT, or gwt-dnd. I have 
confirmed that
the bug also exists in GWT 2.0.3 + gwt-dnd-3.0.1. Are you caching the 
RootPanel's
size somewhere?

At the very minimum, the GettingStarted document should be updated to use an
AbsolutePanel *other* than the one returned by RootPanel.get().

Original comment by nrit...@gmail.com on 26 Mar 2010 at 10:02

GoogleCodeExporter commented 9 years ago
I clarified the wiki and javadoc on this point

Original comment by fredsa@google.com on 26 Mar 2010 at 11:49