Anton: thank you for reviewing the fix.

All: I need at least one more reviewer for the JDK part of the fix because we're going to back-port the change to 8u40. Could anyone please review it? Artem, Sergey, anyone?

For your convenience: https://javafx-jira.kenai.com/browse/RT-37149

http://cr.openjdk.java.net/~anthony/9-5.2/
https://bugs.openjdk.java.net/browse/JDK-8049065

--
best regards,
Anthony

On 8/5/2014 5:08 PM, Anthony Petrov wrote:
Anton, Artem, Steve,

Could you please review this fix?

--
best regards,
Anthony

On 7/18/2014 6:44 PM, Anthony Petrov wrote:
Hi Petr, Anton, Artem, Steve,

Please review the fix at https://javafx-jira.kenai.com/browse/RT-37149

Webrevs:

JDK: http://cr.openjdk.java.net/~anthony/9-5.2/

FX: http://cr.openjdk.java.net/~anthony/g-522-swingNodeDnD-RT-37149.3/


JavaFX implements the DragSourceContextPeer and DragGestureRecognizer so
that SwingNode content could pose as a drag source. In order to support
a drop target, the DropTargetContextPeer is implemented in SwingNode and
the add/removeDropTarget() methods register/unregister the drop target
listeners.

The changes in JDK are mostly technical. We simply delegate the
Toolkit.createDragSourceContextPeer() and
Toolkit.createDragGestureRecognizer() factory methods to SwingNode.
Similarly, we delegate the DropTargetPeer.add/removeDropTarget()
operations to SwingNode as well.

In FX I've factored out the CachingTransferable class from the
SwingDragSource class so as to share the implementation with the
SwingNode DnD support. Also I've added a few utility methods to
DataFlavorUtils and SwingFXUtils. The main fix is the new code in
FXDnD.java which actually implements the AWT interfaces, installs
appropriate event handlers on the SwingNode node in FX, and handles all
the DnD events.

Note that the JDK <-> FX interface is loose because I use default
methods in the LightweightContent interface, so that you can run new FX
with the old JDK, or old FX with the new JDK, and nothing should break.
Obviously, the DnD in SwingNode will only work if both JDK and FX are
patched.

I've tested these changes on Windows and Mac with the sample code from
this JIRA as well as a JFXPanel DnD test application from RT-34283. The
DnD works fine for me in both intra- and inter-process modes.

Please post your review comments in JIRA.

--
best regards,
Anthony

Reply via email to