Package com.nomagic.ui
Class ProgressWaitCursor
- java.lang.Object
-
- com.nomagic.ui.ProgressWaitCursor
-
@OpenApi public class ProgressWaitCursor extends java.lang.ObjectMouse wait cursor handling helper for progress monitors.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.awt.CursorDEFAULT_CURSOR_CURSORprivate java.awt.event.KeyListenerglassPaneKeyListenerprivate java.awt.event.MouseListenerglassPaneMouseListenerprivate static java.awt.CursorWAIT_CURSOR_CURSORprivate java.util.Map<javax.swing.RootPaneContainer,java.awt.Cursor>waitCursorContainersprivate booleanwaitCursorsInitialized
-
Constructor Summary
Constructors Modifier Constructor Description ProgressWaitCursor()Creates a new progress wait cursor handling helperprivateProgressWaitCursor(java.awt.event.MouseListener mouseListener, java.awt.event.KeyListener keyListener)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProgressWaitCursorcreateProgressWaitCursorIgnoringMouseAndKeyEvents()Creates instance ofProgressWaitCursorwhich shows waiting mouse cursor and filters out all mouse and key events.private voiddispatchProgressComponentEnterExitEvent(java.awt.Component progressComponent, java.awt.event.MouseEvent event, boolean enter)voidinitializeWaitCursor()Initializes mouse wait cursor for all application windowsvoidremoveWaitCursor()Removes mouse wait cursor and restores the original cursors for all application windowsvoidtrackCursor(java.awt.Component progressComponent, java.awt.event.MouseEvent mouseEvent, boolean waitCursorExpected)Tracks mouse cursor changes when mouse enters/leaves progress component.
-
-
-
Field Detail
-
DEFAULT_CURSOR_CURSOR
private static final java.awt.Cursor DEFAULT_CURSOR_CURSOR
-
WAIT_CURSOR_CURSOR
private static final java.awt.Cursor WAIT_CURSOR_CURSOR
-
waitCursorContainers
private final java.util.Map<javax.swing.RootPaneContainer,java.awt.Cursor> waitCursorContainers
-
waitCursorsInitialized
private boolean waitCursorsInitialized
-
glassPaneMouseListener
@CheckForNull private final java.awt.event.MouseListener glassPaneMouseListener
-
glassPaneKeyListener
@CheckForNull private final java.awt.event.KeyListener glassPaneKeyListener
-
-
Method Detail
-
createProgressWaitCursorIgnoringMouseAndKeyEvents
public static ProgressWaitCursor createProgressWaitCursorIgnoringMouseAndKeyEvents()
Creates instance ofProgressWaitCursorwhich shows waiting mouse cursor and filters out all mouse and key events. Therefore user will not be able to interact with any components whileProgressWaitCursoris not removed.- Returns:
- instance of
ProgressWaitCursor
-
initializeWaitCursor
public void initializeWaitCursor()
Initializes mouse wait cursor for all application windows
-
removeWaitCursor
public void removeWaitCursor()
Removes mouse wait cursor and restores the original cursors for all application windows
-
trackCursor
public void trackCursor(java.awt.Component progressComponent, java.awt.event.MouseEvent mouseEvent, boolean waitCursorExpected)Tracks mouse cursor changes when mouse enters/leaves progress component. This method is typically invoked fromEventQueueDispatcher.customDispatchMouseEvent()and ensures that cursor changes to default cursor when mouse is over progress component or to wait cursor when mouse is over rest of controls/windows.- Parameters:
progressComponent- the progress component over which mouse cursor changes to default cursormouseEvent- pending mouse eventwaitCursorExpected-trueindicates that mouse cursor should change to wait cursor,falseindicates that mouse cursor should change to default cursor- See Also:
EventQueueDispatcher.customDispatchMouseEvent(EventQueueDispatcher.Dispatcher, EventQueue, MouseEvent)
-
dispatchProgressComponentEnterExitEvent
private void dispatchProgressComponentEnterExitEvent(java.awt.Component progressComponent, java.awt.event.MouseEvent event, boolean enter)
-
-