Class DisplayNotification
java.lang.Object
org.jgrapes.core.internal.EventBase<Void>
org.jgrapes.core.Event<Void>
org.jgrapes.webconsole.base.events.ConsoleCommand
org.jgrapes.webconsole.base.events.DisplayNotification
- All Implemented Interfaces:
Future<Void>
,Associator
,Eligible
Causes a notification to be display on the top of the web console page.
The event triggers the creation of a notification widget in the web console page.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
Fields inherited from class org.jgrapes.webconsole.base.events.ConsoleCommand
mapper
Fields inherited from class org.jgrapes.core.internal.EventBase
completed, completionEvents, invokedFor
-
Constructor Summary
ConstructorDescriptionDisplayNotification
(String content) Creates a new event without any options.DisplayNotification
(String content, Map<String, Object> options) Creates a new event. -
Method Summary
Methods inherited from class org.jgrapes.webconsole.base.events.ConsoleCommand
emitJson, toJson
Methods inherited from class org.jgrapes.core.Event
addCompletionEvent, associated, cancel, channels, channels, completionEvents, currentResults, defaultCriterion, forChannels, get, get, handled, handlingError, isCancelled, isDone, isEligibleFor, isStopped, processedBy, results, results, resumeHandling, setAssociated, setChannels, setRequiresResult, setResult, stop, suspendHandling, suspendHandling, tieTo, toString
Methods inherited from class org.jgrapes.core.internal.EventBase
disableTracking, enqueued, firstResultAssigned, isTracked, onCompletion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGet
Methods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
DisplayNotification
Creates a new event.The content must be valid HTML, i.e. it must start with a tag (usually a “
<span>
”). See the console’s notification method and the JavaScript documentation of the notification options for details.- Parameters:
content
- the content (valid HTML)options
- the options (must be serializable as JSON)
-
DisplayNotification
Creates a new event without any options.The content must be valid HTML, i.e. it must start with a tag (usually a “
<span>
”).- Parameters:
content
- the content (valid HTML)
-
-
Method Details
-
addOption
Adds an option to the event.- Parameters:
name
- the option namevalue
- the option value (must be serializable as JSON)- Returns:
- the event for easy chaining
-
content
Returns the content.- Returns:
- the content
-
options
Return the options.- Returns:
- the options
-
emitJson
Description copied from class:ConsoleCommand
Emits the JSON notification using the given writer.Derived classes usually simply call
ConsoleCommand.emitJson(Writer, String, Object...)
with the method name and parameters.- Specified by:
emitJson
in classConsoleCommand
- Parameters:
writer
- the writer- Throws:
IOException
-