Class GuiUtils.Notices

java.lang.Object
sc.fiji.snt.gui.GuiUtils.Notices
Enclosing class:
GuiUtils

public static class GuiUtils.Notices extends Object
A process-wide, persistent queue of pending notices for a notification-center UI element.
  • Constructor Details

    • Notices

      public Notices()
  • Method Details

    • queueNotice

      public static void queueNotice(String html, String url, Runnable action)
      Queues a notification for the (single, process-wide) notification-center UI element (see setNotificationsListener(java.lang.Runnable)). Does not display anything itself (see GuiUtils.notify(String, int) for that)
      Parameters:
      html - the notification's HTML-formatted message
      url - an optional URL to be opened if the message is clicked, or null
      action - an optional in-app action to be run if the message is clicked, or null
    • queueNotice

      public static void queueNotice(String html, String url, Runnable action, int logLevel)
      As queueNotice(String, String, Runnable), but also specifying the notice's severity
      Parameters:
      logLevel - the notice's severity as defined by LogLevel, used to pick an accent icon for it
    • dismissPendingNotice

      public static void dismissPendingNotice(GuiUtils.Notices.PendingNotice notice)
      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 by getPendingNotices()
    • clearPendingNotices

      public static void clearPendingNotices()
      Empties the notification queue, e.g., once the user has seen/acknowledged all of its contents.
    • setNotificationsListener

      public static void setNotificationsListener(Runnable listener)
      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 reflect hasPendingNotices() 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

      public static List<GuiUtils.Notices.PendingNotice> getPendingNotices()
      Returns:
      an unmodifiable snapshot of the notifications currently queued
    • hasPendingNotices

      public static boolean hasPendingNotices()
      Returns:
      true if one or more notifications are queued