<AWT Dev> [9/8u40] Review request for RT-37149 and JDK-8049065 : Implement DnD for SwingNode

Anthony Petrov anthony.petrov at oracle.com
Tue Aug 5 13:08:52 UTC 2014

Anton, Artem, Steve,

Could you please review this fix?

best regards,

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

More information about the awt-dev mailing list