public abstract class AbstractConnector extends Object implements ServerConnector, StateChangeEvent.StateChangeHandler
| Constructor and Description |
|---|
AbstractConnector() |
| Modifier and Type | Method and Description |
|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
Adds a handler that is called whenever any part of the state has been
updated by the server.
|
com.google.gwt.event.shared.HandlerRegistration |
addStateChangeHandler(String propertyName,
StateChangeEvent.StateChangeHandler handler)
Adds a handler that is called whenever the given part of the state has
been updated by the server.
|
protected SharedState |
createState()
Creates a state object with default values for this connector.
|
void |
doInit(String connectorId,
ApplicationConnection connection)
Called once by the framework to initialize the connector.
|
protected com.google.gwt.event.shared.HandlerManager |
ensureHandlerManager()
Ensure there is a handler manager.
|
void |
fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
Sends the given event to all registered handlers.
|
void |
forceStateChange()
Force the connector to recheck its state variables as the variables or
their meaning might have changed.
|
List<ServerConnector> |
getChildren()
Returns the child connectors for this connector (child components and
extensions).
|
ApplicationConnection |
getConnection()
Gets ApplicationConnection instance that created this connector.
|
String |
getConnectorId() |
ServerConnector |
getParent()
Returns the parent of this connector.
|
String |
getResourceUrl(String key)
Gets the URL for a resource that has been added by the server-side
connector using
com.vaadin.terminal.AbstractClientConnector#setResource(String, com.vaadin.terminal.Resource)
with the same key. |
<T extends ClientRpc> |
getRpcImplementations(String rpcInterfaceId)
For internal use by the framework: returns the registered RPC
implementations for an RPC interface identifier.
|
protected <T extends ServerRpc> |
getRpcProxy(Class<T> rpcInterface)
Returns an RPC proxy object which can be used to invoke the RPC method on
the server.
|
SharedState |
getState()
Returns the shared state object for this connector.
|
static Type |
getStateType(ServerConnector connector)
Find the type of the state for the given connector.
|
int |
getTag()
Gets the connector type tag for this connector.
|
boolean |
hasEventListener(String eventIdentifier)
Checks if an event listener has been registered on the server side for
the given event identifier.
|
protected void |
init()
Called when the connector has been initialized.
|
boolean |
isEnabled()
Tests whether the connector is enabled or not.
|
void |
onStateChanged(StateChangeEvent stateChangeEvent)
Notifies the event handler that the state has changed.
|
void |
onUnregister()
Event called when connector has been unregistered.
|
protected <T extends ClientRpc> |
registerRpc(Class<T> rpcInterface,
T implementation)
Registers an implementation for a server to client RPC interface.
|
void |
removeStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
Removes a handler that is called whenever any part of the state has been
updated by the server.
|
void |
removeStateChangeHandler(String propertyName,
StateChangeEvent.StateChangeHandler handler)
Removes a handler that is called whenever any part of the state has been
updated by the server.
|
void |
setChildren(List<ServerConnector> children)
Sets the children for this connector.
|
void |
setParent(ServerConnector parent)
Sets the parent for this connector.
|
void |
setTag(int tag)
Sets the connector type tag for this connector.
|
protected <T extends ClientRpc> |
unregisterRpc(Class<T> rpcInterface,
T implementation)
Unregisters an implementation for a server to client RPC interface.
|
void |
updateEnabledState(boolean enabledState) |
public final ApplicationConnection getConnection()
ServerConnectorgetConnection in interface ServerConnectorServerConnector.doInit(String, ApplicationConnection)public String getConnectorId()
getConnectorId in interface Connectorpublic final void doInit(String connectorId, ApplicationConnection connection)
Note that the shared state is not yet available when this method is called.
Connector classes should override init() instead of this method.
doInit in interface ServerConnectorprotected void init()
protected <T extends ClientRpc> void registerRpc(Class<T> rpcInterface, T implementation)
T - The type of the RPC interface that is being registeredrpcInterface - RPC interfaceimplementation - implementation that should receive RPC callsprotected <T extends ClientRpc> void unregisterRpc(Class<T> rpcInterface, T implementation)
T - The type of the RPC interface that is being unregisteredrpcInterface - RPC interfaceimplementation - implementation to unregisterprotected <T extends ServerRpc> T getRpcProxy(Class<T> rpcInterface)
T - The type of the ServerRpc interfacerpcInterface - The ServerRpc interface to retrieve a proxy object forpublic <T extends ClientRpc> Collection<T> getRpcImplementations(String rpcInterfaceId)
ServerConnectorgetRpcImplementations in interface ServerConnectorrpcInterfaceId - RPC interface identifier: fully qualified interface type namepublic void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
ServerConnectorfireEvent in interface ServerConnectorevent - The event to send.protected com.google.gwt.event.shared.HandlerManager ensureHandlerManager()
public com.google.gwt.event.shared.HandlerRegistration addStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
ServerConnectoraddStateChangeHandler in interface ServerConnectorhandler - The handler that should be added.public void removeStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
ServerConnectorremoveStateChangeHandler in interface ServerConnectorhandler - The handler that should be removed.public com.google.gwt.event.shared.HandlerRegistration addStateChangeHandler(String propertyName, StateChangeEvent.StateChangeHandler handler)
ServerConnectoraddStateChangeHandler in interface ServerConnectorpropertyName - the name of the property for which the handler should be
calledhandler - The handler that should be added.public void removeStateChangeHandler(String propertyName, StateChangeEvent.StateChangeHandler handler)
ServerConnectorremoveStateChangeHandler in interface ServerConnectorpropertyName - the name of the property for which the handler should be
calledhandler - The handler that should be removed.public void onStateChanged(StateChangeEvent stateChangeEvent)
StateChangeEvent.StateChangeHandleronStateChanged in interface StateChangeEvent.StateChangeHandlerstateChangeEvent - the state change event with details about the changepublic void onUnregister()
ServerConnectoronUnregister in interface ServerConnectorpublic SharedState getState()
getState in interface ServerConnectorprotected SharedState createState()
getState(). The default implementation creates a state object
using GWT.create() using the defined return type of getState().public static Type getStateType(ServerConnector connector)
connector - the connector whose state type to findpublic ServerConnector getParent()
ServerConnectorgetParent in interface ServerConnectorgetParent in interface ConnectorServerConnector.setParent(ServerConnector).public void setParent(ServerConnector parent)
ServerConnector
Note that calling this method does not fire a
ConnectorHierarchyChangeEvent. The event is fired only when the
whole hierarchy has been updated.
setParent in interface ServerConnectorparent - The new parent of the connectorpublic List<ServerConnector> getChildren()
ServerConnector
Note that the method HasComponentsConnector.getChildComponents()
can be used to obtain the subset of child connectors that correspond to
components and not extensions.
getChildren in interface ServerConnectorpublic void setChildren(List<ServerConnector> children)
ServerConnector
Note that this method is separate from
HasComponentsConnector.setChildComponents(List) and takes both
extensions and child components. Both methods are called separately by
the framework if the connector can have child components.
setChildren in interface ServerConnectorchildren - The new child connectors (extensions and/or components)public boolean isEnabled()
ServerConnectorisEnabled in interface ServerConnectorpublic void updateEnabledState(boolean enabledState)
updateEnabledState in interface ServerConnectorpublic String getResourceUrl(String key)
com.vaadin.terminal.AbstractClientConnector#setResource(String, com.vaadin.terminal.Resource)
with the same key. null is returned if no corresponding resource
is found.key - a string identifying the resource.null if no corresponding
resource is found.public boolean hasEventListener(String eventIdentifier)
ServerConnectorhasEventListener in interface ServerConnectoreventIdentifier - The identifier for the eventpublic void forceStateChange()
public int getTag()
ServerConnectorApplicationConfiguration and contains class names and their
hierarchy.getTag in interface ServerConnectorApplicationConfiguration.getServerSideClassNameForTag(Integer),
ApplicationConfiguration.getTagsForServerSideClassName(String),
ApplicationConfiguration.getParentTag(int)public void setTag(int tag)
ServerConnectorWidgetSet.createConnector(int, ApplicationConfiguration)
Note: This method is intended for internal use only.
setTag in interface ServerConnectortag - the connector type tagServerConnector.getTag()Copyright © 2023 Vaadin Ltd. All rights reserved.