Package PamView.dialog.warn
Class WarnOnce
java.lang.Object
PamView.dialog.warn.WarnOnce
- All Implemented Interfaces:
PamSettings
,SettingsNameProvider
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 Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clearHiddenList
(Window parent) Clear the entire list of hidden warnings.long
boolean
restoreSettings
(PamControlledUnitSettings pamControlledUnitSettings) static int
showNamedWarning
(String name, Window parent, String title, String message, int messageType) Show a warning message.static int
showWarning
(Window parent, String title, String message, int messageType) Show a warning message.static int
showWarning
(Window parent, String title, String message, int messageType, String helpPoint) Show a warning message.static int
showWarning
(Window parent, String title, String message, int messageType, String helpPoint, Throwable error) Show a warning message.static int
showWarning
(Window parent, String title, String message, int messageType, String helpPoint, Throwable error, String okButtonText, String cancelButtonText) Show a warning message.static int
showWarning
(String title, String msg, int messageType) Show a warning message in either a Swing or JavaFX dialog.static int
showWarning
(String title, String msg, int messageType, String helpPoint) Show a warning message in either a Swing or JavaFX dialog.static int
showWarning
(String title, String message, int messageType, String helpPoint, Throwable error) Show a warning message in either a Swing or JavaFX dialog.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.static int
showWarningFX
(javafx.stage.Window parent, String title, String message, javafx.scene.control.Alert.AlertType messageType) Show a warning message in JavaFX dialog.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.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.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.
-
Field Details
-
OK_CANCEL_OPTION
public static final int OK_CANCEL_OPTION- See Also:
-
YES_NO_OPTION
public static final int YES_NO_OPTION- See Also:
-
WARNING_MESSAGE
public static final int WARNING_MESSAGE- See Also:
-
OK_OPTION
public static final int OK_OPTION- See Also:
-
CANCEL_OPTION
public static final int CANCEL_OPTION- See Also:
-
-
Method Details
-
clearHiddenList
Clear the entire list of hidden warnings. All warnings will then be displayed. -
getUnitName
- Specified by:
getUnitName
in interfaceSettingsNameProvider
- Returns:
- A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
-
getUnitType
- Specified by:
getUnitType
in interfacePamSettings
- Returns:
- A Name specific to the type, e.g. Click detector
-
getSettingsReference
- Specified by:
getSettingsReference
in interfacePamSettings
- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersion
in interfacePamSettings
- Returns:
- An integer version number for the settings
-
restoreSettings
- Specified by:
restoreSettings
in interfacePamSettings
- 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
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
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 warningmessage
- warning message (use HTML for multiline messages)messageType
- message type OK_CANCEL_OPTION or WARNING_MESSAGEhelpPoint
- Pointer into help file for additional informationerror
- 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
Show a warning message.- Parameters:
parent
- parent frametitle
- title of warningmessage
- 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 frametitle
- title of warningmessage
- namemessageType
- message type OK_CANCEL_OPTION or WARNING_MESSAGEmessage
- 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 frametitle
- title of warningmessage
- warning message (use html for multiline messages)messageType
- message type OK_CANCEL_OPTION or WARNING_MESSAGEhelpPoint
- 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 frametitle
- title of warningmessage
- warning message (use html for multiline messages)messageType
- message type OK_CANCEL_OPTION or WARNING_MESSAGEhelpPoint
- 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 frametitle
- title of warningmessage
- warning message (use html for multiline messages)messageType
- message type OK_CANCEL_OPTION or WARNING_MESSAGEhelpPoint
- Pointer into help file for additional informationerror
- an error that may have caused this dialog to be displayed. Can be null if there was no errorokButtonText
- the text to use for the ok button instead of OK. If null, the text will stay OKcancelButtonText
- 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 frametitle
- title of warningmessage
- 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 frametitle
- title of warningmessage
- warning message (use html for multiline messages)messageType
- message type AlertType enumhelpPoint
- 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 frametitle
- title of warningmessage
- warning message (use html for multiline messages)messageType
- message type AlertType enumhelpPoint
- 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 frametitle
- title of warningmessage
- warning messagemessageType
- message type AlertType enumhelpPoint
- Pointer into help file for additional informationerror
- an error that may have caused this dialog to be displayed. Can be null if there was no errorokButtonText
- the text to use for the ok button instead of OK. If null, the text will stay OKcancelButtonText
- 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.
-