Interface FAbstractClientConnector
- All Superinterfaces:
ClientConnector,Serializable
- All Known Subinterfaces:
FAbstractComponent,FAbstractTextField
- All Known Implementing Classes:
AbsoluteLayout,AbstractClientConnector,AbstractComponent,AbstractComponentContainer,AbstractField,AbstractLayout,AbstractOrderedLayout,AbstractSingleComponentContainer,ClickableRenderer,CssLayout,CustomComponent,CustomField,DateRenderer,FButton,FCheckBox,FComboBox,FComponentRenderer,FDateField,FGrid,FGrid.AbstractGridExtension,FGrid.AbstractRenderer,FImage,FListSelect,FMenuBar,FormLayout,FPasswordField,FTabSheet,FTextArea,FTextField,FTokenField,FTwinColSelect,GridLayout,HorizontalLayout,HtmlRenderer,ImageRenderer,Label,Panel,Table,TextRenderer,VerticalLayout
- Author:
- Vaadin Ltd
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classComponent event representing a legacy method invoking event.Nested classes/interfaces inherited from interface com.vaadin.featurepack.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.DetachEvent, ClientConnector.DetachListener -
Method Summary
Modifier and TypeMethodDescriptiondefault com.vaadin.flow.shared.RegistrationAdd a listener for legacy connector attach events.default com.vaadin.flow.shared.RegistrationAdd a listener for connector detach events.default com.vaadin.flow.shared.RegistrationaddListener(Class<?> eventType, Object target, Method method) Registers a new listener with the specified activation method to listen events generated by this component.default com.vaadin.flow.shared.RegistrationaddListener(String eventIdentifier, Class<?> eventType, Object target, Method method) Registers a new listener with the specified activation method to listen events generated by this component.default voidattach()Notifies the connector that it is connected to a VaadinSession (and therefore also to a UI).default voidbeforeClientResponse(boolean initial) Called before the response is written to client side.default voiddetach()Notifies the connector that it is detached from its VaadinSession.default voiddoConnectorOnAttach(com.vaadin.flow.component.AttachEvent attachEvent) default voiddoConnectorOnDetach(com.vaadin.flow.component.DetachEvent detachEvent) default voidfireEvent(EventObject event) Sends the event to all Vaadin 7/8 style method invoking listeners added withaddListener(Class, Object, Method).default voidfireEvent(EventObject event, com.vaadin.flow.component.ComponentEventBus eventBus) Sends the event to all Vaadin 7/8 style method invoking listeners added withaddListener(Class, Object, Method).default Iterable<? extends ClientConnector> getAllChildrenIterable(ClientConnector connector) Get an Iterable for iterating over all child connectors, including child components.default Collection<?> getFListeners(Class<? extends com.vaadin.flow.component.ComponentEvent> eventType) Checks if the givenEventtype is listened for this component.default com.vaadin.flow.component.ComponentReturns the target Flow component that this interface implements.default ResourcegetResource(String key) Gets a resource defined usingsetResource(String, Resource)with the corresponding key.default booleanhasListeners(Class<? extends com.vaadin.flow.component.ComponentEvent> eventType) Checks if the givenComponentEventtype is listened for this component.default booleanDelegates toComponent.isAttached().static booleanisBeforeClientResponseRegistered(com.vaadin.flow.component.Component component) default booleanChecks if the communicator is enabled.default voidMarks that this classic component's state might have changed.default voidCauses this classic component and all child components below it to be marked as dirty.static voidregisterInternalBeforeClientResponse(FAbstractClientConnector connector, com.vaadin.flow.component.Component component) default voiddefault voiddefault voidremoveListener(Class<?> eventType, Object target) Removes all registered listeners matching the given parameters.default voidremoveListener(Class<?> eventType, Object target, Method method) Removes one registered listener method.default voidsetResource(String key, Resource resource) Registers a resource with this connector using the given key.Methods inherited from interface com.vaadin.featurepack.server.ClientConnector
getFParent
-
Method Details
-
getFlowComponent
default com.vaadin.flow.component.Component getFlowComponent()Returns the target Flow component that this interface implements.- Returns:
- the target Flow component
- Throws:
ClassCastException- if the target component is not aComponenttype
-
doConnectorOnAttach
default void doConnectorOnAttach(com.vaadin.flow.component.AttachEvent attachEvent) -
doConnectorOnDetach
default void doConnectorOnDetach(com.vaadin.flow.component.DetachEvent detachEvent) -
attach
default 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
default void detach()Description copied from interface:ClientConnectorNotifies the connector that it is detached from its VaadinSession.- Specified by:
detachin interfaceClientConnector
-
markAsDirty
default 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
-
registerInternalBeforeClientResponse
static void registerInternalBeforeClientResponse(FAbstractClientConnector connector, com.vaadin.flow.component.Component component) -
isBeforeClientResponseRegistered
static boolean isBeforeClientResponseRegistered(com.vaadin.flow.component.Component component) -
beforeClientResponse
default 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.
-
isAttached
default boolean isAttached()Delegates toComponent.isAttached(). Checks if the connector is attached to a VaadinSession.- Specified by:
isAttachedin interfaceClientConnector- Returns:
- true if the component is attached to an active UI.
-
markAsDirtyRecursive
default 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:
-
addLegacyAttachListener
default 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
default 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
-
removeAttachListener
-
removeDetachListener
-
isConnectorEnabled
default 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
-
hasListeners
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
-
getFListeners
default Collection<?> getFListeners(Class<? extends com.vaadin.flow.component.ComponentEvent> eventType) Checks if the givenEventtype 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
-
addListener
default com.vaadin.flow.shared.Registration addListener(String eventIdentifier, Class<?> eventType, Object target, Method method) Registers a new listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called.
- Parameters:
eventIdentifier- the identifier of the event to listen for (not used in feature pack)eventType- the type of the listened event. Events of this type or its subclasses activate the listener.target- the object instance who owns the activation method.method- the activation method.
-
addListener
default com.vaadin.flow.shared.Registration addListener(Class<?> eventType, Object target, Method method) Registers a new listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called.
- Parameters:
eventType- the type of the listened event. Events of this type or its subclasses activate the listener.target- the object instance who owns the activation method.method- the activation method.
-
removeListener
Removes all registered listeners matching the given parameters. Since this method receives the event type and the listener object as parameters, it will unregister allobject's methods that are registered to listen to events of typeeventTypegenerated by this component.- Parameters:
eventType- the exact event type theobjectlistens to.target- the target object that has registered to listen to events of typeeventTypewith one or more methods.
-
removeListener
Removes one registered listener method. The given method owned by the given object will no longer be called when the specified events are generated by this component.- Parameters:
eventType- the exact event type theobjectlistens to.target- target object that has registered to listen to events of typeeventTypewith one or more methods.method- the method owned bytargetthat's registered to listen to events of typeeventType.
-
fireEvent
Sends the event to all Vaadin 7/8 style method invoking listeners added withaddListener(Class, Object, Method).- Parameters:
event- the Event to be sent to all listeners.
-
fireEvent
Sends the event to all Vaadin 7/8 style method invoking listeners added withaddListener(Class, Object, Method). If given event type has a regular Flow component event listener registered, then event is fired as a regular event without V7/8 method invoking.- Parameters:
event- the Event to be sent to all listeners.eventBus- the event bus to use for firing the event
-
getAllChildrenIterable
Get an Iterable for iterating over all child connectors, including child components.- Parameters:
connector- the connector to get children for- Returns:
- an Iterable giving all child connectors.
-
getResource
Gets a resource defined usingsetResource(String, Resource)with the corresponding key.- Parameters:
key- the string identifier of the resource- Returns:
- a resource, or
nullif there's no resource associated with the given key - See Also:
-
setResource
Registers a resource with this connector using the given key. Saves the resource in server-side component state so that it can be accessed later. Making resource available also to the client-side is not applicable with Flow. UseStreamResourcewith Element API likeElement.setAttribute(String, AbstractStreamResource)instead.- Parameters:
key- the string key to associate the resource withresource- the resource to set, ornullto clear a previous association.
-