Class AddConletType
- All Implemented Interfaces:
Future<Void>
,Associator
,Eligible
Specifying global
resources result in the respective
<link .../>
or <script ...></script>
nodes
being added to the page’s <head>
node.
This in turn causes the browser to issue GET
requests that
(usually) refer to the web console component’s resources. These requests are
converted to ConletResourceRequest
s by the web console and
sent to the web console components, which must respond to the requests.
The sequence of events is shown in the diagram.
See ResourceRequest
for details about the processing
of the ConletResourceRequest
.
A conlet’s JavaScript may (and probably must) make use of the functions provided by the web console page. See the JavaScript documentation of these functions for details.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Specifies an embedded instance to be added.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
ConstructorDescriptionAddConletType
(String conletType) Create a new event for the given web console component type. -
Method Summary
Modifier and TypeMethodDescriptionaddCss
(RenderSupport renderSupport, URI uri) Add the URI of a CSS resource that is to be added to the header section of the web console page.addPageContent
(String area, Map<String, String> properties) Causes a container with this conlet’s type as attribute “data-conlet-type” and classes “conlet conlet-content” to be added to the specified page area.Add a render mode to be offered to the user for creating new conlet instances.addScript
(AddPageResources.ScriptResource scriptResource) Add a script resource to be requested by the browser.Return the web console component type.URI[]
cssUris()
Return all CSS URIs.Return the display names.void
Emits the JSON notification using the given writer.Return the list of page components.Return the render modes.Return all script resources.setDisplayNames
(Map<Locale, String> displayNames) Sets the names (by locale) used to display the type in the user interface.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
-
AddConletType
Create a new event for the given web console component type.- Parameters:
conletType
- a unique id for the web console component type (usually the class name)
-
-
Method Details
-
conletType
Return the web console component type.- Returns:
- the web console component type
-
setDisplayNames
Sets the names (by locale) used to display the type in the user interface.- Parameters:
displayNames
- the display names- Returns:
- the event for easy chaining
-
displayNames
Return the display names.- Returns:
- the displayNames
-
addRenderMode
Add a render mode to be offered to the user for creating new conlet instances.Several modes may be added. Usually only the modes
Conlet.RenderMode.Preview
andConlet.RenderMode.View
make sense and are the only ones supported by webconsoles. They commonly cause the conlet type to be added to a menu which is made available to the user.- Parameters:
mode
- the mode- Returns:
- the event for easy chaining
-
renderModes
Return the render modes.- Returns:
- the result
-
addScript
Add a script resource to be requested by the browser.- Parameters:
scriptResource
- the script resource- Returns:
- the event for easy chaining
-
addCss
Add the URI of a CSS resource that is to be added to the header section of the web console page.- Parameters:
renderSupport
- the render support for mapping theuri
uri
- the URI- Returns:
- the event for easy chaining
-
scriptResources
Return all script resources.- Returns:
- the result
-
cssUris
Return all CSS URIs.- Returns:
- the result
-
addPageContent
Causes a container with this conlet’s type as attribute “data-conlet-type” and classes “conlet conlet-content” to be added to the specified page area.The properties are added to the container as additional “data-conlet-…” attributes and will be passed to the
AddConletRequest
issued by the console when requesting the conlet’s representation.Currently, the only defined page area is “headerIcons”. When adding conlets in this area, the numeric property “priority” may be used to determine the order. The default value is 0. Conlets with the same priority are ordered by their type name.
- Parameters:
area
- the area into which the component is to be addedproperties
- the properties- Returns:
- the event for easy chaining
- See Also:
-
pageContent
Return the list of page components.- Returns:
- the list
-
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
-