author | mdoerr |
Tue, 12 Nov 2019 16:13:16 +0100 | |
changeset 59032 | ad05ed6f2a77 |
parent 50656 | 362e45aeb983 |
permissions | -rw-r--r-- |
50656
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
1 |
/* |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
4 |
* |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
10 |
* |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
15 |
* accompanied this code). |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
16 |
* |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
20 |
* |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
23 |
* questions. |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
24 |
*/ |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
25 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
26 |
package jdk.swing.interop; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
27 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
28 |
import java.awt.Cursor; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
29 |
import java.awt.dnd.DragGestureEvent; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
30 |
import java.awt.dnd.DragSourceContext; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
31 |
import java.awt.dnd.peer.DragSourceContextPeer; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
32 |
import java.awt.datatransfer.Transferable; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
33 |
import java.awt.datatransfer.DataFlavor; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
34 |
import java.util.Map; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
35 |
import sun.awt.dnd.SunDragSourceContextPeer; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
36 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
37 |
/** |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
38 |
* This class provides a wrapper over inner DragSourceContextPeerProxy class |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
39 |
* which extends jdk internal sun.awt.dnd.SunDragSourceContextPeer class |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
40 |
* and provides APIs to be used by FX swing interop to access and use |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
41 |
* DragSourceContextPeer APIs. |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
42 |
* |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
43 |
* @since 11 |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
44 |
*/ |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
45 |
public abstract class DragSourceContextWrapper { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
46 |
private DragSourceContextPeerProxy dsp; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
47 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
48 |
public DragSourceContextWrapper(DragGestureEvent e) { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
49 |
dsp = new DragSourceContextPeerProxy(e); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
50 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
51 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
52 |
DragSourceContextPeer getPeer() { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
53 |
return dsp; |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
54 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
55 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
56 |
public static int convertModifiersToDropAction(int modifiers, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
57 |
int supportedActions) { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
58 |
return DragSourceContextPeerProxy. |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
59 |
convertModifiersToDropAction(modifiers, supportedActions); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
60 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
61 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
62 |
protected abstract void setNativeCursor(Cursor c, int cType); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
63 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
64 |
protected abstract void startDrag(Transferable trans, long[] formats, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
65 |
Map<Long, DataFlavor> formatMap); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
66 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
67 |
public abstract void startSecondaryEventLoop(); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
68 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
69 |
public abstract void quitSecondaryEventLoop(); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
70 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
71 |
public void dragDropFinished(final boolean success, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
72 |
final int operations, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
73 |
final int x, final int y) { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
74 |
dsp.dragDropFinishedCall(success, operations, x, y); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
75 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
76 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
77 |
public DragSourceContext getDragSourceContext() { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
78 |
return dsp.getDragSourceContextCall(); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
79 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
80 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
81 |
private class DragSourceContextPeerProxy extends SunDragSourceContextPeer { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
82 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
83 |
public DragSourceContextPeerProxy(DragGestureEvent e) { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
84 |
super(e); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
85 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
86 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
87 |
protected void startDrag(Transferable trans, long[] formats, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
88 |
Map<Long, DataFlavor> formatMap) { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
89 |
DragSourceContextWrapper.this.startDrag(trans, formats, formatMap); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
90 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
91 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
92 |
protected void setNativeCursor(long nativeCtxt, Cursor c, int cType) { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
93 |
DragSourceContextWrapper.this.setNativeCursor(c, cType); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
94 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
95 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
96 |
public void startSecondaryEventLoop() { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
97 |
DragSourceContextWrapper.this.startSecondaryEventLoop(); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
98 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
99 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
100 |
public void quitSecondaryEventLoop() { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
101 |
DragSourceContextWrapper.this.quitSecondaryEventLoop(); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
102 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
103 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
104 |
protected void dragDropFinishedCall(final boolean success, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
105 |
final int operations, |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
106 |
final int x, final int y) { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
107 |
dragDropFinished(success, operations, x, y); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
108 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
109 |
|
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
110 |
protected DragSourceContext getDragSourceContextCall() { |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
111 |
return getDragSourceContext(); |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
112 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
113 |
} |
362e45aeb983
8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff
changeset
|
114 |
} |