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 nullpublic void addComponent(Component component)
component - the component to track, not nullremoveComponent(Component)public void removeComponent(Component component)
component - the component to stop tracking, not nulladdComponent(Component)public Registration setActivationHandler(ActivationHandler activationHandler)
ConnectionContextActivationHandler to the current context.
This method should include logic for updating the activation status.setActivationHandler in interface ConnectionContextactivationHandler - 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 ConnectionContextaction - the action to dispatchpublic <T> CompletableFuture<T> createCompletableFuture()
ConnectionContextcreateCompletableFuture in interface ConnectionContextCompletableFuture to be resolvedCopyright © 2021. All rights reserved.