Package io.guise.framework.model
Class Notification
java.lang.Object
com.globalmentor.beans.BoundPropertyObject
io.guise.framework.model.AbstractModel
io.guise.framework.model.DefaultLabelModel
io.guise.framework.model.Notification
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,LabelModel
,Model
A notification to the user of some event or state, such as an error or invalid user input. A notification also allows certain options indicating response
choices for the user when presented with the notification.
- Author:
- Garret Wilson
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The options which can be expected as responses for this notification.static enum
The severity of the notification. -
Field Summary
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
Fields inherited from interface io.guise.framework.model.LabelModel
GLYPH_URI_PROPERTY, LABEL_CONTENT_TYPE_PROPERTY, LABEL_PROPERTY
-
Constructor Summary
ConstructorDescriptionNotification
(String message, com.globalmentor.net.MediaType messageContentType, Notification.Option... options) Message and message content type constructor with aNotification.Severity.INFO
severity and no associated error.Notification
(String message, com.globalmentor.net.MediaType messageContentType, Notification.Severity severity, Notification.Option... options) Message, message content type, and severity constructor with no associated error.Notification
(String message, com.globalmentor.net.MediaType messageContentType, Notification.Severity severity, Throwable error, Notification.Option... options) Message, message content type, severity, error, and options constructor.Notification
(String message, Notification.Option... options) Message constructor with aNotification.Severity.INFO
severity, no error, and atext/plain
content type.Notification
(String message, Notification.Severity severity, Notification.Option... options) Message and severity constructor with no error and atext/plain
content type.Notification
(String message, Notification.Severity severity, Throwable error, Notification.Option... options) Message, severity, and error constructor with atext/plain
content type.Notification
(Throwable error, Notification.Option... options) Error constructor with aNotification.Severity.ERROR
severity and atext/plain
content type.Notification
(Throwable error, String message, Notification.Option... options) Error and message constructor with aNotification.Severity.ERROR
severity and atext/plain
content type. -
Method Summary
Methods inherited from class io.guise.framework.model.DefaultLabelModel
getGlyphURI, getLabel, getLabelContentType, setGlyphURI, setLabel, setLabelContentType
Methods inherited from class io.guise.framework.model.AbstractModel
getEventListenerManager, getPlainText
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Constructor Details
-
Notification
Error constructor with aNotification.Severity.ERROR
severity and atext/plain
content type. If the error provides a message, it is used as the notification message; otherwise, the error's string value is used as the message.- Parameters:
error
- The associated error or exception.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given error and/or options isnull
.
-
Notification
Error and message constructor with aNotification.Severity.ERROR
severity and atext/plain
content type.- Parameters:
error
- The associated error or exception.message
- The message text, which may include a resource reference.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given error, message, and/or options isnull
.
-
Notification
Message constructor with aNotification.Severity.INFO
severity, no error, and atext/plain
content type.- Parameters:
message
- The message text, which may include a resource reference.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given message and/or options isnull
.
-
Notification
Message and severity constructor with no error and atext/plain
content type.- Parameters:
message
- The message text, which may include a resource reference.severity
- The severity of the notification.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given message, severity, and/or options isnull
.
-
Notification
public Notification(String message, Notification.Severity severity, Throwable error, Notification.Option... options) Message, severity, and error constructor with atext/plain
content type.- Parameters:
message
- The message text, which may include a resource reference.severity
- The severity of the notification.error
- The associated error or exception, ornull
if there is no related error.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given message, severity, and/or options isnull
.
-
Notification
public Notification(String message, com.globalmentor.net.MediaType messageContentType, Notification.Option... options) Message and message content type constructor with aNotification.Severity.INFO
severity and no associated error.- Parameters:
message
- The message text, which may include a resource referencemessageContentType
- The message text content type.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given message, severity, and/or options isnull
.IllegalArgumentException
- if the given content type is not a text content type.
-
Notification
public Notification(String message, com.globalmentor.net.MediaType messageContentType, Notification.Severity severity, Notification.Option... options) Message, message content type, and severity constructor with no associated error.- Parameters:
message
- The message text, which may include a resource reference.messageContentType
- The message text content type.severity
- The severity of the notification.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given message, severity, and/or options isnull
.IllegalArgumentException
- if the given content type is not a text content type.
-
Notification
public Notification(String message, com.globalmentor.net.MediaType messageContentType, Notification.Severity severity, Throwable error, Notification.Option... options) Message, message content type, severity, error, and options constructor.- Parameters:
message
- The message text, which may include a resource reference.messageContentType
- The message text content type.severity
- The severity of the notification.error
- The associated error or exception, ornull
if there is no related error.options
- The available response options; if no options are given,Notification.Option.OK
will be assumed.- Throws:
NullPointerException
- if the given message and/or options isnull
.IllegalArgumentException
- if the given content type is not a text content type.
-
-
Method Details
-
getError
- Returns:
- The associated error or exception, if any.
-
getSeverity
- Returns:
- The severity of the notification.
-
getOptions
- Returns:
- The read-only list of available response options in order.
-
getMessage
- Returns:
- The message text, which may include a resource reference.
-
getMessageContentType
public com.globalmentor.net.MediaType getMessageContentType()- Returns:
- The content type of the message text.
-
toString
- Overrides:
toString
in classDefaultLabelModel
-