Interface ClientConnector
-
- All Known Subinterfaces:
Extension
- All Known Implementing Classes:
AbsoluteLayout,AbstractClientConnector,AbstractComponent,AbstractComponentContainer,AbstractLayout,AbstractOrderedLayout,AbstractSingleComponentContainer,FormLayout,GridLayout,HorizontalLayout,Label,Panel,VerticalLayout
public interface ClientConnectorLegacy version of ClientConnector that resembles Vaadin 7/8's ClientConnector API as closely as possible in order to facilitate migration to newer versions of Vaadin.Interface implemented by all legacy connectors that are capable of communicating with the client side.
- Author:
- Vaadin Ltd
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classClientConnector.AttachEventEvent fired before a connector is attached from the application.static interfaceClientConnector.AttachListenerInterface for listeningconnector attach events.static classClientConnector.DetachEventEvent fired before a connector is detached from the application.static interfaceClientConnector.DetachListenerInterface for listeningconnector attach events.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.vaadin.flow.shared.RegistrationaddLegacyAttachListener(ClientConnector.AttachListener listener)Add a listener for legacy connector attach events.com.vaadin.flow.shared.RegistrationaddLegacyDetachListener(ClientConnector.DetachListener listener)Add a listener for connector detach events.voidattach()Notifies the connector that it is connected to a VaadinSession (and therefore also to a UI).voidbeforeClientResponse(boolean initial)Called before the response is written to client side.voiddetach()Notifies the connector that it is detached from its VaadinSession.booleanisAttached()Checks if the connector is attached to a VaadinSession.booleanisConnectorEnabled()Checks if the communicator is enabled.voidmarkAsDirty()Marks that this classic component's state might have changed.voidmarkAsDirtyRecursive()Causes this classic component and all child components below it to be marked as dirty.
-
-
-
Method Detail
-
beforeClientResponse
void beforeClientResponse(boolean initial)
Called before the response is written to client side. Gives the legacy connector an opportunity to set computed/dynamic state values.This is implemented for the legacy components to keep consistent behavior and e.g. legaze size calculations working.
NOTE: the parameter
initialisfalsewhen the component is attached again to a newUIwhenPreserveOnRefreshis used.- Parameters:
initial-trueif the client-side connector will be created and initialized after this method has been invoked.falseif there is already an initialized client-side connector.
-
markAsDirty
void markAsDirty()
Marks that this classic component's state might have changed. When the framework is about to send new data to the client-side, it will runbeforeClientResponse(boolean)for all legacy components that are marked as dirty.
-
markAsDirtyRecursive
void markAsDirtyRecursive()
Causes this classic component and all child components below it to be marked as dirty.This should only be used in special cases, e.g when the state of a descendant depends on the state of an ancestor.
This will go through the whole component subtree, including any non-legacy components.
- See Also:
markAsDirty()
-
addLegacyAttachListener
com.vaadin.flow.shared.Registration addLegacyAttachListener(ClientConnector.AttachListener listener)
Add a listener for legacy connector attach events. This could be migrated toAttachNotifier.addAttachListener(ComponentEventListener).- Parameters:
listener- the listener to add- Returns:
- Registration for unregistering the listener
-
addLegacyDetachListener
com.vaadin.flow.shared.Registration addLegacyDetachListener(ClientConnector.DetachListener listener)
Add a listener for connector detach events. This could be migrated toDetachNotifier.addDetachListener(ComponentEventListener)- Parameters:
listener- the listener to add- Returns:
- Registration for unregistering the listener
-
attach
void attach()
Notifies the connector that it is connected to a VaadinSession (and therefore also to a UI).The caller of this method is
ComponentUtil.onComponentAttach(Component, boolean)} if the parent is itself already attached to the session. If not, it's called when the parent is attached to the session. This method is always called before the connector's data is sent to the client-side for the first time.The attachment logic is implemented in
AbstractClientConnector.
-
detach
void detach()
Notifies the connector that it is detached from its VaadinSession.
-
isAttached
boolean isAttached()
Checks if the connector is attached to a VaadinSession.- Returns:
- true if the connector is attached to a session, false otherwise
-
isConnectorEnabled
boolean isConnectorEnabled()
Checks if the communicator is enabled. An enabled communicator is allowed to receive messages from its counter-part.- Returns:
- true if the connector can receive messages, false otherwise
-
-