Class WarnOnce

java.lang.Object
PamView.dialog.warn.WarnOnce
All Implemented Interfaces:
PamSettings, SettingsNameProvider

public class WarnOnce extends Object implements PamSettings
Show a dialog which can display a warning message and can be told to never show again. Contains mostly static methods to create the dialog panels.
Author:
Doug Gillepsie
  • Field Details

  • Method Details

    • clearHiddenList

      public static void clearHiddenList(Window parent)
      Clear the entire list of hidden warnings. All warnings will then be displayed.
    • getUnitName

      public String getUnitName()
      Specified by:
      getUnitName in interface SettingsNameProvider
      Returns:
      A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Returns:
      A Name specific to the type, e.g. Click detector
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Returns:
      An integer version number for the settings
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
    • showWarning

      public static int showWarning(String title, String message, int messageType, String helpPoint, Throwable error, String okButtonText, String cancelButtonText)
      Show a warning message in either a Swing or JavaFX dialog. The current GUI type automatically chooses the dialog type.
      Parameters:
      title - title of warning.
      message - warning message (use HTML for multi-line messages).
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE.
      helpPoint - Pointer into help file for additional information.
      error - an error that may have caused this dialog to be displayed. Can be null if there was no error.
      okButtonText - the text to use for the OK button instead of OK. If null, the text will stay OK.
      cancelButtonText - the text to use for the cancel button instead of Cancel. If null, the text will stay Cancel otherwise OK_OPTION will always be returned.
      Returns:
      if messageType is OK_CANCEl_OPTION this will return OK_OPTION or CANCEL_OPTION otherwise OK_OPTION will always be returned.
    • showWarning

      public static int showWarning(String title, String msg, int messageType)
      Show a warning message in either a Swing or JavaFX dialog. The current GUI type automatically chooses the dialog type.
      Parameters:
      title - title of warning.
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE.
      message - warning message (use HTML for multi-line messages).
      Returns:
      if messageType is OK_CANCEl_OPTION this will return OK_OPTION or CANCEL_OPTION otherwise OK_OPTION will always be returned.
    • showWarning

      public static int showWarning(String title, String msg, int messageType, String helpPoint)
      Show a warning message in either a Swing or JavaFX dialog. The current GUI type automatically chooses the dialog type.
      Parameters:
      title - title of warning.
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE.
      helpPoint - Pointer into help file for additional information.
      message - warning message (use HTML for multi-line messages).
      Returns:
      if messageType is OK_CANCEl_OPTION this will return OK_OPTION or CANCEL_OPTION otherwise OK_OPTION will always be returned.
    • showWarning

      public static int showWarning(String title, String message, int messageType, String helpPoint, Throwable error)
      Show a warning message in either a Swing or JavaFX dialog. The current GUI type automatically chooses the dialog type.
      Parameters:
      title - title of warning
      message - warning message (use HTML for multiline messages)
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE
      helpPoint - Pointer into help file for additional information
      error - an error that may have caused this dialog to be displayed. Can be null if there was no error otherwise OK_OPTION will always be returned.
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION,
    • showWarning

      public static int showWarning(Window parent, String title, String message, int messageType)
      Show a warning message.
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message (use html for multiline messages)
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION, otherwise OK_OPTION will always be returned.
    • showNamedWarning

      public static int showNamedWarning(String name, Window parent, String title, String message, int messageType)
      Show a warning message. This version of the call uses the additional 'name' parameter to determine if the warning should be shown or not so that multiple similar messages can be turned off even though the title and message may be slightly different.
      Parameters:
      parent - parent frame
      title - title of warning
      message - name
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE
      message - warning message (use html for multiline messages)
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION, otherwise OK_OPTION will always be returned.
    • showWarning

      public static int showWarning(Window parent, String title, String message, int messageType, String helpPoint)
      Show a warning message. If PAMGuard is being controlled through the network, display the error message in the console instead of a dialog box that requires user interaction
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message (use html for multiline messages)
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE
      helpPoint - Pointer into help file for additional information
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION, otherwise OK_OPTION will always be returned.
    • showWarning

      public static int showWarning(Window parent, String title, String message, int messageType, String helpPoint, Throwable error)
      Show a warning message.
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message (use html for multiline messages)
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE
      helpPoint - Pointer into help file for additional information
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION, otherwise OK_OPTION will always be returned.
    • showWarning

      public static int showWarning(Window parent, String title, String message, int messageType, String helpPoint, Throwable error, String okButtonText, String cancelButtonText)
      Show a warning message.
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message (use html for multiline messages)
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE
      helpPoint - Pointer into help file for additional information
      error - an error that may have caused this dialog to be displayed. Can be null if there was no error
      okButtonText - the text to use for the ok button instead of OK. If null, the text will stay OK
      cancelButtonText - the text to use for the cancel button instead of Cancel. If null, the text will stay Cancel
      Returns:
      if messageType is OK_CANCEL_OPTION this will return OK_OPTION or CANCEL_OPTION, otherwise OK_OPTION will always be returned.
    • showWarningFX

      public static int showWarningFX(javafx.stage.Window parent, String title, String message, javafx.scene.control.Alert.AlertType messageType)
      Show a warning message in JavaFX dialog.
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message (use html for multiline messages)
      messageType - message type OK_CANCEL_OPTION or WARNING_MESSAGE
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION, otherwise OK_OPTION will always be returned.
    • showWarningFX

      public static int showWarningFX(javafx.stage.Window parent, String title, String message, javafx.scene.control.Alert.AlertType messageType, String helpPoint)
      Show a warning message in JavaFX dialog. If PAMGuard is being controlled through the network, display the error message in the console instead of a dialog box that requires user interaction
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message (use html for multiline messages)
      messageType - message type AlertType enum
      helpPoint - Pointer into help file for additional information
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION, otherwise OK_OPTION will always be returned.
    • showWarningFX

      public static int showWarningFX(javafx.stage.Window parent, String title, String message, javafx.scene.control.Alert.AlertType messageType, String helpPoint, Throwable error)
      Show a warning message in JavaFX dialog.
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message (use html for multiline messages)
      messageType - message type AlertType enum
      helpPoint - Pointer into help file for additional information
      Returns:
      if messageType is OK_CANCEN_OPTION this will return OK_OPTION or CANECL_OPTION, otherwise OK_OPTION will always be returned.
    • showWarningFX

      public static int showWarningFX(javafx.stage.Window parent, String title, String message, javafx.scene.control.Alert.AlertType messageType, String helpPoint, Throwable error, String okButtonText, String cancelButtonText)
      Show a warning message in JavaFX dialog.
      Parameters:
      parent - parent frame
      title - title of warning
      message - warning message
      messageType - message type AlertType enum
      helpPoint - Pointer into help file for additional information
      error - an error that may have caused this dialog to be displayed. Can be null if there was no error
      okButtonText - the text to use for the ok button instead of OK. If null, the text will stay OK
      cancelButtonText - the text to use for the cancel button instead of Cancel. If null, the text will stay Cancel
      Returns:
      if messageType is OK_CANCEL_OPTION this will return OK_OPTION or CANCEL_OPTION, otherwise OK_OPTION will always be returned.