Class RenderConlet
- All Implemented Interfaces:
Future<Void>,Associator,Eligible
Sent to the web console page
for adding or updating a complete web console component representation.
The actual content (the HTML) is passed to the constructor as a
Future, allowing the content to be evaluated in parallel
to the event handling.
The content must be valid HTML, usable as inner HTML of a block level
element (typically a div). If the root element has an attribute
data-conlet-title, its value overrides the default title (the display
name of the conlet type, see AddConletType.displayNames()).
The content provided is searched for attributes data-jgwc-on-load
and data-jgwc-on-unload which must have as value the name of a
function. When the HTML has been loaded or unloaded (i.e. added to
the DOM or removed from the DOM), the respective functions are
invoked with the element containing the attribute as their first
parameter. A second boolean parameter is true if the on-load
function is called due to an update of an already existing container.
The HTML elements of edit dialogs (Conlet.RenderMode.Edit)
can have an additional attribute data-jgwc-on-apply
which must have as its value the name of a function. This
function is invoked when changes made in the form must be
applied (e.g. before the dialog is closed).
-
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
mapperFields inherited from class org.jgrapes.core.internal.EventBase
completed, completionEvents, invokedFor -
Constructor Summary
ConstructorsConstructorDescriptionRenderConlet(String conletType, String conletId, Future<String> content) Creates a new event. -
Method Summary
Modifier and TypeMethodDescriptionaddSupportedMode(Conlet.RenderMode supportedMode) Add the given render mode to the supported render modes.conletId()Returns the web console component id as specified on creation.Returns the web console component type as specified on creation.content()Provides the HTML that displays the web console component on the page.voidWrites the JSON notification to the given writer.renderAs()Returns the render mode.setRenderAs(Set<Conlet.RenderMode> renderAs) Set the render mode (including modifier).setRenderAs(Conlet.RenderMode renderMode) Set the render mode.setSupportedModes(Set<Conlet.RenderMode> supportedModes) Set the supported render modes.Returns the supported modes.Methods inherited from class org.jgrapes.webconsole.base.events.ConsoleCommand
emitJson, toJsonMethods 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, toStringMethods inherited from class org.jgrapes.core.internal.EventBase
disableTracking, enqueued, firstResultAssigned, isTracked, onCompletionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGetMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
RenderConlet
Creates a new event.- Parameters:
conletType- the conlet typeconletId- the id of the web console componentcontent- the content
-
-
Method Details
-
conletType
Returns the web console component type as specified on creation.- Returns:
- the type
-
conletId
Returns the web console component id as specified on creation.- Returns:
- the web console component id
-
setRenderAs
Set the render mode.The default value is
Conlet.RenderMode.Preview.- Parameters:
renderMode- the render mode to set- Returns:
- the event for easy chaining
-
setRenderAs
Set the render mode (including modifier).- Parameters:
renderAs- the render mode to use- Returns:
- the event for easy chaining
-
renderAs
Returns the render mode.- Returns:
- the render mode
-
setSupportedModes
Set the supported render modes.The default value is
Conlet.RenderMode.Preview.- Parameters:
supportedModes- the supported render modes to set- Returns:
- the event for easy chaining
-
addSupportedMode
Add the given render mode to the supported render modes.- Parameters:
supportedMode- the supported render modes to add- Returns:
- the event for easy chaining
-
supportedRenderModes
Returns the supported modes.- Returns:
- the supported modes
-
content
Provides the HTML that displays the web console component on the page.- Returns:
- the HTML
-
emitJson
Writes the JSON notification to the given writer.- Specified by:
emitJsonin classConsoleCommand- Parameters:
writer- the writer- Throws:
ExecutionExceptionInterruptedExceptionIOException
-