Class AbstractClientConnector
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.classic.v8.server.AbstractClientConnector
-
- All Implemented Interfaces:
ClientConnector,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,java.io.Serializable
- Direct Known Subclasses:
AbstractComponent
public abstract class AbstractClientConnector extends com.vaadin.flow.component.Component implements ClientConnector
An abstract base class for legacy Vaadin framework version 7/8 ClientConnector implementations. This class maps the basic functionality required for connectors to work inside newer Vaadin versions (with Flow).- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.classic.v8.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
-
Constructor Summary
Constructors Constructor Description AbstractClientConnector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddExtension(Extension extension)Deprecated.not supported - calling this does nothing but logs a warning in development modecom.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.com.vaadin.flow.shared.RegistrationaddListener(java.lang.Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, java.lang.reflect.Method method)Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected com.vaadin.flow.shared.RegistrationaddListener(java.lang.String eventIdentifier, java.lang.Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, java.lang.reflect.Method method)Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected voidaddMethodInvocationToQueue(java.lang.String interfaceName, java.lang.reflect.Method method, java.lang.Object[] parameters)Deprecated.not supported - calling this does nothing but logs a warning in development modevoidattach()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.protected SharedStatecreateState()Deprecated.not supported - calling this does nothing but logs a warning in development modevoiddetach()Notifies the connector that it is detached from its VaadinSession.static java.lang.Iterable<? extends ClientConnector>getAllChildrenIterable(ClientConnector connector)Deprecated.not supported - calling this does nothing but logs a warning in development modejava.lang.StringgetConnectorId()Deprecated.not supported - calling this does nothing but logs a warning in development mode*com.vaadin.flow.server.ErrorHandlergetErrorHandler()Deprecated.not supported - calling this does nothing but logs a warning in development modejava.util.Collection<Extension>getExtensions()Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected ResourcegetResource(java.lang.String key)Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected com.vaadin.flow.server.VaadinSessiongetSession()Finds theVaadinSessionto which this connector belongs.protected SharedStategetState()Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected SharedStategetState(boolean markAsDirty)Deprecated.not supported - calling this does nothing but logs a warning in development modebooleanhandleConnectorRequest(com.vaadin.flow.server.VaadinRequest request, com.vaadin.flow.server.VaadinResponse response, java.lang.String path)Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected booleanhasListeners(java.lang.Class<? extends com.vaadin.flow.component.ComponentEvent> eventType)Checks if the givenComponentEventtype is listened for this component.booleanisAttached()Delegates toComponent.isAttached().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.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent)protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent)protected <T extends ServerRpc>
voidregisterRpc(T implementation)Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected <T extends ServerRpc>
voidregisterRpc(T implementation, java.lang.Class<T> rpcInterfaceType)Deprecated.not supported - calling this does nothing but logs a warning in development modevoidremoveExtension(Extension extension)Deprecated.not supported - calling this does nothing but logs a warning in development modevoidsetErrorHandler(com.vaadin.flow.server.ErrorHandler errorHandler)Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected voidsetResource(java.lang.String key, Resource resource)Deprecated.not supported - calling this does nothing but logs a warning in development modeprotected voidupdateDiffstate(java.lang.String propertyName, elemental.json.JsonValue newValue)Deprecated.not supported - calling this does nothing but logs a warning in development mode-
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
-
-
-
-
Method Detail
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
- Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
- Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
beforeClientResponse
public void beforeClientResponse(boolean initial)
Description copied from interface:ClientConnectorCalled 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.- Specified by:
beforeClientResponsein interfaceClientConnector- 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
public void markAsDirty()
Description copied from interface:ClientConnectorMarks that this classic component's state might have changed. When the framework is about to send new data to the client-side, it will runClientConnector.beforeClientResponse(boolean)for all legacy components that are marked as dirty.- Specified by:
markAsDirtyin interfaceClientConnector
-
markAsDirtyRecursive
public void markAsDirtyRecursive()
Description copied from interface:ClientConnectorCauses 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.
- Specified by:
markAsDirtyRecursivein interfaceClientConnector- See Also:
ClientConnector.markAsDirty()
-
addLegacyAttachListener
public com.vaadin.flow.shared.Registration addLegacyAttachListener(ClientConnector.AttachListener listener)
Description copied from interface:ClientConnectorAdd a listener for legacy connector attach events. This could be migrated toAttachNotifier.addAttachListener(ComponentEventListener).- Specified by:
addLegacyAttachListenerin interfaceClientConnector- Parameters:
listener- the listener to add- Returns:
- Registration for unregistering the listener
-
addLegacyDetachListener
public com.vaadin.flow.shared.Registration addLegacyDetachListener(ClientConnector.DetachListener listener)
Description copied from interface:ClientConnectorAdd a listener for connector detach events. This could be migrated toDetachNotifier.addDetachListener(ComponentEventListener)- Specified by:
addLegacyDetachListenerin interfaceClientConnector- Parameters:
listener- the listener to add- Returns:
- Registration for unregistering the listener
-
hasListeners
protected boolean hasListeners(java.lang.Class<? extends com.vaadin.flow.component.ComponentEvent> eventType)
Checks if the givenComponentEventtype is listened for this component.- Parameters:
eventType- the event type to be checked- Returns:
- true if a listener is registered for the given event type
-
attach
public void attach()
Description copied from interface:ClientConnectorNotifies 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.- Specified by:
attachin interfaceClientConnector
-
detach
public void detach()
Description copied from interface:ClientConnectorNotifies the connector that it is detached from its VaadinSession.- Specified by:
detachin interfaceClientConnector
-
isAttached
public boolean isAttached()
Delegates toComponent.isAttached(). Checks if the connector is attached to a VaadinSession.- Specified by:
isAttachedin interfaceClientConnector- Overrides:
isAttachedin classcom.vaadin.flow.component.Component- Returns:
- true if the component is attached to an active UI.
-
isConnectorEnabled
public boolean isConnectorEnabled()
Description copied from interface:ClientConnectorChecks if the communicator is enabled. An enabled communicator is allowed to receive messages from its counter-part.- Specified by:
isConnectorEnabledin interfaceClientConnector- Returns:
- true if the connector can receive messages, false otherwise
-
getSession
protected com.vaadin.flow.server.VaadinSession getSession()
Finds theVaadinSessionto which this connector belongs. If the connector has not been attached,nullis returned.- Returns:
- The connector's session, or
nullif not attached
-
addExtension
@Deprecated protected void addExtension(Extension extension)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
extension- extension
-
addListener
@Deprecated public com.vaadin.flow.shared.Registration addListener(java.lang.Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, java.lang.reflect.Method method)Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
eventType- event typelistener- listenermethod- method- Returns:
- registration that does nothing
-
addListener
@Deprecated protected com.vaadin.flow.shared.Registration addListener(java.lang.String eventIdentifier, java.lang.Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, java.lang.reflect.Method method)Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
eventIdentifier- event identifiereventType- event typelistener- listenermethod- method- Returns:
- a registration that does nothing
-
addMethodInvocationToQueue
@Deprecated protected void addMethodInvocationToQueue(java.lang.String interfaceName, java.lang.reflect.Method method, java.lang.Object[] parameters)Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
interfaceName- interface namemethod- methodparameters- parameters
-
createState
@Deprecated protected SharedState createState()
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Returns:
- placeholder shared state
-
getAllChildrenIterable
@Deprecated public static java.lang.Iterable<? extends ClientConnector> getAllChildrenIterable(ClientConnector connector)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
connector- connector- Returns:
- empty iterator
-
getConnectorId
@Deprecated public java.lang.String getConnectorId()
Deprecated.not supported - calling this does nothing but logs a warning in development mode*Not supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Returns:
- empty string
-
getErrorHandler
@Deprecated public com.vaadin.flow.server.ErrorHandler getErrorHandler()
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Returns:
- error handler that does nothing
-
getExtensions
@Deprecated public java.util.Collection<Extension> getExtensions()
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Returns:
- an empty collection
-
getResource
@Deprecated protected Resource getResource(java.lang.String key)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
key- key- Returns:
- a fake resource object
-
getState
@Deprecated protected SharedState getState()
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Returns:
- placeholder shared state
-
getState
@Deprecated protected SharedState getState(boolean markAsDirty)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
markAsDirty- mark as dirty- Returns:
- placeholder shared state
-
handleConnectorRequest
@Deprecated public boolean handleConnectorRequest(com.vaadin.flow.server.VaadinRequest request, com.vaadin.flow.server.VaadinResponse response, java.lang.String path)Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
request- requestresponse- responsepath- path- Returns:
- false
-
registerRpc
@Deprecated protected <T extends ServerRpc> void registerRpc(T implementation)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Type Parameters:
T- type- Parameters:
implementation- implementation
-
registerRpc
@Deprecated protected <T extends ServerRpc> void registerRpc(T implementation, java.lang.Class<T> rpcInterfaceType)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Type Parameters:
T- type- Parameters:
implementation- implementationrpcInterfaceType- rpc interface type
-
removeExtension
@Deprecated public void removeExtension(Extension extension)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
extension- extension
-
setErrorHandler
@Deprecated public void setErrorHandler(com.vaadin.flow.server.ErrorHandler errorHandler)
Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
errorHandler- error handler
-
setResource
@Deprecated protected void setResource(java.lang.String key, Resource resource)Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
key- keyresource- resource
-
updateDiffstate
@Deprecated protected void updateDiffstate(java.lang.String propertyName, elemental.json.JsonValue newValue)Deprecated.not supported - calling this does nothing but logs a warning in development modeNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Parameters:
propertyName- property namenewValue- new value
-
-