1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54:
55:
58: public class DragSource implements Serializable
59: {
60:
63: private static final long serialVersionUID = 6236096958971414066L;
64:
65: public static final Cursor DefaultCopyDrop = null;
66: public static final Cursor DefaultMoveDrop = null;
67: public static final Cursor DefaultLinkDrop = null;
68: public static final Cursor DefaultCopyNoDrop = null;
69: public static final Cursor DefaultMoveNoDrop = null;
70: public static final Cursor DefaultLinkNoDrop = null;
71:
72: private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap ();
73:
74: private transient DragSourceListener dragSourceListener;
75: private transient DragSourceMotionListener dragSourceMotionListener;
76:
77:
82: public DragSource()
83: {
84: if (GraphicsEnvironment.isHeadless())
85: throw new HeadlessException ();
86: }
87:
88:
91: public static DragSource getDefaultDragSource()
92: {
93: return null;
94: }
95:
96: public static boolean isDragImageSupported()
97: {
98: return false;
99: }
100:
101:
108: public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
109: Image dragImage, Point imageOffset,
110: Transferable trans, DragSourceListener dsl,
111: FlavorMap map)
112: {
113: }
114:
115:
122: public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
123: Transferable trans, DragSourceListener dsl,
124: FlavorMap map)
125: {
126: startDrag(trigger, dragCursor, null, null, trans, dsl, map);
127: }
128:
129:
136: public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
137: Image dragImage, Point imageOffset,
138: Transferable trans, DragSourceListener dsl)
139: {
140: startDrag(trigger, dragCursor, dragImage, imageOffset, trans, dsl, null);
141: }
142:
143:
150: public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
151: Transferable trans, DragSourceListener dsl)
152: {
153: startDrag(trigger, dragCursor, null, null, trans, dsl, null);
154: }
155:
156:
162: protected DragSourceContext
163: createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
164: Cursor cursor, Image image, Point offset,
165: Transferable t, DragSourceListener dsl)
166: {
167: return null;
168: }
169:
170: public FlavorMap getFlavorMap()
171: {
172: return flavorMap;
173: }
174:
175: public DragGestureRecognizer
176: createDragGestureRecognizer(Class recognizer, Component c, int actions,
177: DragGestureListener dgl)
178: {
179: return Toolkit.getDefaultToolkit ()
180: .createDragGestureRecognizer (recognizer, this, c, actions,
181: dgl);
182: }
183:
184: public DragGestureRecognizer
185: createDefaultDragGestureRecognizer(Component c, int actions,
186: DragGestureListener dgl)
187: {
188: return createDragGestureRecognizer (MouseDragGestureRecognizer.class, c,
189: actions, dgl);
190: }
191:
192:
195: public void addDragSourceListener(DragSourceListener l)
196: {
197: DnDEventMulticaster.add (dragSourceListener, l);
198: }
199:
200:
203: public void removeDragSourceListener(DragSourceListener l)
204: {
205: DnDEventMulticaster.remove (dragSourceListener, l);
206: }
207:
208:
211: public DragSourceListener[] getDragSourceListeners()
212: {
213: return (DragSourceListener[]) getListeners (DragSourceListener.class);
214: }
215:
216:
219: public void addDragSourceMotionListener(DragSourceMotionListener l)
220: {
221: DnDEventMulticaster.add (dragSourceMotionListener, l);
222: }
223:
224:
227: public void removeDragSourceMotionListener(DragSourceMotionListener l)
228: {
229: DnDEventMulticaster.remove (dragSourceMotionListener, l);
230: }
231:
232:
235: public DragSourceMotionListener[] getDragSourceMotionListeners ()
236: {
237: return (DragSourceMotionListener[]) getListeners
238: (DragSourceMotionListener.class);
239: }
240:
241:
244: public EventListener[] getListeners (Class listenerType)
245: {
246: if (listenerType == DragSourceListener.class)
247: return DnDEventMulticaster.getListeners (dragSourceListener,
248: listenerType);
249:
250: if (listenerType == DragSourceMotionListener.class)
251: return DnDEventMulticaster.getListeners (dragSourceMotionListener,
252: listenerType);
253:
254:
255: return new EventListener [0];
256: }
257: }