Class AddConletRequest
- All Implemented Interfaces:
Future<String>
,Associator
,Eligible
The console
server usually responds with a RenderConlet
event that has as
payload the HTML that displays the web console component on the console
page.
Properties may be passed with the event. The interpretation
of the properties is completely dependent on the web console
component that handles the request. It is recommended to use
String
s as keys and JDK types as values. This avoids
classpath dependencies on the web console component that is
to be added.
AddConletRequest
can also be generated on the server side
to automatically add a conlet in response to some event. Usually,
the origin of the event is not important when handling the event.
Nevertheless, the origin can be determined by calling
isFrontendRequest()
as it may be important e.g. for
security related checks.
The event’s result is the web console component id of the new web console component instance.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
Fields inherited from class org.jgrapes.core.internal.EventBase
completed, completionEvents, invokedFor
-
Constructor Summary
ConstructorDescriptionAddConletRequest
(RenderSupport renderSupport, String conletType, Set<Conlet.RenderMode> renderModes) Creates a new event.AddConletRequest
(RenderSupport renderSupport, String conletType, Set<Conlet.RenderMode> renderModes, Map<?, ?> properties) Creates a new event. -
Method Summary
Modifier and TypeMethodDescriptionaddProperty
(Object key, Object value) Convenience method for adding properties one-by-one.Returns the web console component typeifPresent
(Object key, BiConsumer<Object, Object> action) Convenience method that performs the given action if a property with the given key exists.boolean
Checks if this request originated from the browser.Returns the properties.Marks this event as originating from the browser.Methods inherited from class org.jgrapes.webconsole.base.events.RenderConletRequestBase
renderAs, renderSupport
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
-
AddConletRequest
public AddConletRequest(RenderSupport renderSupport, String conletType, Set<Conlet.RenderMode> renderModes) Creates a new event.- Parameters:
renderSupport
- the render supportconletType
- the type of the web console componentrenderModes
- the render modes
-
AddConletRequest
public AddConletRequest(RenderSupport renderSupport, String conletType, Set<Conlet.RenderMode> renderModes, Map<?, ?> properties) Creates a new event.- Parameters:
renderSupport
- the render supportconletType
- the type of the web console componentrenderModes
- the render modesproperties
- optional values for properties of the web console component instance
-
-
Method Details
-
setFrontendRequest
Marks this event as originating from the browser.- Returns:
- the adds the conlet request
-
isFrontendRequest
Checks if this request originated from the browser.- Returns:
- true, if is frontend request
-
conletType
Returns the web console component type- Returns:
- the web console component type
-
properties
Returns the properties.Every event returns a mutable map, thus allowing event handlers to modify the map even if none was passed to the constructor.
-
addProperty
Convenience method for adding properties one-by-one.- Parameters:
key
- the property keyvalue
- the property value- Returns:
- the event for easy chaining
-
ifPresent
Convenience method that performs the given action if a property with the given key exists.- Parameters:
key
- the property keyaction
- the action to perform
-