--- old/src/java.desktop/share/classes/module-info.java 2018-05-07 13:54:36.359790300 +0530 +++ new/src/java.desktop/share/classes/module-info.java 2018-05-07 13:54:35.499741200 +0530 @@ -108,7 +108,14 @@ // qualified exports may be inserted at build time // see make/GensrcModuleInfo.gmk exports sun.awt to - jdk.accessibility; + jdk.accessibility, + jdk.unsupported.desktop; + + exports java.awt.dnd.peer to jdk.unsupported.desktop; + exports sun.awt.dnd to jdk.unsupported.desktop; + exports sun.swing to jdk.unsupported.desktop; + exports sun.awt.image to jdk.unsupported.desktop; + exports sun.java2d to jdk.unsupported.desktop; opens javax.swing.plaf.basic to jdk.jconsole; @@ -131,6 +138,8 @@ uses javax.sound.sampled.spi.FormatConversionProvider; uses javax.sound.sampled.spi.MixerProvider; + uses sun.swing.InteropProvider; + provides sun.datatransfer.DesktopDatatransferService with sun.awt.datatransfer.DesktopDatatransferServiceImpl; --- /dev/null 2018-05-07 13:54:41.000000000 +0530 +++ new/src/java.desktop/share/classes/sun/swing/InteropProvider.java 2018-05-07 13:54:40.352018700 +0530 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 sun.swing; + +public interface InteropProvider { +} --- /dev/null 2018-05-07 13:54:44.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/module-info.java 2018-05-07 13:54:43.481197700 +0530 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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. + */ +/** + * This module is intended for use only by the javafx.swing module + * for the purpose of FX/Swing interop + */ +module jdk.unsupported.desktop { + + requires transitive java.desktop; + + exports jdk.swing.interop; + + provides sun.swing.InteropProvider + with jdk.swing.interop.internal.InteropImpl; + +} + --- /dev/null 2018-05-07 13:54:47.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/LightweightFrameWrapper.java 2018-05-07 13:54:46.581375000 +0530 @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 jdk.swing.interop; + +import java.awt.AWTEvent; +import java.awt.Container; +import java.awt.Component; +import java.awt.event.WindowFocusListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseWheelEvent; +import java.awt.event.KeyEvent; +import sun.awt.LightweightFrame; +import sun.awt.UngrabEvent; +import sun.awt.AWTAccessor; +import sun.swing.JLightweightFrame; + +/** + * This class wraps sun.swing.JLightweightFrame and implements + * APIs to be used by FX swing interop to access and use JLightweightFrame APIs. + */ +public class LightweightFrameWrapper { + + JLightweightFrame lwFrame; + + public LightweightFrameWrapper() { + lwFrame = new JLightweightFrame(); + } + + private JLightweightFrame getLightweightFrame() { + return lwFrame; + } + + public void notifyDisplayChanged(final int scaleFactor) { + lwFrame.notifyDisplayChanged(scaleFactor, scaleFactor); + } + + public void overrideNativeWindowHandle(long handle, Runnable closeWindow) { + lwFrame.overrideNativeWindowHandle(handle, closeWindow); + } + + public void setHostBounds(int x, int y, int w, int h) { + lwFrame.setHostBounds(x, y, w, h); + } + + public void dispose() { + lwFrame.dispose(); + } + + public void addWindowFocusListener(WindowFocusListener listener) { + lwFrame.addWindowFocusListener(listener); + } + + public void addNotify() { + lwFrame.addNotify(); + } + + public void setVisible(boolean visible) { + lwFrame.setVisible(visible); + } + + public void setBounds(int x, int y, int w, int h) { + lwFrame.setBounds(x, y, w, h); + } + + public void setContent(final LightweightContentWrapper lwCntWrapper) { + lwFrame.setContent(lwCntWrapper.getContent()); + } + + public void emulateActivation(boolean activate) { + lwFrame.emulateActivation(activate); + } + + public MouseEvent createMouseEvent(LightweightFrameWrapper lwFrame, + int swingID, long swingWhen, int swingModifiers, + int relX, int relY, int absX, int absY, + int clickCount, boolean swingPopupTrigger, + int swingButton) { + return new java.awt.event.MouseEvent(lwFrame.getLightweightFrame(), + swingID, swingWhen, + swingModifiers, + relX, relY, absX, absY, clickCount, + swingPopupTrigger, swingButton); + } + + public MouseWheelEvent createMouseWheelEvent(LightweightFrameWrapper lwFrame, + int swingModifiers, int x, int y, int wheelRotation) { + return new MouseWheelEvent(lwFrame.getLightweightFrame(), + java.awt.event.MouseEvent.MOUSE_WHEEL, + System.currentTimeMillis(), + swingModifiers, x, y, 0, 0, 0, false, + MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, wheelRotation); + } + + public KeyEvent createKeyEvent(LightweightFrameWrapper lwFrame, + int swingID, long swingWhen, int swingModifiers, + int swingKeyCode, char swingChar) { + return new java.awt.event.KeyEvent(lwFrame.getLightweightFrame(), + swingID, swingWhen, swingModifiers, swingKeyCode, + swingChar); + } + + public AWTEvent createUngrabEvent(LightweightFrameWrapper lwFrame) { + return new UngrabEvent(lwFrame.getLightweightFrame()); + } + + public Component findComponentAt(LightweightFrameWrapper cont, int x, int y, boolean ignoreEnabled) { + Container lwframe = cont.getLightweightFrame(); + return AWTAccessor.getContainerAccessor().findComponentAt(lwframe, x, y, ignoreEnabled); + } + + public boolean isCompEqual(Component c, LightweightFrameWrapper lwFrame) { + return c != lwFrame.getLightweightFrame(); + } +} --- /dev/null 2018-05-07 13:54:50.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/LightweightContentWrapper.java 2018-05-07 13:54:49.610548200 +0530 @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 jdk.swing.interop; + +import java.awt.Component; +import java.awt.dnd.DragGestureRecognizer; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.InvalidDnDOperationException; +import java.awt.dnd.peer.DragSourceContextPeer; +import java.awt.dnd.DropTarget; +import javax.swing.JComponent; +import sun.swing.LightweightContent; + +/** + * This class provides a wrapper over inner LightweightContentProxy class + * which implements jdk internal sun.swing.LightweightContent interface + * and provides APIs to be used by FX swing interop to access and use LightweightContent APIs. + */ +public class LightweightContentWrapper { + private LightweightContentProxy lwCnt; + + public LightweightContentWrapper() { + lwCnt = new LightweightContentProxy(); + } + + LightweightContentProxy getContent() { + return lwCnt; + } + + public void imageBufferReset(int[] data, int x, int y, int width, + int height, int linestride) {} + + public void imageBufferReset(int[] data, int x, int y, int width, int height, + int linestride, double scaleX, double scaleY) {} + + public JComponent getComponent() { + return null; + } + + public void paintLock() {} + + public void paintUnlock() {} + + public void imageReshaped(int x, int y, int width, int height) {} + + public void imageUpdated(int dirtyX, int dirtyY,int dirtyWidth, int dirtyHeight) {} + + public void focusGrabbed() {} + + public void focusUngrabbed() {} + + public void preferredSizeChanged(int width, int height) {} + + public void maximumSizeChanged(int width, int height) {} + + public void minimumSizeChanged(int width, int height) {} + + public T createDragGestureRecognizer( + Class abstractRecognizerClass, + DragSource ds, Component c, int srcActions, + DragGestureListener dgl) + { + return null; + } + + public DragSourceContextWrapper createDragSourceContextPeer(DragGestureEvent dge) + throws InvalidDnDOperationException { + return null; + } + + public void addDropTarget(DropTarget dt) { } + + public void removeDropTarget(DropTarget dt) { } + + private class LightweightContentProxy implements LightweightContent { + + public JComponent getComponent() { + return LightweightContentWrapper.this.getComponent(); + } + + public void paintLock() { + LightweightContentWrapper.this.paintLock(); + } + + public void paintUnlock() { + LightweightContentWrapper.this.paintUnlock(); + } + + public void imageBufferReset(int[] data, int x, int y, int width, int height, + int linestride) { + LightweightContentWrapper.this.imageBufferReset(data, x, y, width, + height, linestride); + } + + public void imageBufferReset(int[] data, int x, int y, int width, int height, + int linestride, double scaleX, double scaleY) { + LightweightContentWrapper.this.imageBufferReset(data, x, y, width, height, + linestride, scaleX, scaleY); + } + + public void imageReshaped(int x, int y, int width, int height) { + LightweightContentWrapper.this.imageReshaped(x, y, width, height); + } + + public void imageUpdated(int dirtyX, int dirtyY,int dirtyWidth, int dirtyHeight) { + LightweightContentWrapper.this.imageUpdated(dirtyX, dirtyY, dirtyWidth, dirtyHeight); + } + + public void focusGrabbed() { + LightweightContentWrapper.this.focusGrabbed(); + } + + public void focusUngrabbed() { + LightweightContentWrapper.this.focusUngrabbed(); + } + + public void preferredSizeChanged(int width, int height) { + LightweightContentWrapper.this.preferredSizeChanged(width, height); + } + + public void maximumSizeChanged(int width, int height) { + LightweightContentWrapper.this.maximumSizeChanged(width, height); + } + + public void minimumSizeChanged(int width, int height) { + LightweightContentWrapper.this.minimumSizeChanged(width, height); + } + + public T createDragGestureRecognizer( + Class abstractRecognizerClass, + DragSource ds, Component c, int srcActions, + DragGestureListener dgl) { + return LightweightContentWrapper.this.createDragGestureRecognizer( + abstractRecognizerClass, ds, c, srcActions, dgl); + } + + public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) + throws InvalidDnDOperationException { + DragSourceContextWrapper peerWrapper = + LightweightContentWrapper.this.createDragSourceContextPeer(dge); + return peerWrapper.getPeer(); + } + + public void addDropTarget(DropTarget dt) { + LightweightContentWrapper.this.addDropTarget(dt); + } + + public void removeDropTarget(DropTarget dt) { + LightweightContentWrapper.this.removeDropTarget(dt); + } + } +} --- /dev/null 2018-05-07 13:54:53.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/SwingInterOpUtils.java 2018-05-07 13:54:52.701725000 +0530 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 jdk.swing.interop; + +import java.awt.Graphics; +import java.awt.Component; +import java.awt.Container; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.AWTEvent; +import java.awt.EventQueue; +import java.awt.image.BufferedImage; +import sun.awt.SunToolkit; +import sun.awt.AppContext; +import sun.awt.AWTAccessor; +import sun.awt.UngrabEvent; +import sun.awt.image.IntegerComponentRaster; +import sun.java2d.SunGraphics2D; +import sun.java2d.SurfaceData; + +/** + * This class provides static utility methods to be used by FX swing interop + * to access and use jdk internal classes like SunToolkit, AppContext, AWTAccessor, + * UngrabEvent, IntegerComponentRaster, SunGraphics2D and SurfaceData. + */ +public class SwingInterOpUtils { + public static double getDefaultScaleX(Graphics g) { + if (g instanceof SunGraphics2D) { + SurfaceData sd = ((SunGraphics2D) g).surfaceData; + return sd.getDefaultScaleX(); + } + return 1.0; + } + + public static double getDefaultScaleY(Graphics g) { + if (g instanceof SunGraphics2D) { + SurfaceData sd = ((SunGraphics2D) g).surfaceData; + return sd.getDefaultScaleY(); + } + return 1.0; + } + + public static int[] getData(BufferedImage bimg) { + IntegerComponentRaster icr = + (IntegerComponentRaster) bimg.getRaster(); + int data[] = icr.getDataStorage(); + return data; + } + + public static int getOffset(BufferedImage bimg) { + IntegerComponentRaster icr = + (IntegerComponentRaster) bimg.getRaster(); + int offset = icr.getDataOffset(0); + return offset; + } + + public static int getScanlineStride(BufferedImage bimg) { + IntegerComponentRaster icr = + (IntegerComponentRaster) bimg.getRaster(); + int scan = icr.getScanlineStride(); + return scan; + } + + public static void postEvent(Object target, java.awt.AWTEvent e) { + AppContext context = SunToolkit.targetToAppContext(target); + if (context != null) { + SunToolkit.postEvent(context, e); + } + } + + public static void grab(Toolkit toolkit, Window window) { + if (toolkit instanceof SunToolkit) { + ((SunToolkit)toolkit).grab(window); + } + } + + public static void ungrab(Toolkit toolkit, Window window) { + if (toolkit instanceof SunToolkit) { + ((SunToolkit)toolkit).ungrab(window); + } + } + + public static boolean isUngrabEvent(AWTEvent e) { + return e instanceof UngrabEvent; + } + + public static final int GRAB_EVENT_MASK = SunToolkit.GRAB_EVENT_MASK; + +} --- /dev/null 2018-05-07 13:54:56.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/DragSourceContextWrapper.java 2018-05-07 13:54:55.806902700 +0530 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 jdk.swing.interop; + +import java.awt.Cursor; +import java.awt.Image; +import java.awt.Point; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragSourceContext; +import java.awt.dnd.InvalidDnDOperationException; +import java.awt.dnd.peer.DragSourceContextPeer; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; +import java.util.Map; +import sun.awt.dnd.SunDragSourceContextPeer; + +/** + * This class provides a wrapper over inner DragSourceContextPeerProxy class + * which extends jdk internal sun.awt.dnd.SunDragSourceContextPeer class + * and provides APIs to be used by FX swing interop to access and use + * DragSourceContextPeer APIs. + */ +public class DragSourceContextWrapper { + private DragSourceContextPeerProxy dsp; + + public DragSourceContextWrapper(DragGestureEvent e) { + dsp = new DragSourceContextPeerProxy(e); + } + + DragSourceContextPeer getPeer() { + return dsp; + } + + public static int convertModifiersToDropAction(int modifiers, + int supportedActions) { + return DragSourceContextPeerProxy. + convertModifiersToDropAction(modifiers, supportedActions); + } + + protected void setNativeCursor(long nativeCtxt, Cursor c, int cType) {} + + protected void startDrag(Transferable trans, long[] formats, + Map formatMap) {} + + public void startSecondaryEventLoop() {} + + public void quitSecondaryEventLoop() {} + + public void dragDropFinished(final boolean success, + final int operations, + final int x, final int y) { + dsp.dragDropFinishedCall(success, operations, x, y); + } + + public DragSourceContext getDragSourceContext() { + return dsp.getDragSourceContextCall(); + } + + private class DragSourceContextPeerProxy extends SunDragSourceContextPeer { + + public DragSourceContextPeerProxy(DragGestureEvent e) { + super(e); + } + + protected void startDrag(Transferable trans, long[] formats, + Map formatMap) { + DragSourceContextWrapper.this.startDrag(trans, formats, formatMap); + } + + protected void setNativeCursor(long nativeCtxt, Cursor c, int cType) { + DragSourceContextWrapper.this.setNativeCursor(nativeCtxt, c, cType); + } + + public void startSecondaryEventLoop(){ + DragSourceContextWrapper.this.startSecondaryEventLoop(); + } + + public void quitSecondaryEventLoop(){ + DragSourceContextWrapper.this.quitSecondaryEventLoop(); + } + + protected void dragDropFinishedCall(final boolean success, + final int operations, + final int x, final int y) { + dragDropFinished(success, operations, x, y); + } + + protected DragSourceContext getDragSourceContextCall() { + return getDragSourceContext(); + } + } +} --- /dev/null 2018-05-07 13:54:59.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/DropTargetContextWrapper.java 2018-05-07 13:54:58.814074700 +0530 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 jdk.swing.interop; + +import java.awt.dnd.peer.DropTargetContextPeer; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.InvalidDnDOperationException; +import java.awt.dnd.DropTargetContext; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import sun.awt.AWTAccessor; + +/** + * This class provides a wrapper over inner class DropTargetContextPeerProxy + * which implements jdk internal java.awt.dnd.peer.DropTargetContextPeer interface + * and provides APIs to be used by FX swing interop to access and use + * DropTargetContextPeer APIs. + */ +public class DropTargetContextWrapper { + + private static DropTargetContextPeerProxy dcp; + public DropTargetContextWrapper() { + dcp = new DropTargetContextPeerProxy(); + } + + public static void setDropTargetContextPeer(DropTargetContext dtc, + DropTargetContextWrapper dtcpw) { + AWTAccessor.getDropTargetContextAccessor(). + setDropTargetContextPeer(dtc, dcp); + } + + public static void reset(DropTargetContext dtc) { + AWTAccessor.getDropTargetContextAccessor().reset(dtc); + } + + public void setTargetActions(int actions) {} + + public int getTargetActions() { + return DnDConstants.ACTION_NONE; + } + + public DropTarget getDropTarget() { + return null; + } + + public DataFlavor[] getTransferDataFlavors() { + return null; + } + + public Transferable getTransferable() throws InvalidDnDOperationException { + return null; + } + + public boolean isTransferableJVMLocal() { + return false; + } + + public void acceptDrag(int dragAction) {} + + public void rejectDrag() {} + + public void acceptDrop(int dropAction) {} + + public void rejectDrop() {} + + public void dropComplete(boolean success) {} + + private class DropTargetContextPeerProxy implements DropTargetContextPeer { + + public void setTargetActions(int actions) { + DropTargetContextWrapper.this.setTargetActions(actions); + } + + public int getTargetActions() { + return DropTargetContextWrapper.this.getTargetActions(); + } + + public DropTarget getDropTarget() { + return DropTargetContextWrapper.this.getDropTarget(); + } + + public DataFlavor[] getTransferDataFlavors() { + return DropTargetContextWrapper.this.getTransferDataFlavors(); + } + + public Transferable getTransferable() throws InvalidDnDOperationException { + return DropTargetContextWrapper.this.getTransferable(); + } + + public boolean isTransferableJVMLocal() { + return DropTargetContextWrapper.this.isTransferableJVMLocal(); + } + + public void acceptDrag(int dragAction) { + DropTargetContextWrapper.this.acceptDrag(dragAction); + } + + public void rejectDrag() { + DropTargetContextWrapper.this.rejectDrag(); + } + + public void acceptDrop(int dropAction) { + DropTargetContextWrapper.this.acceptDrop(dropAction); + } + + public void rejectDrop() { + DropTargetContextWrapper.this.rejectDrop(); + } + + public void dropComplete(boolean success) { + DropTargetContextWrapper.this.dropComplete(success); + } + } +} --- /dev/null 2018-05-07 13:55:02.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/DispatcherWrapper.java 2018-05-07 13:55:01.883250200 +0530 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 jdk.swing.interop; + +import java.awt.SecondaryLoop; +import java.awt.EventQueue; +import sun.awt.FwDispatcher; +import sun.awt.AWTAccessor; + +/** + * This class provides a wrapper over inner class DispatcherProxy + * which implements jdk internal sun.awt.FwDispatcher interface + * and provides APIs to be used by FX swing interop to access and use + * FwDispatcher APIs. + */ +public class DispatcherWrapper { + private DispatcherProxy fwd; + + public DispatcherWrapper() { + fwd = new DispatcherProxy(); + } + + public boolean isDispatchThread() { + return false; + } + + public void scheduleDispatch(Runnable r) { + + } + public SecondaryLoop createSecondaryLoop() { + return null; + } + + public static void setFwDispatcher(EventQueue eventQueue, DispatcherWrapper dispatcher) { + AWTAccessor.getEventQueueAccessor().setFwDispatcher(eventQueue, dispatcher.fwd); + } + + private class DispatcherProxy implements FwDispatcher { + + @Override + public boolean isDispatchThread() { + return DispatcherWrapper.this.isDispatchThread(); + } + + @Override + public void scheduleDispatch(Runnable r) { + DispatcherWrapper.this.scheduleDispatch(r); + } + + @Override + public SecondaryLoop createSecondaryLoop() { + return DispatcherWrapper.this.createSecondaryLoop(); + } + } +} --- /dev/null 2018-05-07 13:55:06.000000000 +0530 +++ new/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/internal/InteropImpl.java 2018-05-07 13:55:04.967426600 +0530 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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 jdk.swing.interop.internal; + +import sun.swing.InteropProvider; + +public class InteropImpl implements InteropProvider { +}