Package ca.cgjennings.apps.arkham.dialog
Class Messenger
- java.lang.Object
-
- ca.cgjennings.apps.arkham.dialog.Messenger
-
public class Messenger extends java.lang.Object
TheMessenger
manages the display of information and error messages for top-level windows. A queue of messages is maintained for each window. If a message is already displayed and a new message is posted, it will be added to a queue and shown after the current message and all queued messages have been displayed.Messages that do not explicitly return a result will return immediately, without waiting for the message to be displayed or dismissed.
- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
displayErrorMessage(java.awt.Component parent, java.lang.String message)
Displays an error message to the user.static void
displayMessage(java.awt.Component parent, java.lang.String message)
Displays a message to the user.static void
displayMessage(java.awt.Component parent, java.lang.String iconResource, java.lang.String message)
Displays a message to the user.static void
displayMessage(java.awt.Component parent, javax.swing.Icon icon, java.lang.String message)
Displays a message to the user.static void
displayMessage(java.awt.Component parent, javax.swing.Icon icon, java.lang.String message, javax.swing.JComponent[] inlineComponents)
Displays a message to the user.static void
displayWarningMessage(java.awt.Component parent, java.lang.String message)
Displays a warning message to the user.static boolean
isQueueProcessingEnabled()
Returnstrue
if the messages in message queues are actively being displayed.static void
setQueueProcessingEnabled(boolean enable)
Enables or disables message queue processing.
-
-
-
Method Detail
-
displayWarningMessage
public static void displayWarningMessage(java.awt.Component parent, java.lang.String message)
Displays a warning message to the user. An warning message is used to warn that the user that an action they are about to take may have unexpected or irreversible consequences. (Compare this todisplayErrorMessage(java.awt.Component, java.lang.String)
.)- Parameters:
parent
- the component or window that this message relates to; ifnull
, then the main application window will be the parentmessage
- the text of the message- Throws:
java.lang.NullPointerException
- ifmessage
isnull
-
displayErrorMessage
public static void displayErrorMessage(java.awt.Component parent, java.lang.String message)
Displays an error message to the user. An error message is used to report that a problem has occurred. (Compare this todisplayWarningMessage(java.awt.Component, java.lang.String)
.)- Parameters:
parent
- the component or window that this message relates to; ifnull
, then the main application window will be the parentmessage
- the text of the message- Throws:
java.lang.NullPointerException
- ifmessage
isnull
-
displayMessage
public static void displayMessage(java.awt.Component parent, java.lang.String iconResource, java.lang.String message)
Displays a message to the user.- Parameters:
parent
- the component or window that this message relates to; ifnull
, then the main application window will be the parenticonResource
- an optional image resource to display beside the message; this will be loaded usingResourceKit.getIcon(java.lang.String)
message
- the text of the message- Throws:
java.lang.NullPointerException
- ifmessage
isnull
-
displayMessage
public static void displayMessage(java.awt.Component parent, java.lang.String message)
Displays a message to the user.- Parameters:
parent
- the component or window that this message relates to; ifnull
, then the main application window will be the parentmessage
- the text of the message- Throws:
java.lang.NullPointerException
- ifmessage
isnull
-
displayMessage
public static void displayMessage(java.awt.Component parent, javax.swing.Icon icon, java.lang.String message)
Displays a message to the user.- Parameters:
parent
- the component or window that this message relates to; ifnull
, then the main application window will be the parenticon
- an optional icon to display beside the messagemessage
- the text of the message- Throws:
java.lang.NullPointerException
- ifmessage
isnull
-
displayMessage
public static void displayMessage(java.awt.Component parent, javax.swing.Icon icon, java.lang.String message, javax.swing.JComponent[] inlineComponents)
Displays a message to the user.- Parameters:
parent
- the component or window that this message relates to; ifnull
, then the main application window will be the parenticon
- an optional icon to display beside the messagemessage
- the text of the messageinlineComponents
- an array of interface components that will be included as part of the message by stacking them, one per row, under the main message text- Throws:
java.lang.NullPointerException
- ifmessage
isnull
-
setQueueProcessingEnabled
public static void setQueueProcessingEnabled(boolean enable)
Enables or disables message queue processing. While queue processing is disabled, messages will continue to be queued but will not be displayed. When queue processing is reenabled, the display of messages in the queue will resume.- Parameters:
enable
- whether queued messages should be displayed (true
) or held for future display (false
)- See Also:
isQueueProcessingEnabled()
-
isQueueProcessingEnabled
public static boolean isQueueProcessingEnabled()
Returnstrue
if the messages in message queues are actively being displayed.- Returns:
true
if queue processing is enabled
-
-