Package sc.fiji.snt.gui
Class GuiUtils.Notices
java.lang.Object
sc.fiji.snt.gui.GuiUtils.Notices
- Enclosing class:
GuiUtils
A process-wide, persistent queue of pending notices for a notification-center UI element.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA notification message queued for a persistent notification-center UI element. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidEmpties the notification queue, e.g., once the user has seen/acknowledged all of its contents.static voidRemoves a single notice from the queue, e.g., once the user has seen/acted on it.static List<GuiUtils.Notices.PendingNotice> static booleanstatic voidqueueNotice(String html, String url, Runnable action) Queues a notification for the (single, process-wide) notification-center UI element (seesetNotificationsListener(java.lang.Runnable)).static voidqueueNotice(String html, String url, Runnable action, int logLevel) AsqueueNotice(String, String, Runnable), but also specifying the notice's severitystatic voidsetNotificationsListener(Runnable listener) Registers the listener invoked (on the EDT) whenever the pending-notifications queue changes (an entry is added or removed).
-
Constructor Details
-
Notices
public Notices()
-
-
Method Details
-
queueNotice
Queues a notification for the (single, process-wide) notification-center UI element (seesetNotificationsListener(java.lang.Runnable)). Does not display anything itself (seeGuiUtils.notify(String, int)for that)- Parameters:
html- the notification's HTML-formatted messageurl- an optional URL to be opened if the message is clicked, or nullaction- an optional in-app action to be run if the message is clicked, or null
-
queueNotice
AsqueueNotice(String, String, Runnable), but also specifying the notice's severity- Parameters:
logLevel- the notice's severity as defined byLogLevel, used to pick an accent icon for it
-
dismissPendingNotice
Removes a single notice from the queue, e.g., once the user has seen/acted on it. Other queued notices are left untouched.- Parameters:
notice- the notice to remove, typically one previously returned bygetPendingNotices()
-
clearPendingNotices
public static void clearPendingNotices()Empties the notification queue, e.g., once the user has seen/acknowledged all of its contents. -
setNotificationsListener
Registers the listener invoked (on the EDT) whenever the pending-notifications queue changes (an entry is added or removed). Intended for driving a UI element, such as a status bar button, that needs to reflecthasPendingNotices()accurately. There is only one queue process-wide, so registering a new listener replaces whichever one was previously set- Parameters:
listener- the listener to be run on change, or null to unregister
-
getPendingNotices
- Returns:
- an unmodifiable snapshot of the notifications currently queued
-
hasPendingNotices
public static boolean hasPendingNotices()- Returns:
- true if one or more notifications are queued
-