|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vaadin.terminal.AbstractClientConnector
public abstract class AbstractClientConnector
An abstract base class for ClientConnector implementations. This class provides all the basic functionality required for connectors.
Constructor Summary | |
---|---|
AbstractClientConnector()
|
Method Summary | ||
---|---|---|
protected void |
addExtension(Extension extension)
Add an extension to this connector. |
|
protected void |
addMethodInvocationToQueue(String interfaceName,
Method method,
Object[] parameters)
For internal use: adds a method invocation to the pending RPC call queue. |
|
void |
attach()
Notifies the connector that it is connected to an application. |
|
protected SharedState |
createState()
Creates the shared state bean to be used in server to client communication. |
|
void |
detach()
Notifies the component that it is detached from the application. |
|
static Iterable<ClientConnector> |
getAllChildrenIterable(ClientConnector connector)
Get an Iterable for iterating over all child connectors, including both extensions and child components. |
|
protected Application |
getApplication()
Finds the Application to which this connector belongs. |
|
String |
getConnectorId()
Returns the id for this connector. |
|
Collection<Extension> |
getExtensions()
Get a read-only collection of all extensions attached to this connector. |
|
ClientConnector |
getParent()
Gets the parent connector of this connector, or null if the
connector is not attached to any parent. |
|
Root |
getRoot()
Finds a Root ancestor of this connector. |
|
RpcManager |
getRpcManager(Class<?> rpcInterface)
Returns the RPC manager instance to use when receiving calls for an RPC interface. |
|
|
getRpcProxy(Class<T> rpcInterface)
Returns an RPC proxy for a given server to client RPC interface for this component. |
|
SharedState |
getState()
Gets the current shared state of the connector. |
|
Class<? extends SharedState> |
getStateType()
Returns the type of the shared state for this connector |
|
boolean |
isConnectorEnabled()
Checks if the communicator is enabled. |
|
protected
|
registerRpc(T implementation)
Registers an RPC interface implementation for this component. |
|
protected
|
registerRpc(T implementation,
Class<T> rpcInterfaceType)
Registers an RPC interface implementation for this component. |
|
void |
removeExtension(Extension extension)
Remove an extension from this connector. |
|
void |
requestRepaint()
Requests that the connector should be repainted as soon as possible. |
|
void |
requestRepaintAll()
Causes a repaint of this connector, and all connectors below it. |
|
List<ClientMethodInvocation> |
retrievePendingRpcCalls()
Returns the list of pending server to client RPC calls and clears the list. |
|
void |
setParent(ClientConnector parent)
Sets the parent connector of the connector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractClientConnector()
Method Detail |
---|
public void requestRepaint()
ClientConnector
requestRepaint
in interface ClientConnector
protected <T> void registerRpc(T implementation, Class<T> rpcInterfaceType)
implementation
- RPC interface implementationrpcInterfaceType
- RPC interface class for which the implementation should be
registeredprotected <T extends ServerRpc> void registerRpc(T implementation)
implementation
- RPC interface implementation. Also used to deduce the type.public SharedState getState()
Connector
getState
in interface Connector
SharedState
. Never null.protected SharedState createState()
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()
.
public Class<? extends SharedState> getStateType()
ClientConnector
getStateType
in interface ClientConnector
public <T extends ClientRpc> T getRpcProxy(Class<T> rpcInterface)
rpcInterface
- RPC interface typeprotected void addMethodInvocationToQueue(String interfaceName, Method method, Object[] parameters)
interfaceName
- RPC interface namemethod
- RPC methodparameters
- RPC all parameterspublic RpcManager getRpcManager(Class<?> rpcInterface)
RpcTarget
getRpcManager
in interface RpcTarget
rpcInterface
- RPC interface for which a call was made
RpcTarget.getRpcManager(Class)
public List<ClientMethodInvocation> retrievePendingRpcCalls()
ClientConnector
retrievePendingRpcCalls
in interface ClientConnector
public String getConnectorId()
Connector
getConnectorId
in interface Connector
protected Application getApplication()
null
is returned.
null
if not attachedpublic Root getRoot()
null
is returned if
no Root ancestor is found (typically because the connector is not
attached to a proper hierarchy).
getRoot
in interface ClientConnector
null
if none
is found.public void requestRepaintAll()
ClientConnector
requestRepaintAll
in interface ClientConnector
public static Iterable<ClientConnector> getAllChildrenIterable(ClientConnector connector)
connector
- the connector to get children for
public Collection<Extension> getExtensions()
ClientConnector
getExtensions
in interface ClientConnector
protected void addExtension(Extension extension)
extension
- the extension to addpublic void removeExtension(Extension extension)
ClientConnector
removeExtension
in interface ClientConnector
extension
- the extension to remove.public void setParent(ClientConnector parent)
ClientConnector
This method automatically calls ClientConnector.attach()
if the connector
becomes attached to the application, regardless of whether it was
attached previously. Conversely, if the parent is null
and the
connector is attached to the application, ClientConnector.detach()
is called for
the connector.
This method is rarely called directly. One of the
ComponentContainer.addComponent(Component)
or
addExtension(Extension)
methods are
normally used for adding connectors to a parent and they will call this
method implicitly.
It is not possible to change the parent without first setting the parent
to null
.
setParent
in interface ClientConnector
parent
- the parent connectorpublic ClientConnector getParent()
Connector
null
if the
connector is not attached to any parent.
getParent
in interface Connector
getParent
in interface ClientConnector
null
if there is no parent.public void attach()
ClientConnector
The caller of this method is ClientConnector.setParent(ClientConnector)
if the
parent is itself already attached to the application. If not, the parent
will call the ClientConnector.attach()
for all its children when it is attached
to the application. 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
.
attach
in interface ClientConnector
public void detach()
The caller of this method is ClientConnector.setParent(ClientConnector)
if the
parent is in the application. When the parent is detached from the
application it is its response to call ClientConnector.detach()
for all the
children and to detach itself from the terminal.
The getApplication()
and getRoot()
methods might return
null
after this method is called.
detach
in interface ClientConnector
public boolean isConnectorEnabled()
ClientConnector
isConnectorEnabled
in interface ClientConnector
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |