Interface AlertManager


public interface AlertManager
The AlertManager allows you to show non-intrusive messages to the user, which will be displayed in a special window, the Messages window. You can access the AlertManager via Studio.alerts() or Studio.getAlertManager().
  • Method Details

    • postAlert

      Alert postAlert(String title, Class<?> group, String text)
      Send notification of a specific event. Events are grouped by both title and group (the group is not directly exposed to the user in the GUI), and only the most recent event for a given title/group pair is normally shown to the user. This can thus be useful for notifying the user of events that you anticipate may occur many times (for example, errors in processing images due to a malconfigured processor). If the group is null, then the alert will always be shown, in addition to all other alerts for this title.

      If the user dismisses one of these alerts, they are effectively clearing the "message history" for the alert. Future calls to this method will create a new alert rather than resurrect the old one.

      Parameters:
      title - Title text to show above the alert. May be null.
      group - Object to use for grouping multiple alert texts together. May be null; null-group alerts are always displayed.
      text - Text of the alert.
      Returns:
      Either a newly-created Alert, or the Alert that already existed, to which this new alert text was added.
    • postUpdatableAlert

      UpdatableAlert postUpdatableAlert(String title, String text)
      Create a UpdatableAlert. UpdatableAlerts can have their contents changed after they have been posted. However, if the user dismisses the alert, changing the text will not bring it back. Each UpdatableAlert is shown separately in the Messages window, so calling this method repeatedly can rapidly fill the window with alerts.
      Parameters:
      title - Title text to show above the main text. May be null.
      text - Initial text to display to the user.
      Returns:
      Newly-created UpdatableAlert
    • postCustomAlert

      UpdatableAlert postCustomAlert(String title, JComponent contents)
      Create an alert containing the provided special contents. If there is already a custom alert with the same title and contents, and that alert is still usable (per its isUsable() method), then no action will be taken.

      This method returns a UpdatableAlert primarily so that the custom alert may update the text of the alert (via UpdatableAlert.setText()). While this does not directly affect the display of the alert in the Messages window (the caller is of course responsible for that), it does affect the text that is displayed in the main window.

      Parameters:
      title - Title text to show above the custom contents. May be null.
      contents - Contents to be inserted into the alert dialog.
      Returns:
      Newly-created Alert