[OpenMap Users] drag and drop - totally stumped

From: Matt Brennan <openmap_at_classforge.com>
Date: Wed, 30 May 2007 15:55:55 +0930

Hope you can help... I am working with two DropCatchers that extend
DefaultDnDCatcher. The intent of having two catchers was to:

- allow the existing drop catcher to do its stuff and

- add another catcher that would understand dragging tools off the
toolbar and dropped onto a "DialogLayer" where they would provide "in
MapBean" controls for touch screen users. I've sent this code off as a
contribution to openmap though not sure of its status.

The two catchers play nicely enough together in recognising the drag
gestures. Both catchers add DropTargets to the respective layers
(careful not to overwrite the exsiting DropTarget).

The relevant code in DefaultDnDCatcher is:

   new DropTarget(allLayers[i], DnDConstants.ACTION_MOVE, this)

(which amazingly modifies the Component allLayers[i])

The catchers are careful too to pick up on the correct drag gestures by:

1. Creating a new MultiCatcherDragGestureListener that understands more
than one catcher...

2. Allowing one catcher to be the master and in find and init adding
other cacthers to its instance of MultiCatcherDragGestureListener like:

if (obj instanceof DefaultDnDCatcher && !(obj == this)) {
DefaultDnDCatcher catcher = (DefaultDnDCatcher) obj;
((MultiCatcherDragGestureListener)dragGestureListener).addCatcher(catcher);
}

I attach these two classes for ref.

So much for the preamble... the problem occurs when dragging and
dropping on the map. When the drop or drag-over occurs, AWT looks only
at the top layer (Component) and asks what its DropTarget would like to do.

I attach a picture of the stack when a drop intended for layer two in
the stack is dispacthed by the top layer. The top layer invokes
rejectDrop() and i hoped that the drop event would then be offered to
the next DropTarget/Component down the stack... but no joy!!!

So any ideas?

Is two drop catchers one too many?

How can I specifically identify the eventual target when starting a drag?

Why does rejectDrop() look further?

I dunno, I'm a bit stumped and any DnD gurus out there would earn my
undying thanks for suggestions!!

Cheers,

   matt



--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]

stack.JPG
(image/jpeg attachment: stack.JPG)

Received on Wed May 30 2007 - 02:32:47 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT