src/share/classes/java/awt/Container.java

Print this page

        

*** 4425,4434 **** --- 4425,4435 ---- void dispose() { //System.out.println("Disposing lw dispatcher"); stopListeningForOtherDrags(); mouseEventTarget = null; targetLastEntered = null; + targetLastEnteredDT = null; } /** * Enables events to subcomponents. */
*** 4615,4662 **** } return e.isConsumed(); } /* ! * Generates enter/exit events as mouse moves over lw components * @param targetOver Target mouse is over (including native container) ! * @param e Mouse event in native container */ ! private void trackMouseEnterExit(Component targetOver, MouseEvent e) { ! Component targetEnter = null; int id = e.getID(); ! ! if (e instanceof SunDropTargetEvent && ! id == MouseEvent.MOUSE_ENTERED && ! isMouseInNativeContainer == true) { // This can happen if a lightweight component which initiated the // drag has an associated drop target. MOUSE_ENTERED comes when the // mouse is in the native container already. To propagate this event // properly we should null out targetLastEntered. ! targetLastEntered = null; ! } else if ( id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_DRAGGED && id != LWD_MOUSE_DRAGGED_OVER && ! isMouseInNativeContainer == false ) { // 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(); } ! ! if (isMouseInNativeContainer) { ! targetEnter = targetOver; } ! if (targetLastEntered == targetEnter) { ! return; ! } ! if (targetLastEntered != null) { ! retargetMouseEvent(targetLastEntered, MouseEvent.MOUSE_EXITED, e); } if (id == MouseEvent.MOUSE_EXITED) { // consume native exit event if we generate one e.consume(); } --- 4616,4684 ---- } return e.isConsumed(); } /* ! * Generates dnd enter/exit events as mouse moves over lw components * @param targetOver Target mouse is over (including native container) ! * @param e SunDropTarget mouse event in native container */ ! private void trackMouseDTEnterExit(Component targetOver, MouseEvent e) { int id = e.getID(); ! if (id == MouseEvent.MOUSE_ENTERED && isMouseDTInNativeContainer) { // This can happen if a lightweight component which initiated the // drag has an associated drop target. MOUSE_ENTERED comes when the // mouse is in the native container already. To propagate this event // properly we should null out targetLastEntered. ! targetLastEnteredDT = null; ! } else if (id == MouseEvent.MOUSE_ENTERED) { ! isMouseDTInNativeContainer = true; ! } else if (id == MouseEvent.MOUSE_EXITED) { ! isMouseDTInNativeContainer = false; ! } ! targetLastEnteredDT = retargetMouseEnterExit(targetOver, e, ! targetLastEnteredDT, ! isMouseDTInNativeContainer); ! } ! ! /* ! * Generates enter/exit events as mouse moves over lw components ! * @param targetOver Target mouse is over (including native container) ! * @param e Mouse event in native container ! */ ! private void trackMouseEnterExit(Component targetOver, MouseEvent e) { ! if (e instanceof SunDropTargetEvent) { ! trackMouseDTEnterExit(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(); } ! targetLastEntered = retargetMouseEnterExit(targetOver, e, ! targetLastEntered, ! isMouseInNativeContainer); } ! private Component retargetMouseEnterExit(Component targetOver, MouseEvent e, ! Component lastEntered, ! boolean inNativeContainer) { ! int id = e.getID(); ! Component targetEnter = inNativeContainer ? targetOver : null; ! if (lastEntered != targetEnter) { ! if (lastEntered != null) { ! retargetMouseEvent(lastEntered, MouseEvent.MOUSE_EXITED, e); } if (id == MouseEvent.MOUSE_EXITED) { // consume native exit event if we generate one e.consume(); }
*** 4666,4677 **** } if (id == MouseEvent.MOUSE_ENTERED) { // consume native enter event if we generate one e.consume(); } ! ! targetLastEntered = targetEnter; } /* * Listens to global mouse drag events so even drags originating * from other heavyweight containers will generate enter/exit --- 4688,4699 ---- } if (id == MouseEvent.MOUSE_ENTERED) { // consume native enter event if we generate one e.consume(); } ! } ! return targetEnter; } /* * Listens to global mouse drag events so even drags originating * from other heavyweight containers will generate enter/exit
*** 4906,4930 **** * a subcomponent. */ private transient Component mouseEventTarget; /** ! * The last component entered */ private transient Component targetLastEntered; /** * Indicates whether {@code mouseEventTarget} was removed and nulled */ private transient boolean isCleaned; /** ! * Is the mouse over the native container */ private transient boolean isMouseInNativeContainer = false; /** * This variable is not used, but kept for serialization compatibility */ private Cursor nativeCursor; /** --- 4928,4962 ---- * a subcomponent. */ private transient Component mouseEventTarget; /** ! * The last component entered by the {@code MouseEvent}. */ private transient Component targetLastEntered; /** + * The last component entered by the {@code SunDropTargetEvent}. + */ + private transient Component targetLastEnteredDT; + + /** * Indicates whether {@code mouseEventTarget} was removed and nulled */ private transient boolean isCleaned; /** ! * Is the mouse over the native container. */ private transient boolean isMouseInNativeContainer = false; /** + * Is DnD over the native container. + */ + private transient boolean isMouseDTInNativeContainer = false; + + /** * This variable is not used, but kept for serialization compatibility */ private Cursor nativeCursor; /**
*** 4958,4964 **** --- 4990,4999 ---- mouseEventTarget = null; } if (targetLastEntered == removedComponent) { targetLastEntered = null; } + if (targetLastEnteredDT == removedComponent) { + targetLastEnteredDT = null; + } } }