Class AbstractClientConnector
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- All Implemented Interfaces:
MethodEventSource,ClientConnector,Connector,Serializable
- Direct Known Subclasses:
AbstractComponent,AbstractExtension
public abstract class AbstractClientConnector extends Object implements ClientConnector, MethodEventSource
An abstract base class for ClientConnector implementations. This class provides all the basic functionality required for connectors.- Since:
- 7.0.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, 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 RegistrationaddAttachListener(ClientConnector.AttachListener listener)Add a listener for connector attach events.RegistrationaddDetachListener(ClientConnector.DetachListener listener)Add a listener for connector detach events.protected voidaddExtension(Extension extension)Add an extension to this connector.RegistrationaddListener(Class<?> eventType, SerializableEventListener listener, Method method)Registers a new listener with the specified activation method to listen events generated by this component.RegistrationaddListener(Class<?> eventType, SerializableEventListener listener, String methodName)Deprecated.This method has only been added for ease of migration and should be avoided in new code.RegistrationaddListener(Class<?> eventType, Object target, Method method)Deprecated.As of 8.12.RegistrationaddListener(Class<?> eventType, Object target, String methodName)Deprecated.As of 7.0.protected RegistrationaddListener(String eventIdentifier, Class<?> eventType, SerializableEventListener listener, Method method)Registers a new listener with the specified activation method to listen events generated by this component.protected RegistrationaddListener(String eventIdentifier, Class<?> eventType, Object target, Method method)Deprecated.As of 8.12.protected voidaddMethodInvocationToQueue(String interfaceName, Method method, Object[] parameters)For internal use: adds a method invocation to the pending RPC call queue.voidattach()Notifies the connector that it is connected to a VaadinSession (and therefore also to a UI).voidbeforeClientResponse(boolean initial)Called before the shared state and RPC invocations are sent to the client.protected SharedStatecreateState()Creates the shared state bean to be used in server to client communication.voiddetach()Notifies the connector that it is detached from its VaadinSession.elemental.json.JsonObjectencodeState()Called by the framework to encode the state to a JSONObject.booleanequals(Object obj)protected voidfireEvent(EventObject event)Sends the event to all listeners.static Iterable<? extends ClientConnector>getAllChildrenIterable(ClientConnector connector)Get an Iterable for iterating over all child connectors, including both extensions and child components.StringgetConnectorId()ErrorHandlergetErrorHandler()Gets the error handler for the connector.Collection<Extension>getExtensions()Get a read-only collection of all extensions attached to this connector.Collection<?>getListeners(Class<?> eventType)Returns all listeners that are registered for the given event type or one of its subclasses.protected ResourcegetResource(String key)Gets a resource defined usingsetResource(String, Resource)with the corresponding key.ServerRpcManager<?>getRpcManager(String rpcInterfaceName)Returns the RPC manager instance to use when receiving calls for an RPC interface.protected <T extends ClientRpc>
TgetRpcProxy(Class<T> rpcInterface)Returns an RPC proxy for a given server to client RPC interface for this component.protected VaadinSessiongetSession()Finds theVaadinSessionto which this connector belongs.protected SharedStategetState()Returns the shared state for this connector.protected SharedStategetState(boolean markAsDirty)Returns the shared state for this connector.Class<? extends SharedState>getStateType()Returns the type of the shared state for this connector.UIgetUI()Finds a UI ancestor of this connector.booleanhandleConnectorRequest(VaadinRequest request, VaadinResponse response, String path)Handle a request directed to this connector.inthashCode()protected booleanhasListeners(Class<?> eventType)Checks if the givenComponent.Eventtype is listened for this component.booleanisAttached()Checks if the connector is attached to a VaadinSession.booleanisConnectorEnabled()Checks if the communicator is enabled.protected booleanisThis(Object that)Deprecated.only defined for framework hacks, do not use.voidmarkAsDirty()Marks that this connector's state might have changed.voidmarkAsDirtyRecursive()Causes this connector and all connectors below it to be marked as dirty.protected <T extends ServerRpc>
voidregisterRpc(T implementation)Registers an RPC interface implementation for this component.protected <T extends ServerRpc>
voidregisterRpc(T implementation, Class<T> rpcInterfaceType)Registers an RPC interface implementation for this component.voidremoveAttachListener(ClientConnector.AttachListener listener)Deprecated.voidremoveDetachListener(ClientConnector.DetachListener listener)Deprecated.voidremoveExtension(Extension extension)Remove an extension from this connector.voidremoveListener(Class<?> eventType, SerializableEventListener listener)Deprecated.use aRegistrationfromaddListener(java.lang.String, java.lang.Class<?>, java.lang.Object, java.lang.reflect.Method)to remove a listenervoidremoveListener(Class<?> eventType, Object target)Deprecated.use aRegistrationfromaddListener(java.lang.String, java.lang.Class<?>, java.lang.Object, java.lang.reflect.Method)to remove a listenervoidremoveListener(Class<?> eventType, Object target, Method method)Deprecated.use aRegistrationfromaddListener(Class, Object, Method)to remove a listenervoidremoveListener(Class<?> eventType, Object target, String methodName)Deprecated.As of 7.0.protected voidremoveListener(String eventIdentifier, Class<?> eventType, Object target)Deprecated.use aRegistrationfromaddListener(Class, Object, Method)to remove a listenervoidrequestRepaint()Deprecated.As of 7.0, usemarkAsDirty()instead.voidrequestRepaintAll()Deprecated.As of 7.0, usemarkAsDirtyRecursive()insteadList<ClientMethodInvocation>retrievePendingRpcCalls()Returns the list of pending server to client RPC calls and clears the list.voidsetErrorHandler(ErrorHandler errorHandler)Sets the error handler for the connector.protected voidsetResource(String key, Resource resource)Registers a resource with this connector using the given key.protected voidupdateDiffstate(String propertyName, elemental.json.JsonValue newValue)Sets the expected value of a state property so that changes can be properly sent to the client.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
getParent
-
-
-
-
Method Detail
-
addAttachListener
public Registration addAttachListener(ClientConnector.AttachListener listener)
Description copied from interface:ClientConnectorAdd a listener for connector attach events.- Specified by:
addAttachListenerin interfaceClientConnector- Parameters:
listener- an AttachListener implementation- Returns:
- Registration for unregistering the listener
-
removeAttachListener
@Deprecated public void removeAttachListener(ClientConnector.AttachListener listener)
Deprecated.- Specified by:
removeAttachListenerin interfaceClientConnector
-
addDetachListener
public Registration addDetachListener(ClientConnector.DetachListener listener)
Description copied from interface:ClientConnectorAdd a listener for connector detach events.- Specified by:
addDetachListenerin interfaceClientConnector- Parameters:
listener- an AttachListener implementation- Returns:
- Registration for unregistering the listener
-
removeDetachListener
@Deprecated public void removeDetachListener(ClientConnector.DetachListener listener)
Deprecated.- Specified by:
removeDetachListenerin interfaceClientConnector
-
requestRepaint
@Deprecated public void requestRepaint()
Deprecated.As of 7.0, usemarkAsDirty()instead. Note that you typically do not need to callmarkAsDirty()asgetState()will mark the connector dirty and the framework will then check what, if anything, needs to be sent to the client.LegacyComponents which rely on paint might still need to call this ormarkAsDirty().- Specified by:
requestRepaintin interfaceClientConnector
-
markAsDirty
public void markAsDirty()
Description copied from interface:ClientConnectorMarks that this connector's state might have changed. When the framework is about to send new data to the client-side, it will runClientConnector.beforeClientResponse(boolean)followed byClientConnector.encodeState()for all connectors that are marked as dirty and send any updated state info to the client.- Specified by:
markAsDirtyin interfaceClientConnector
-
registerRpc
protected <T extends ServerRpc> void registerRpc(T implementation, Class<T> rpcInterfaceType)
Registers an RPC interface implementation for this component. A component can listen to multiple RPC interfaces, and subclasses can register additional implementations.- Parameters:
implementation- RPC interface implementationrpcInterfaceType- RPC interface class for which the implementation should be registered- Since:
- 7.0
-
registerRpc
protected <T extends ServerRpc> void registerRpc(T implementation)
Registers an RPC interface implementation for this component. A component can listen to multiple RPC interfaces, and subclasses can register additional implementations.- Parameters:
implementation- RPC interface implementation. Also used to deduce the type.- Since:
- 7.0
-
getState
protected SharedState getState()
Returns the shared state for this connector. The shared state object is shared between the server connector and the client connector. Changes are only communicated from the server to the client and not in the other direction.As a side effect, marks the connector dirty so any changes done to the state will be sent to the client. Use
getState(false)to avoid marking the connector as dirty.- Returns:
- The shared state for this connector. Never null.
-
getState
protected SharedState getState(boolean markAsDirty)
Returns the shared state for this connector.- Parameters:
markAsDirty- true if the connector should automatically be marked dirty, false otherwise- Returns:
- The shared state for this connector. Never null.
- See Also:
getState()
-
encodeState
public elemental.json.JsonObject encodeState()
Description copied from interface:ClientConnectorCalled by the framework to encode the state to a JSONObject. This is typically done by calling the static methodLegacyCommunicationManager.encodeState(ClientConnector, SharedState).- Specified by:
encodeStatein interfaceClientConnector- Returns:
- a JSON object with the encoded connector state
-
createState
protected SharedState createState()
Creates the shared state bean to be used in server to client communication.By default a state object of the defined return type of
getState()is created. Subclasses can override this method and return a new instance of the correct state class but this should rarely be necessary.No configuration of the values of the state should be performed in
createState().- Returns:
- new shared state object
- Since:
- 7.0
-
getStateType
public Class<? extends SharedState> getStateType()
Description copied from interface:ClientConnectorReturns the type of the shared state for this connector.- Specified by:
getStateTypein interfaceClientConnector- Returns:
- The type of the state. Must never return null.
-
getRpcProxy
protected <T extends ClientRpc> T getRpcProxy(Class<T> rpcInterface)
Returns an RPC proxy for a given server to client RPC interface for this component. TODO more javadoc, subclasses, ...- Parameters:
rpcInterface- RPC interface type- Since:
- 7.0
-
addMethodInvocationToQueue
protected void addMethodInvocationToQueue(String interfaceName, Method method, Object[] parameters)
For internal use: adds a method invocation to the pending RPC call queue.- Parameters:
interfaceName- RPC interface namemethod- RPC methodparameters- RPC all parameters- Since:
- 7.0
-
getRpcManager
public ServerRpcManager<?> getRpcManager(String rpcInterfaceName)
Description copied from interface:ClientConnectorReturns the RPC manager instance to use when receiving calls for an RPC interface.- Specified by:
getRpcManagerin interfaceClientConnector- Parameters:
rpcInterfaceName- name of the interface for which the call was made- Returns:
- ServerRpcManager or null if none found for the interface
-
retrievePendingRpcCalls
public List<ClientMethodInvocation> retrievePendingRpcCalls()
Description copied from interface:ClientConnectorReturns the list of pending server to client RPC calls and clears the list.- Specified by:
retrievePendingRpcCallsin interfaceClientConnector- Returns:
- an unmodifiable ordered list of pending server to client method calls (not null)
-
getConnectorId
public String getConnectorId()
- Specified by:
getConnectorIdin interfaceConnector
-
getSession
protected 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
-
getUI
public UI getUI()
Finds a UI ancestor of this connector.nullis returned if no UI ancestor is found (typically because the connector is not attached to a proper hierarchy).- Specified by:
getUIin interfaceClientConnector- Returns:
- the UI ancestor of this connector, or
nullif none is found.
-
requestRepaintAll
@Deprecated public void requestRepaintAll()
Deprecated.As of 7.0, usemarkAsDirtyRecursive()instead- Specified by:
requestRepaintAllin interfaceClientConnector
-
markAsDirtyRecursive
public void markAsDirtyRecursive()
Description copied from interface:ClientConnectorCauses this connector and all connectors 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.
- Specified by:
markAsDirtyRecursivein interfaceClientConnector- See Also:
ClientConnector.markAsDirty()
-
getAllChildrenIterable
public static Iterable<? extends ClientConnector> getAllChildrenIterable(ClientConnector connector)
Get an Iterable for iterating over all child connectors, including both extensions and child components.- Parameters:
connector- the connector to get children for- Returns:
- an Iterable giving all child connectors.
-
getExtensions
public Collection<Extension> getExtensions()
Description copied from interface:ClientConnectorGet a read-only collection of all extensions attached to this connector.- Specified by:
getExtensionsin interfaceClientConnector- Returns:
- a collection of extensions
-
addExtension
protected void addExtension(Extension extension)
Add an extension to this connector. This method is protected to allow extensions to select which targets they can extend.- Parameters:
extension- the extension to add
-
removeExtension
public void removeExtension(Extension extension)
Description copied from interface:ClientConnectorRemove an extension from this connector.- Specified by:
removeExtensionin interfaceClientConnector- Parameters:
extension- the extension to remove.
-
isAttached
public boolean isAttached()
Description copied from interface:ClientConnectorChecks if the connector is attached to a VaadinSession.- Specified by:
isAttachedin interfaceClientConnector- Returns:
- true if the connector is attached to a session, false otherwise
-
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
Component.setParent(HasComponents)if the parent is itself already attached to the session. If not, the parent will call theClientConnector.attach()for all its children when it 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()
Notifies the connector that it is detached from its VaadinSession.The caller of this method is
Component.setParent(HasComponents)if the parent is in the session. When the parent is detached from the session it is its responsibility to callClientConnector.detach()for each of its children.The
getSession()andgetUI()methods might returnnullafter this method is called.- Specified by:
detachin interfaceClientConnector
-
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
-
beforeClientResponse
public void beforeClientResponse(boolean initial)
Description copied from interface:ClientConnectorCalled before the shared state and RPC invocations are sent to the client. Gives the connector an opportunity to set computed/dynamic state values or to invoke last minute RPC methods depending on other component features.- 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.
-
handleConnectorRequest
public boolean handleConnectorRequest(VaadinRequest request, VaadinResponse response, String path) throws IOException
Description copied from interface:ClientConnectorHandle a request directed to this connector. This can be used by connectors to dynamically generate a response and it is also used internally when servingConnectorResources.Requests to
/APP/connector/[ui id]/[connector id]/are routed to this method with the remaining part of the requested path available in the path parameter.NOTE that the session is not locked when this method is called. It is the responsibility of the connector to ensure that the session is locked while handling state or other session related data. For best performance the session should be unlocked before writing a large response to the client.
- Specified by:
handleConnectorRequestin interfaceClientConnector- Parameters:
request- the request that should be handledresponse- the response object to which the response should be writtenpath- the requested relative path- Returns:
trueif the request has been handled,falseif no response has been written.- Throws:
IOException- if there is a problem generating a response.
-
getResource
protected Resource getResource(String key)
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(String, Resource)
-
setResource
protected void setResource(String key, Resource resource)
Registers a resource with this connector using the given key. This will make the URL for retrieving the resource available to the client-side connector usingcom.vaadin.terminal.gwt.client.ui.AbstractConnector#getResourceUrl(String)with the same key.- Parameters:
key- the string key to associate the resource withresource- the resource to set, ornullto clear a previous association.
-
addListener
@Deprecated protected Registration addListener(String eventIdentifier, Class<?> eventType, Object target, Method method)
Deprecated.As of 8.12. Use strongly typedaddListener(String, Class, SerializableEventListener, Method)method instead.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.This method additionally informs the event-api to route events with the given eventIdentifier to the components handleEvent function call.
For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Parameters:
eventIdentifier- the identifier of the event to listen foreventType- 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.- Returns:
- a registration object for removing the listener
- Since:
- 8.0
-
addListener
protected Registration addListener(String eventIdentifier, Class<?> eventType, SerializableEventListener listener, 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.This method additionally informs the event-api to route events with the given eventIdentifier to the components handleEvent function call.
For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Parameters:
eventIdentifier- the identifier of the event to listen foreventType- the type of the listened event. Events of this type or its subclasses activate the listener.listener- the listener instance who owns the activation method.method- the activation method.- Returns:
- a registration object for removing the listener
- Since:
- 8.12
-
hasListeners
protected boolean hasListeners(Class<?> eventType)
Checks if the givenComponent.Eventtype 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
-
removeListener
@Deprecated protected void removeListener(String eventIdentifier, Class<?> eventType, Object target)
Deprecated.use aRegistrationfromaddListener(Class, Object, Method)to remove a listenerRemoves 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.This method additionally informs the event-api to stop routing events with the given
eventIdentifierto the components handleEvent function call.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Parameters:
eventIdentifier- the identifier of the event to stop listening foreventType- the exact event type theobjectlistens to.target- the target object that has registered to listen to events of typeeventTypewith one or more methods.- Since:
- 6.2
-
addListener
@Deprecated public Registration addListener(Class<?> eventType, Object target, Method method)
Deprecated.As of 8.12. Use strongly typedaddListener(Class, SerializableEventListener, Method)method instead.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.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Specified by:
addListenerin interfaceMethodEventSource- 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.- Returns:
- a registration object for removing the listener
-
addListener
public Registration addListener(Class<?> eventType, SerializableEventListener listener, 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.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Specified by:
addListenerin interfaceMethodEventSource- Parameters:
eventType- the type of the listened event. Events of this type or its subclasses activate the listener.listener- the listener instance who owns the activation method.method- the activation method.- Returns:
- a registration object for removing the listener
- Since:
- 8.12
-
addListener
@Deprecated public Registration addListener(Class<?> eventType, Object target, String methodName)
Deprecated.As of 7.0. This method should be avoided. UseaddListener(Class, SerializableEventListener, Method)oraddListener(String, Class, SerializableEventListener, Method)instead.Convenience method for registering 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.This version of
addListenergets the name of the activation method as a parameter. The actual method is reflected fromobject, and unless exactly one match is found,java.lang.IllegalArgumentExceptionis thrown.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.Note: Using this method is discouraged because it cannot be checked during compilation. Use
addListener(Class, Object, Method)oraddListener(String, Class, Object, Method)instead.- Specified by:
addListenerin interfaceMethodEventSource- 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.methodName- the name of the activation method.- Returns:
- a registration object for removing the listener
- Since:
- 8.0
-
addListener
@Deprecated public Registration addListener(Class<?> eventType, SerializableEventListener listener, String methodName)
Deprecated.This method has only been added for ease of migration and should be avoided in new code. UseaddListener(Class, SerializableEventListener, Method)oraddListener(String, Class, SerializableEventListener, Method)instead.Convenience method for registering 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.This version of
addListenergets the name of the activation method as a parameter. The actual method is reflected fromobject, and unless exactly one match is found,java.lang.IllegalArgumentExceptionis thrown.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.Note: Using this method is discouraged because it cannot be checked during compilation. Use
addListener(Class, Object, Method)oraddListener(String, Class, Object, Method)instead.- Specified by:
addListenerin interfaceMethodEventSource- Parameters:
eventType- the type of the listened event. Events of this type or its subclasses activate the listener.listener- the object instance who owns the activation method.methodName- the name of the activation method.- Returns:
- a registration object for removing the listener
- Since:
- 8.12
-
removeListener
@Deprecated public void removeListener(Class<?> eventType, Object target)
Deprecated.use aRegistrationfromaddListener(java.lang.String, java.lang.Class<?>, java.lang.Object, java.lang.reflect.Method)to remove a listenerRemoves 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.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Specified by:
removeListenerin interfaceMethodEventSource- 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
@Deprecated public void removeListener(Class<?> eventType, SerializableEventListener listener)
Deprecated.use aRegistrationfromaddListener(java.lang.String, java.lang.Class<?>, java.lang.Object, java.lang.reflect.Method)to remove a listenerRemoves 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.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Specified by:
removeListenerin interfaceMethodEventSource- Parameters:
eventType- the exact event type theobjectlistens to.listener- the listener that has registered to listen to events of typeeventTypewith one or more methods.- Since:
- 8.12
-
removeListener
@Deprecated public void removeListener(Class<?> eventType, Object target, Method method)
Deprecated.use aRegistrationfromaddListener(Class, Object, Method)to remove a listenerRemoves 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.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Specified by:
removeListenerin interfaceMethodEventSource- 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.
-
removeListener
@Deprecated public void removeListener(Class<?> eventType, Object target, String methodName)
Deprecated.As of 7.0. This method should be avoided. UseremoveListener(Class, Object, Method)instead.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.
This version of
removeListenergets the name of the activation method as a parameter. The actual method is reflected fromtarget, and unless exactly one match is found,java.lang.IllegalArgumentExceptionis thrown.For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.- Specified by:
removeListenerin interfaceMethodEventSource- 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.methodName- the name of the method owned bytargetthat's registered to listen to events of typeeventType.
-
getListeners
public Collection<?> getListeners(Class<?> eventType)
Returns all listeners that are registered for the given event type or one of its subclasses.- Parameters:
eventType- The type of event to return listeners for.- Returns:
- A collection with all registered listeners. Empty if no listeners are found.
-
fireEvent
protected void fireEvent(EventObject event)
Sends the event to all listeners.- Parameters:
event- the Event to be sent to all listeners.
-
getErrorHandler
public ErrorHandler getErrorHandler()
Description copied from interface:ClientConnectorGets the error handler for the connector. The error handler is dispatched whenever there is an error processing the data coming from the client to this connector.- Specified by:
getErrorHandlerin interfaceClientConnector- Returns:
- The error handler or null if not set
-
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
Description copied from interface:ClientConnectorSets the error handler for the connector. The error handler is dispatched whenever there is an error processing the data coming from the client for this connector.- Specified by:
setErrorHandlerin interfaceClientConnector- Parameters:
errorHandler- The error handler for this connector
-
isThis
@Deprecated protected boolean isThis(Object that)
Deprecated.only defined for framework hacks, do not use.For internal use only, may be changed or removed in future versions.This method must be protected, because otherwise it will not be redefined by the proxy to actually be called on the underlying instance.
See #14639
-
updateDiffstate
protected void updateDiffstate(String propertyName, elemental.json.JsonValue newValue)
Sets the expected value of a state property so that changes can be properly sent to the client. This needs to be done in cases where a state change originates from the client, since otherwise the server-side would fail to recognize if the value is changed back to its previous value.- Parameters:
propertyName- the name of the shared state property to updatenewValue- the new diffstate reference value
-
-