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, com.vaadin.flow.component.HasStyle, 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:
  • 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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    com.vaadin.flow.shared.Registration
    Add a listener for legacy connector attach events.
    com.vaadin.flow.shared.Registration
    Add a listener for connector detach events.
    com.vaadin.flow.shared.Registration
    addListener(Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, Method method)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected com.vaadin.flow.shared.Registration
    addListener(String eventIdentifier, Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, Method method)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected void
    addMethodInvocationToQueue(String interfaceName, Method method, Object[] parameters)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    void
    Notifies the connector that it is connected to a VaadinSession (and therefore also to a UI).
    void
    beforeClientResponse(boolean initial)
    Called before the response is written to client side.
    protected SharedState
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    void
    Notifies the connector that it is detached from its VaadinSession.
    static Iterable<? extends ClientConnector>
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode*
    com.vaadin.flow.server.ErrorHandler
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected Resource
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected com.vaadin.flow.server.VaadinSession
    Finds the VaadinSession to which this connector belongs.
    protected SharedState
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected SharedState
    getState(boolean markAsDirty)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    boolean
    handleConnectorRequest(com.vaadin.flow.server.VaadinRequest request, com.vaadin.flow.server.VaadinResponse response, String path)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected boolean
    hasListeners(Class<? extends com.vaadin.flow.component.ComponentEvent> eventType)
    Checks if the given ComponentEvent type is listened for this component.
    boolean
    Delegates to Component.isAttached().
    boolean
    Checks if the communicator is enabled.
    void
    Marks that this classic component's state might have changed.
    void
    Causes this classic component and all child components below it to be marked as dirty.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    protected void
    onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
     
    protected <T extends ServerRpc>
    void
    registerRpc(T implementation)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected <T extends ServerRpc>
    void
    registerRpc(T implementation, Class<T> rpcInterfaceType)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    void
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    void
    setErrorHandler(com.vaadin.flow.server.ErrorHandler errorHandler)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected void
    setResource(String key, Resource resource)
    Deprecated.
    not supported - calling this does nothing but logs a warning in development mode
    protected void
    updateDiffstate(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, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Constructor Details

    • AbstractClientConnector

      public AbstractClientConnector()
  • Method Details

    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • beforeClientResponse

      public void beforeClientResponse(boolean initial)
      Description copied from interface: ClientConnector
      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 initial is false when the component is attached again to a new UI when PreserveOnRefresh is used.

      Specified by:
      beforeClientResponse in interface ClientConnector
      Parameters:
      initial - true if the client-side connector will be created and initialized after this method has been invoked. false if there is already an initialized client-side connector.
    • markAsDirty

      public void markAsDirty()
      Description copied from interface: ClientConnector
      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 run ClientConnector.beforeClientResponse(boolean) for all legacy components that are marked as dirty.
      Specified by:
      markAsDirty in interface ClientConnector
    • markAsDirtyRecursive

      public void markAsDirtyRecursive()
      Description copied from interface: ClientConnector
      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.

      Specified by:
      markAsDirtyRecursive in interface ClientConnector
      See Also:
    • addLegacyAttachListener

      public com.vaadin.flow.shared.Registration addLegacyAttachListener(ClientConnector.AttachListener listener)
      Description copied from interface: ClientConnector
      Add a listener for legacy connector attach events. This could be migrated to AttachNotifier.addAttachListener(ComponentEventListener).
      Specified by:
      addLegacyAttachListener in interface ClientConnector
      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: ClientConnector
      Add a listener for connector detach events. This could be migrated to DetachNotifier.addDetachListener(ComponentEventListener)
      Specified by:
      addLegacyDetachListener in interface ClientConnector
      Parameters:
      listener - the listener to add
      Returns:
      Registration for unregistering the listener
    • hasListeners

      protected boolean hasListeners(Class<? extends com.vaadin.flow.component.ComponentEvent> eventType)
      Checks if the given ComponentEvent type 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: ClientConnector
      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.

      Specified by:
      attach in interface ClientConnector
    • detach

      public void detach()
      Description copied from interface: ClientConnector
      Notifies the connector that it is detached from its VaadinSession.

      Specified by:
      detach in interface ClientConnector
    • isAttached

      public boolean isAttached()
      Delegates to Component.isAttached(). Checks if the connector is attached to a VaadinSession.
      Specified by:
      isAttached in interface ClientConnector
      Overrides:
      isAttached in class com.vaadin.flow.component.Component
      Returns:
      true if the component is attached to an active UI.
    • isConnectorEnabled

      public boolean isConnectorEnabled()
      Description copied from interface: ClientConnector
      Checks if the communicator is enabled. An enabled communicator is allowed to receive messages from its counter-part.
      Specified by:
      isConnectorEnabled in interface ClientConnector
      Returns:
      true if the connector can receive messages, false otherwise
    • getSession

      protected com.vaadin.flow.server.VaadinSession getSession()
      Finds the VaadinSession to which this connector belongs. If the connector has not been attached, null is returned.
      Returns:
      The connector's session, or null if not attached
    • addExtension

      @Deprecated protected void addExtension(Extension extension)
      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.
      Parameters:
      extension - extension
    • addListener

      @Deprecated public com.vaadin.flow.shared.Registration addListener(Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, Method method)
      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.
      Parameters:
      eventType - event type
      listener - listener
      method - method
      Returns:
      registration that does nothing
    • addListener

      @Deprecated protected com.vaadin.flow.shared.Registration addListener(String eventIdentifier, Class<?> eventType, com.vaadin.flow.function.SerializableEventListener listener, Method method)
      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.
      Parameters:
      eventIdentifier - event identifier
      eventType - event type
      listener - listener
      method - method
      Returns:
      a registration that does nothing
    • addMethodInvocationToQueue

      @Deprecated protected void addMethodInvocationToQueue(String interfaceName, Method method, Object[] parameters)
      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.
      Parameters:
      interfaceName - interface name
      method - method
      parameters - parameters
    • createState

      @Deprecated protected SharedState createState()
      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:
      placeholder shared state
    • getAllChildrenIterable

      @Deprecated public static Iterable<? extends ClientConnector> getAllChildrenIterable(ClientConnector connector)
      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.
      Parameters:
      connector - connector
      Returns:
      empty iterator
    • getConnectorId

      @Deprecated public 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 mode
      Not 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 Collection<Extension> getExtensions()
      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:
      an empty collection
    • getResource

      @Deprecated protected Resource getResource(String key)
      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.
      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 mode
      Not 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 mode
      Not 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, String path)
      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.
      Parameters:
      request - request
      response - response
      path - 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 mode
      Not 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, Class<T> rpcInterfaceType)
      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.
      Type Parameters:
      T - type
      Parameters:
      implementation - implementation
      rpcInterfaceType - rpc interface type
    • removeExtension

      @Deprecated public void removeExtension(Extension extension)
      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.
      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 mode
      Not 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(String key, Resource resource)
      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.
      Parameters:
      key - key
      resource - resource
    • updateDiffstate

      @Deprecated protected void updateDiffstate(String propertyName, elemental.json.JsonValue newValue)
      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.
      Parameters:
      propertyName - property name
      newValue - new value