< prev index next >

modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingDnD.java

Print this page

        

*** 21,31 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package javafx.embed.swing; import java.io.UnsupportedEncodingException; import java.util.Collections; import java.util.ArrayList; --- 21,31 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package com.sun.javafx.embed.swing; import java.io.UnsupportedEncodingException; import java.util.Collections; import java.util.ArrayList;
*** 70,80 **** /** * An utility class to connect DnD mechanism of Swing and FX. * It allows FX content to use the AWT machinery for performing DnD. */ ! final class SwingDnD { private final Transferable dndTransferable = new DnDTransferable(); private final DragSource dragSource; private final DragSourceListener dragSourceListener; --- 70,80 ---- /** * An utility class to connect DnD mechanism of Swing and FX. * It allows FX content to use the AWT machinery for performing DnD. */ ! final public class SwingDnD { private final Transferable dndTransferable = new DnDTransferable(); private final DragSource dragSource; private final DragSourceListener dragSourceListener;
*** 88,98 **** // SwingDnD acts as a drag source private EmbeddedSceneDSInterface fxDragSource; private MouseEvent me; ! SwingDnD(final JComponent comp, final EmbeddedSceneInterface embeddedScene) { comp.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { storeMouseEvent(me); --- 88,98 ---- // SwingDnD acts as a drag source private EmbeddedSceneDSInterface fxDragSource; private MouseEvent me; ! public SwingDnD(final JComponent comp, final EmbeddedSceneInterface embeddedScene) { comp.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { storeMouseEvent(me);
*** 218,238 **** comp.setDropTarget(new DropTarget(comp, DnDConstants.ACTION_COPY | DnDConstants.ACTION_MOVE | DnDConstants.ACTION_LINK, dtl)); } ! void addNotify() { dragSource.addDragSourceListener(dragSourceListener); } ! void removeNotify() { // RT-22049: Multi-JFrame/JFXPanel app leaks JFXPanels // Don't forget to unregister drag source listener! dragSource.removeDragSourceListener(dragSourceListener); } ! HostDragStartListener getDragStartListener() { return (dragSource, dragAction) -> { assert Toolkit.getToolkit().isFxUserThread(); assert dragSource != null; // The method is called from FX Scene just before entering --- 218,238 ---- comp.setDropTarget(new DropTarget(comp, DnDConstants.ACTION_COPY | DnDConstants.ACTION_MOVE | DnDConstants.ACTION_LINK, dtl)); } ! public void addNotify() { dragSource.addDragSourceListener(dragSourceListener); } ! public void removeNotify() { // RT-22049: Multi-JFrame/JFXPanel app leaks JFXPanels // Don't forget to unregister drag source listener! dragSource.removeDragSourceListener(dragSourceListener); } ! public HostDragStartListener getDragStartListener() { return (dragSource, dragAction) -> { assert Toolkit.getToolkit().isFxUserThread(); assert dragSource != null; // The method is called from FX Scene just before entering
*** 309,319 **** } else { e.acceptDrop(transferModeToDropAction(dropResult)); } } ! static TransferMode dropActionToTransferMode(final int dropAction) { switch (dropAction) { case DnDConstants.ACTION_COPY: return TransferMode.COPY; case DnDConstants.ACTION_MOVE: return TransferMode.MOVE; --- 309,319 ---- } else { e.acceptDrop(transferModeToDropAction(dropResult)); } } ! public static TransferMode dropActionToTransferMode(final int dropAction) { switch (dropAction) { case DnDConstants.ACTION_COPY: return TransferMode.COPY; case DnDConstants.ACTION_MOVE: return TransferMode.MOVE;
*** 324,334 **** default: throw new IllegalArgumentException(); } } ! static int transferModeToDropAction(final TransferMode tm) { switch (tm) { case COPY: return DnDConstants.ACTION_COPY; case MOVE: return DnDConstants.ACTION_MOVE; --- 324,334 ---- default: throw new IllegalArgumentException(); } } ! public static int transferModeToDropAction(final TransferMode tm) { switch (tm) { case COPY: return DnDConstants.ACTION_COPY; case MOVE: return DnDConstants.ACTION_MOVE;
*** 337,347 **** default: throw new IllegalArgumentException(); } } ! static Set<TransferMode> dropActionsToTransferModes( final int dropActions) { final Set<TransferMode> tms = EnumSet.noneOf(TransferMode.class); if ((dropActions & DnDConstants.ACTION_COPY) != 0) { tms.add(TransferMode.COPY); --- 337,347 ---- default: throw new IllegalArgumentException(); } } ! public static Set<TransferMode> dropActionsToTransferModes( final int dropActions) { final Set<TransferMode> tms = EnumSet.noneOf(TransferMode.class); if ((dropActions & DnDConstants.ACTION_COPY) != 0) { tms.add(TransferMode.COPY);
*** 353,363 **** tms.add(TransferMode.LINK); } return Collections.unmodifiableSet(tms); } ! static int transferModesToDropActions(final Set<TransferMode> tms) { int dropActions = DnDConstants.ACTION_NONE; for (TransferMode tm : tms) { dropActions |= transferModeToDropAction(tm); } return dropActions; --- 353,363 ---- tms.add(TransferMode.LINK); } return Collections.unmodifiableSet(tms); } ! public static int transferModesToDropActions(final Set<TransferMode> tms) { int dropActions = DnDConstants.ACTION_NONE; for (TransferMode tm : tms) { dropActions |= transferModeToDropAction(tm); } return dropActions;
< prev index next >