Interface ClientConnector

    • 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 initial is false when the component is attached again to a new UI when PreserveOnRefresh is used.

        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

        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 run beforeClientResponse(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 to AttachNotifier.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 to DetachNotifier.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