261 SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
262 sourceActions);
263
264 DragSourceDragEvent event =
265 new DragSourceDragEvent(getDragSourceContext(),
266 dropAction,
267 targetAction & sourceActions,
268 modifiers, x, y);
269 EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);
270
271 SunToolkit.invokeLaterOnAppContext(
272 SunToolkit.targetToAppContext(getComponent()), dispatcher);
273
274 startSecondaryEventLoop();
275 }
276
277 /**
278 * upcall from native code
279 */
280
281 private void dragEnter(final int targetActions,
282 final int modifiers,
283 final int x, final int y) {
284 postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_ENTER);
285 }
286
287 /**
288 * upcall from native code
289 */
290
291 private void dragMotion(final int targetActions,
292 final int modifiers,
293 final int x, final int y) {
294 postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_MOTION);
295 }
296
297 /**
298 * upcall from native code
299 */
300
301 private void operationChanged(final int targetActions,
339 final int operations,
340 final int x, final int y) {
341 DragSourceEvent event =
342 new DragSourceDropEvent(getDragSourceContext(),
343 operations & sourceActions,
344 success, x, y);
345 EventDispatcher dispatcher =
346 new EventDispatcher(DISPATCH_FINISH, event);
347
348 SunToolkit.invokeLaterOnAppContext(
349 SunToolkit.targetToAppContext(getComponent()), dispatcher);
350
351 startSecondaryEventLoop();
352 setNativeContext(0);
353 dragImage = null;
354 dragImageOffset = null;
355 }
356
357 public static void setDragDropInProgress(boolean b)
358 throws InvalidDnDOperationException {
359 if (dragDropInProgress == b) {
360 throw new InvalidDnDOperationException(getExceptionMessage(b));
361 }
362
363 synchronized (SunDragSourceContextPeer.class) {
364 if (dragDropInProgress == b) {
365 throw new InvalidDnDOperationException(getExceptionMessage(b));
366 }
367 dragDropInProgress = b;
368 }
369 }
370
371 /**
372 * Filters out all mouse events that were on the java event queue when
373 * startDrag was called.
374 */
375 public static boolean checkEvent(AWTEvent event) {
376 if (discardingMouseEvents && event instanceof MouseEvent) {
377 MouseEvent mouseEvent = (MouseEvent)event;
378 if (!(mouseEvent instanceof SunDropTargetEvent)) {
379 return false;
380 }
381 }
382 return true;
|
261 SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
262 sourceActions);
263
264 DragSourceDragEvent event =
265 new DragSourceDragEvent(getDragSourceContext(),
266 dropAction,
267 targetAction & sourceActions,
268 modifiers, x, y);
269 EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);
270
271 SunToolkit.invokeLaterOnAppContext(
272 SunToolkit.targetToAppContext(getComponent()), dispatcher);
273
274 startSecondaryEventLoop();
275 }
276
277 /**
278 * upcall from native code
279 */
280
281 protected void dragEnter(final int targetActions,
282 final int modifiers,
283 final int x, final int y) {
284 postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_ENTER);
285 }
286
287 /**
288 * upcall from native code
289 */
290
291 private void dragMotion(final int targetActions,
292 final int modifiers,
293 final int x, final int y) {
294 postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_MOTION);
295 }
296
297 /**
298 * upcall from native code
299 */
300
301 private void operationChanged(final int targetActions,
339 final int operations,
340 final int x, final int y) {
341 DragSourceEvent event =
342 new DragSourceDropEvent(getDragSourceContext(),
343 operations & sourceActions,
344 success, x, y);
345 EventDispatcher dispatcher =
346 new EventDispatcher(DISPATCH_FINISH, event);
347
348 SunToolkit.invokeLaterOnAppContext(
349 SunToolkit.targetToAppContext(getComponent()), dispatcher);
350
351 startSecondaryEventLoop();
352 setNativeContext(0);
353 dragImage = null;
354 dragImageOffset = null;
355 }
356
357 public static void setDragDropInProgress(boolean b)
358 throws InvalidDnDOperationException {
359 synchronized (SunDragSourceContextPeer.class) {
360 if (dragDropInProgress == b) {
361 throw new InvalidDnDOperationException(getExceptionMessage(b));
362 }
363 dragDropInProgress = b;
364 }
365 }
366
367 /**
368 * Filters out all mouse events that were on the java event queue when
369 * startDrag was called.
370 */
371 public static boolean checkEvent(AWTEvent event) {
372 if (discardingMouseEvents && event instanceof MouseEvent) {
373 MouseEvent mouseEvent = (MouseEvent)event;
374 if (!(mouseEvent instanceof SunDropTargetEvent)) {
375 return false;
376 }
377 }
378 return true;
|