sun.awt.dnd.SunDropTargetEvent Java Examples
The following examples show how to use
sun.awt.dnd.SunDropTargetEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventQueue.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static int eventToCacheIndex(AWTEvent e) { switch(e.getID()) { case PaintEvent.PAINT: return PAINT; case PaintEvent.UPDATE: return UPDATE; case MouseEvent.MOUSE_MOVED: return MOVE; case MouseEvent.MOUSE_DRAGGED: // Return -1 for SunDropTargetEvent since they are usually synchronous // and we don't want to skip them by coalescing with MouseEvent or other drag events return e instanceof SunDropTargetEvent ? -1 : DRAG; default: return e instanceof PeerEvent ? PEER : -1; } }
Example #2
Source File: WDropTargetContextPeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void eventPosted(final SunDropTargetEvent e) { if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) { Runnable runnable = new Runnable() { @Override public void run() { e.getDispatcher().unregisterAllEvents(); } }; // NOTE: this PeerEvent must be a NORM_PRIORITY event to be // dispatched after this SunDropTargetEvent, but before the next // one, so we should pass zero flags. PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0); SunToolkit.executeOnEventHandlerThread(peerEvent); } }
Example #3
Source File: Container.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
private void trackMouseEnterExit(Component targetOver, MouseEvent e) { if (e instanceof SunDropTargetEvent) { trackDropTargetEnterExit(targetOver, e); return; } int id = e.getID(); if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && !isMouseInNativeContainer) { // any event but an exit or drag means we're in the native container isMouseInNativeContainer = true; startListeningForOtherDrags(); } else if (id == MouseEvent.MOUSE_EXITED) { isMouseInNativeContainer = false; stopListeningForOtherDrags(); } Component tle = retargetMouseEnterExit(targetOver, e, targetLastEntered.get(), isMouseInNativeContainer); targetLastEntered = new WeakReference<>(tle); }
Example #4
Source File: Container.java From Java8CN with Apache License 2.0 | 6 votes |
private void trackMouseEnterExit(Component targetOver, MouseEvent e) { if (e instanceof SunDropTargetEvent) { trackDropTargetEnterExit(targetOver, e); return; } int id = e.getID(); if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && !isMouseInNativeContainer) { // any event but an exit or drag means we're in the native container isMouseInNativeContainer = true; startListeningForOtherDrags(); } else if (id == MouseEvent.MOUSE_EXITED) { isMouseInNativeContainer = false; stopListeningForOtherDrags(); } Component tle = retargetMouseEnterExit(targetOver, e, targetLastEntered.get(), isMouseInNativeContainer); targetLastEntered = new WeakReference<>(tle); }
Example #5
Source File: XDropTargetContextPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
protected void eventProcessed(SunDropTargetEvent e, int returnValue, boolean dispatcherDone) { /* The native context is the pointer to the XClientMessageEvent structure. */ long ctxt = getNativeDragContext(); /* If the event was not consumed, send a response to the source. */ try { if (ctxt != 0 && !e.isConsumed()) { Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = (XDropTargetProtocol)dropTargetProtocols.next(); if (dropTargetProtocol.sendResponse(ctxt, e.getID(), returnValue)) { break; } } } } finally { if (dispatcherDone && ctxt != 0) { unsafe.freeMemory(ctxt); } } }
Example #6
Source File: Container.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void trackMouseEnterExit(Component targetOver, MouseEvent e) { if (e instanceof SunDropTargetEvent) { trackDropTargetEnterExit(targetOver, e); return; } int id = e.getID(); if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && !isMouseInNativeContainer) { // any event but an exit or drag means we're in the native container isMouseInNativeContainer = true; startListeningForOtherDrags(); } else if (id == MouseEvent.MOUSE_EXITED) { isMouseInNativeContainer = false; stopListeningForOtherDrags(); } Component tle = retargetMouseEnterExit(targetOver, e, targetLastEntered.get(), isMouseInNativeContainer); targetLastEntered = new WeakReference<>(tle); }
Example #7
Source File: XDropTargetContextPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
protected void eventProcessed(SunDropTargetEvent e, int returnValue, boolean dispatcherDone) { /* The native context is the pointer to the XClientMessageEvent structure. */ long ctxt = getNativeDragContext(); /* If the event was not consumed, send a response to the source. */ try { if (ctxt != 0 && !e.isConsumed()) { Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = (XDropTargetProtocol)dropTargetProtocols.next(); if (dropTargetProtocol.sendResponse(ctxt, e.getID(), returnValue)) { break; } } } } finally { if (dispatcherDone && ctxt != 0) { unsafe.freeMemory(ctxt); } } }
Example #8
Source File: WDropTargetContextPeer.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override protected void eventPosted(final SunDropTargetEvent e) { if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) { Runnable runnable = new Runnable() { @Override public void run() { e.getDispatcher().unregisterAllEvents(); } }; // NOTE: this PeerEvent must be a NORM_PRIORITY event to be // dispatched after this SunDropTargetEvent, but before the next // one, so we should pass zero flags. PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0); SunToolkit.executeOnEventHandlerThread(peerEvent); } }
Example #9
Source File: EventQueue.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static int eventToCacheIndex(AWTEvent e) { switch(e.getID()) { case PaintEvent.PAINT: return PAINT; case PaintEvent.UPDATE: return UPDATE; case MouseEvent.MOUSE_MOVED: return MOVE; case MouseEvent.MOUSE_DRAGGED: // Return -1 for SunDropTargetEvent since they are usually synchronous // and we don't want to skip them by coalescing with MouseEvent or other drag events return e instanceof SunDropTargetEvent ? -1 : DRAG; default: return e instanceof PeerEvent ? PEER : -1; } }
Example #10
Source File: CDropTargetContextPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { boolean eventInsideTarget = isEventInsideTarget(event); if (event.getComponent().getDropTarget() == insideTarget) { if (!eventInsideTarget) { processExitMessage(event); return; } } else { if (eventInsideTarget) { processEnterMessage(event); } else { return; } } super.processMotionMessage(event, operationChanged); }
Example #11
Source File: CDropTargetContextPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { boolean eventInsideTarget = isEventInsideTarget(event); if (event.getComponent().getDropTarget() == insideTarget) { if (!eventInsideTarget) { processExitMessage(event); return; } } else { if (eventInsideTarget) { processEnterMessage(event); } else { return; } } super.processMotionMessage(event, operationChanged); }
Example #12
Source File: EventQueue.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static int eventToCacheIndex(AWTEvent e) { switch(e.getID()) { case PaintEvent.PAINT: return PAINT; case PaintEvent.UPDATE: return UPDATE; case MouseEvent.MOUSE_MOVED: return MOVE; case MouseEvent.MOUSE_DRAGGED: // Return -1 for SunDropTargetEvent since they are usually synchronous // and we don't want to skip them by coalescing with MouseEvent or other drag events return e instanceof SunDropTargetEvent ? -1 : DRAG; default: return e instanceof PeerEvent ? PEER : -1; } }
Example #13
Source File: CDropTargetContextPeer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { boolean eventInsideTarget = isEventInsideTarget(event); if (event.getComponent().getDropTarget() == insideTarget) { if (!eventInsideTarget) { processExitMessage(event); return; } } else { if (eventInsideTarget) { processEnterMessage(event); } else { return; } } super.processMotionMessage(event, operationChanged); }
Example #14
Source File: XDropTargetContextPeer.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected void eventProcessed(SunDropTargetEvent e, int returnValue, boolean dispatcherDone) { /* The native context is the pointer to the XClientMessageEvent structure. */ long ctxt = getNativeDragContext(); /* If the event was not consumed, send a response to the source. */ try { if (ctxt != 0 && !e.isConsumed()) { Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = (XDropTargetProtocol)dropTargetProtocols.next(); if (dropTargetProtocol.sendResponse(ctxt, e.getID(), returnValue)) { break; } } } } finally { if (dispatcherDone && ctxt != 0) { unsafe.freeMemory(ctxt); } } }
Example #15
Source File: CDropTargetContextPeer.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { boolean eventInsideTarget = isEventInsideTarget(event); if (event.getComponent().getDropTarget() == insideTarget) { if (!eventInsideTarget) { processExitMessage(event); return; } } else { if (eventInsideTarget) { processEnterMessage(event); } else { return; } } super.processMotionMessage(event, operationChanged); }
Example #16
Source File: WDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected void eventPosted(final SunDropTargetEvent e) { if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) { Runnable runnable = new Runnable() { @Override public void run() { e.getDispatcher().unregisterAllEvents(); } }; // NOTE: this PeerEvent must be a NORM_PRIORITY event to be // dispatched after this SunDropTargetEvent, but before the next // one, so we should pass zero flags. PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0); SunToolkit.executeOnEventHandlerThread(peerEvent); } }
Example #17
Source File: XDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected void eventProcessed(SunDropTargetEvent e, int returnValue, boolean dispatcherDone) { /* The native context is the pointer to the XClientMessageEvent structure. */ long ctxt = getNativeDragContext(); /* If the event was not consumed, send a response to the source. */ try { if (ctxt != 0 && !e.isConsumed()) { Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = (XDropTargetProtocol)dropTargetProtocols.next(); if (dropTargetProtocol.sendResponse(ctxt, e.getID(), returnValue)) { break; } } } } finally { if (dispatcherDone && ctxt != 0) { unsafe.freeMemory(ctxt); } } }
Example #18
Source File: WDropTargetContextPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override protected void eventPosted(final SunDropTargetEvent e) { if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) { Runnable runnable = new Runnable() { @Override public void run() { e.getDispatcher().unregisterAllEvents(); } }; // NOTE: this PeerEvent must be a NORM_PRIORITY event to be // dispatched after this SunDropTargetEvent, but before the next // one, so we should pass zero flags. PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0); SunToolkit.executeOnEventHandlerThread(peerEvent); } }
Example #19
Source File: WDropTargetContextPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected void eventPosted(final SunDropTargetEvent e) { if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) { Runnable runnable = new Runnable() { @Override public void run() { e.getDispatcher().unregisterAllEvents(); } }; // NOTE: this PeerEvent must be a NORM_PRIORITY event to be // dispatched after this SunDropTargetEvent, but before the next // one, so we should pass zero flags. PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0); SunToolkit.executeOnEventHandlerThread(peerEvent); } }
Example #20
Source File: Container.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void trackMouseEnterExit(Component targetOver, MouseEvent e) { if (e instanceof SunDropTargetEvent) { trackDropTargetEnterExit(targetOver, e); return; } int id = e.getID(); if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && !isMouseInNativeContainer) { // any event but an exit or drag means we're in the native container isMouseInNativeContainer = true; startListeningForOtherDrags(); } else if (id == MouseEvent.MOUSE_EXITED) { isMouseInNativeContainer = false; stopListeningForOtherDrags(); } Component tle = retargetMouseEnterExit(targetOver, e, targetLastEntered.get(), isMouseInNativeContainer); targetLastEntered = new WeakReference<>(tle); }
Example #21
Source File: Container.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void trackMouseEnterExit(Component targetOver, MouseEvent e) { if (e instanceof SunDropTargetEvent) { trackDropTargetEnterExit(targetOver, e); return; } int id = e.getID(); if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && !isMouseInNativeContainer) { // any event but an exit or drag means we're in the native container isMouseInNativeContainer = true; startListeningForOtherDrags(); } else if (id == MouseEvent.MOUSE_EXITED) { isMouseInNativeContainer = false; stopListeningForOtherDrags(); } Component tle = retargetMouseEnterExit(targetOver, e, targetLastEntered.get(), isMouseInNativeContainer); targetLastEntered = new WeakReference<>(tle); }
Example #22
Source File: Container.java From Bytecoder with Apache License 2.0 | 6 votes |
private void trackMouseEnterExit(Component targetOver, MouseEvent e) { if (e instanceof SunDropTargetEvent) { trackDropTargetEnterExit(targetOver, e); return; } int id = e.getID(); if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && !isMouseInNativeContainer) { // any event but an exit or drag means we're in the native container isMouseInNativeContainer = true; startListeningForOtherDrags(); } else if (id == MouseEvent.MOUSE_EXITED) { isMouseInNativeContainer = false; stopListeningForOtherDrags(); } Component tle = retargetMouseEnterExit(targetOver, e, targetLastEntered.get(), isMouseInNativeContainer); targetLastEntered = new WeakReference<>(tle); }
Example #23
Source File: Container.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void trackMouseEnterExit(Component targetOver, MouseEvent e) { if (e instanceof SunDropTargetEvent) { trackDropTargetEnterExit(targetOver, e); return; } int id = e.getID(); if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && !isMouseInNativeContainer) { // any event but an exit or drag means we're in the native container isMouseInNativeContainer = true; startListeningForOtherDrags(); } else if (id == MouseEvent.MOUSE_EXITED) { isMouseInNativeContainer = false; stopListeningForOtherDrags(); } Component tle = retargetMouseEnterExit(targetOver, e, targetLastEntered.get(), isMouseInNativeContainer); targetLastEntered = new WeakReference<>(tle); }
Example #24
Source File: WDropTargetContextPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void eventPosted(final SunDropTargetEvent e) { if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) { Runnable runnable = new Runnable() { @Override public void run() { e.getDispatcher().unregisterAllEvents(); } }; // NOTE: this PeerEvent must be a NORM_PRIORITY event to be // dispatched after this SunDropTargetEvent, but before the next // one, so we should pass zero flags. PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0); SunToolkit.executeOnEventHandlerThread(peerEvent); } }
Example #25
Source File: CDropTargetContextPeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Could be called when DnD enters a heavyweight or synthesized in processMotionMessage */ @Override protected void processEnterMessage(SunDropTargetEvent event) { Component c = event.getComponent(); DropTarget dt = event.getComponent().getDropTarget(); if (isEventInsideTarget(event) && dt != insideTarget && c.isShowing() && dt != null && dt.isActive()) { insideTarget = dt; super.processEnterMessage(event); } }
Example #26
Source File: CDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Could be called when DnD enters a heavyweight or synthesized in processMotionMessage */ @Override protected void processEnterMessage(SunDropTargetEvent event) { Component c = event.getComponent(); DropTarget dt = event.getComponent().getDropTarget(); if (isEventInsideTarget(event) && dt != insideTarget && c.isShowing() && dt != null && dt.isActive()) { insideTarget = dt; super.processEnterMessage(event); } }
Example #27
Source File: CDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Could be called when DnD exits a heavyweight or synthesized in processMotionMessage */ @Override protected void processExitMessage(SunDropTargetEvent event) { if (event.getComponent().getDropTarget() == insideTarget) { insideTarget = null; super.processExitMessage(event); } }
Example #28
Source File: WDropTargetContextPeer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected void eventPosted(final SunDropTargetEvent e) { if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) { Runnable runnable = new Runnable() { public void run() { e.getDispatcher().unregisterAllEvents(); } }; // NOTE: this PeerEvent must be a NORM_PRIORITY event to be // dispatched after this SunDropTargetEvent, but before the next // one, so we should pass zero flags. PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0); SunToolkit.executeOnEventHandlerThread(peerEvent); } }
Example #29
Source File: Container.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Dispatches an event to a sub-component if necessary, and * returns whether or not the event was forwarded to a * sub-component. * * @param e the event */ boolean dispatchEvent(AWTEvent e) { boolean ret = false; /* * Fix for BugTraq Id 4389284. * Dispatch SunDropTargetEvents regardless of eventMask value. * Do not update cursor on dispatching SunDropTargetEvents. */ if (e instanceof SunDropTargetEvent) { SunDropTargetEvent sdde = (SunDropTargetEvent) e; ret = processDropTargetEvent(sdde); } else { if (e instanceof MouseEvent && (eventMask & MOUSE_MASK) != 0) { MouseEvent me = (MouseEvent) e; ret = processMouseEvent(me); } if (e.getID() == MouseEvent.MOUSE_MOVED) { nativeContainer.updateCursorImmediately(); } } return ret; }
Example #30
Source File: XDropTargetContextPeer.java From hottub with GNU General Public License v2.0 | 5 votes |
private boolean processSunDropTargetEvent(SunDropTargetEvent event) { Object source = event.getSource(); if (source instanceof Component) { ComponentPeer peer = ((Component)source).getPeer(); if (peer instanceof XEmbedCanvasPeer) { XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer; /* The native context is the pointer to the XClientMessageEvent structure. */ long ctxt = getNativeDragContext(); if (logger.isLoggable(PlatformLogger.Level.FINER)) { logger.finer(" processing " + event + " ctxt=" + ctxt + " consumed=" + event.isConsumed()); } /* If the event is not consumed, pass it to the XEmbedCanvasPeer for processing. */ if (!event.isConsumed()) { // NOTE: ctxt can be zero at this point. if (xEmbedCanvasPeer.processXEmbedDnDEvent(ctxt, event.getID())) { event.consume(); return true; } } } } return false; }