1:
37:
38:
39: package ;
40:
41: import ;
42:
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51:
52:
55: public class DragSourceContext
56: implements DragSourceListener, DragSourceMotionListener, Serializable
57: {
58:
61: static final long serialVersionUID = -115407898692194719L;
62:
63: protected static final int DEFAULT = 0;
64: protected static final int ENTER = 1;
65: protected static final int OVER = 2;
66: protected static final int CHANGED = 3;
67:
68: private DragSourceContextPeer peer;
69: private Cursor cursor;
70: private Transferable transferable;
71: private DragGestureEvent trigger;
72: private DragSourceListener dragSourceListener;
73: private boolean useCustomCursor;
74: private int sourceActions;
75: private Image image;
76: private Point offset;
77:
78:
87: public DragSourceContext (DragSourceContextPeer peer,
88: DragGestureEvent trigger, Cursor cursor,
89: Image image, Point offset, Transferable trans,
90: DragSourceListener dsl)
91: throws NotImplementedException
92: {
93: if (peer == null
94: || trigger == null)
95: throw new NullPointerException ();
96:
97: if (trigger.getComponent () == null
98: || trigger.getDragSource () == null
99: || trigger.getDragAction () == DnDConstants.ACTION_NONE
100: || trigger.getSourceAsDragGestureRecognizer ()
101: .getSourceActions () == DnDConstants.ACTION_NONE)
102: throw new IllegalArgumentException ();
103:
104: this.peer = peer;
105: this.trigger = trigger;
106: this.cursor = cursor;
107: this.image = image;
108: this.offset = offset;
109: this.transferable = trans;
110: this.dragSourceListener = dsl;
111:
112: throw new Error ("not implemented");
113: }
114:
115: public DragSource getDragSource()
116: {
117: return trigger.getDragSource ();
118: }
119:
120: public Component getComponent()
121: {
122: return trigger.getComponent ();
123: }
124:
125: public DragGestureEvent getTrigger()
126: {
127: return trigger;
128: }
129:
130: public int getSourceActions()
131: {
132: return trigger.getSourceAsDragGestureRecognizer ().getSourceActions ();
133: }
134:
135: public void setCursor (Cursor cursor)
136: throws NotImplementedException
137: {
138: this.cursor = cursor;
139:
140: }
141:
142: public Cursor getCursor()
143: {
144: return cursor;
145: }
146:
147:
153: public void addDragSourceListener (DragSourceListener dsl)
154: throws TooManyListenersException
155: {
156: if (dragSourceListener != null)
157: throw new TooManyListenersException ();
158:
159: dragSourceListener = dsl;
160: }
161:
162: public void removeDragSourceListener (DragSourceListener dsl)
163: {
164: if (dragSourceListener == dsl)
165: dragSourceListener = null;
166: }
167:
168: public void transferablesFlavorsChanged()
169: throws NotImplementedException
170: {
171: }
172:
173: public void dragEnter(DragSourceDragEvent e)
174: throws NotImplementedException
175: {
176: }
177:
178: public void dragOver(DragSourceDragEvent e)
179: throws NotImplementedException
180: {
181: }
182:
183: public void dragExit(DragSourceEvent e)
184: throws NotImplementedException
185: {
186: }
187:
188: public void dropActionChanged(DragSourceDragEvent e)
189: throws NotImplementedException
190: {
191: }
192:
193: public void dragDropEnd(DragSourceDropEvent e)
194: throws NotImplementedException
195: {
196: }
197:
198: public void dragMouseMoved(DragSourceDragEvent e)
199: throws NotImplementedException
200: {
201: }
202:
203: public Transferable getTransferable()
204: {
205: return transferable;
206: }
207:
208: protected void updateCurrentCursor(int dropOp, int targetAct, int status)
209: throws NotImplementedException
210: {
211: }
212: }