public class ComponentConnectionContext extends Object implements ConnectionContext
UI.access(Command)
.Constructor and Description |
---|
ComponentConnectionContext()
Creates an empty component connection context.
|
ComponentConnectionContext(Component component)
Creates a new component connection context which is initially using a
single component.
|
Modifier and Type | Method and Description |
---|---|
void |
addComponent(Component component)
Adds a component instance to track for this context.
|
<T> CompletableFuture<T> |
createCompletableFuture()
Gets a completable future that needs to be resolved within the current
context.
|
void |
dispatchAction(Command action)
Executes the given action by holding the session lock.
|
void |
removeComponent(Component component)
Stops tracking a component for this context.
|
Registration |
setActivationHandler(ActivationHandler activationHandler)
Sets an instance of
ActivationHandler to the current context. |
public ComponentConnectionContext()
public ComponentConnectionContext(Component component)
component
- the component to use, not null
public void addComponent(Component component)
component
- the component to track, not null
removeComponent(Component)
public void removeComponent(Component component)
component
- the component to stop tracking, not null
addComponent(Component)
public Registration setActivationHandler(ActivationHandler activationHandler)
ConnectionContext
ActivationHandler
to the current context.
This method should include logic for updating the activation status.setActivationHandler
in interface ConnectionContext
activationHandler
- the handler for activation changesnull
if there
is nothing to clean uppublic void dispatchAction(Command action)
UI.access(Command)
on the UI that the component(s)
associated with this context belong to. This ensures that any UI changes
are pushed to the client in real-time if Push
is enabled.
If this context is not active (none of the components are attached to a UI), the action is postponed until the connection becomes active.
dispatchAction
in interface ConnectionContext
action
- the action to dispatchpublic <T> CompletableFuture<T> createCompletableFuture()
ConnectionContext
createCompletableFuture
in interface ConnectionContext
CompletableFuture
to be resolvedCopyright © 2021. All rights reserved.