|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.server.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. |
|
void |
addListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.reflect.Method method)
Deprecated. The EventRouter will be replaced by an EventRouter which does not use reflection in Vaadin 7.0.0. See #8640. |
|
void |
addListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.String methodName)
Deprecated. The EventRouter will be replaced by an EventRouter which does not use reflection in Vaadin 7.0.0. See #8640. |
|
protected void |
addListener(java.lang.String eventIdentifier,
java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.reflect.Method method)
Deprecated. The EventRouter will be replaced by an EventRouter which does not use reflection in Vaadin 7.0.0. See #8640. |
|
protected void |
addMethodInvocationToQueue(java.lang.String interfaceName,
java.lang.reflect.Method method,
java.lang.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. |
|
void |
beforeClientResponse(boolean initial)
Called before the shared state and RPC invocations are sent to the client. |
|
protected com.vaadin.shared.communication.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. |
|
org.json.JSONObject |
encodeState()
Called by the framework to encode the state to a JSONObject. |
|
protected void |
fireEvent(java.util.EventObject event)
Sends the event to all listeners. |
|
static java.lang.Iterable<ClientConnector> |
getAllChildrenIterable(ClientConnector connector)
Get an Iterable for iterating over all child connectors, including both extensions and child components. |
|
java.lang.String |
getConnectorId()
|
|
java.util.Collection<Extension> |
getExtensions()
Get a read-only collection of all extensions attached to this connector. |
|
java.util.Collection<?> |
getListeners(java.lang.Class<?> eventType)
Returns all listeners that are registered for the given event type or one of its subclasses. |
|
ClientConnector |
getParent()
|
|
protected Resource |
getResource(java.lang.String key)
Gets a resource defined using setResource(String, Resource) with
the corresponding key. |
|
RpcManager |
getRpcManager(java.lang.Class<?> rpcInterface)
Returns the RPC manager instance to use when receiving calls for an RPC interface. |
|
protected
|
getRpcProxy(java.lang.Class<T> rpcInterface)
Returns an RPC proxy for a given server to client RPC interface for this component. |
|
protected VaadinServiceSession |
getSession()
Finds the VaadinServiceSession to which this connector belongs. |
|
protected com.vaadin.shared.communication.SharedState |
getState()
|
|
java.lang.Class<? extends com.vaadin.shared.communication.SharedState> |
getStateType()
Returns the type of the shared state for this connector |
|
UI |
getUI()
Finds a UI ancestor of this connector. |
|
boolean |
handleConnectorRequest(VaadinRequest request,
VaadinResponse response,
java.lang.String path)
Handle a request directed to this connector. |
|
protected boolean |
hasListeners(java.lang.Class<?> eventType)
Checks if the given Component.Event type is listened for this component. |
|
boolean |
isConnectorEnabled()
Checks if the communicator is enabled. |
|
void |
markAsDirty()
Marks that this connector's state might have changed. |
|
void |
markAsDirtyRecursive()
Causes this connector and all connectors below it to be marked as dirty. |
|
protected
|
registerRpc(T implementation)
Registers an RPC interface implementation for this component. |
|
protected
|
registerRpc(T implementation,
java.lang.Class<T> rpcInterfaceType)
Registers an RPC interface implementation for this component. |
|
void |
removeExtension(Extension extension)
Remove an extension from this connector. |
|
void |
removeListener(java.lang.Class<?> eventType,
java.lang.Object target)
Removes all registered listeners matching the given parameters. |
|
void |
removeListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.reflect.Method method)
Deprecated. The EventRouter will be replaced by an EventRouter which does not use reflection in Vaadin 7.0.0. See #8640. |
|
void |
removeListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.String methodName)
Removes one registered listener method. |
|
protected void |
removeListener(java.lang.String eventIdentifier,
java.lang.Class<?> eventType,
java.lang.Object target)
Removes all registered listeners matching the given parameters. |
|
void |
requestRepaint()
Deprecated. As of 7.0.0, use markAsDirty() instead |
|
void |
requestRepaintAll()
Deprecated. As of 7.0.0, use markAsDirtyRecursive() instead |
|
java.util.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. |
|
protected void |
setResource(java.lang.String key,
Resource resource)
Registers a resource with this connector using the given key. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractClientConnector()
| Method Detail |
|---|
@Deprecated public void requestRepaint()
markAsDirty() instead
requestRepaint in interface ClientConnectorpublic void markAsDirty()
ClientConnectorClientConnector.beforeClientResponse(boolean) followed by ClientConnector.encodeState()
for all connectors that are marked as dirty and send any updated state
info to the client.
markAsDirty in interface ClientConnector
protected <T> void registerRpc(T implementation,
java.lang.Class<T> rpcInterfaceType)
implementation - RPC interface implementationrpcInterfaceType - RPC interface class for which the implementation should be
registeredprotected <T extends com.vaadin.shared.communication.ServerRpc> void registerRpc(T implementation)
implementation - RPC interface implementation. Also used to deduce the type.protected com.vaadin.shared.communication.SharedState getState()
public org.json.JSONObject encodeState()
throws org.json.JSONException
ClientConnectorAbstractCommunicationManager.encodeState(ClientConnector, SharedState)
.
encodeState in interface ClientConnectororg.json.JSONException - if the state can not be encodedprotected com.vaadin.shared.communication.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 java.lang.Class<? extends com.vaadin.shared.communication.SharedState> getStateType()
ClientConnector
getStateType in interface ClientConnectorprotected <T extends com.vaadin.shared.communication.ClientRpc> T getRpcProxy(java.lang.Class<T> rpcInterface)
rpcInterface - RPC interface type
protected void addMethodInvocationToQueue(java.lang.String interfaceName,
java.lang.reflect.Method method,
java.lang.Object[] parameters)
interfaceName - RPC interface namemethod - RPC methodparameters - RPC all parameterspublic RpcManager getRpcManager(java.lang.Class<?> rpcInterface)
RpcTarget
getRpcManager in interface RpcTargetrpcInterface - RPC interface for which a call was made
RpcTarget.getRpcManager(Class)public java.util.List<ClientMethodInvocation> retrievePendingRpcCalls()
ClientConnector
retrievePendingRpcCalls in interface ClientConnectorpublic java.lang.String getConnectorId()
getConnectorId in interface com.vaadin.shared.Connectorprotected VaadinServiceSession getSession()
VaadinServiceSession to which this connector belongs.
If the connector has not been attached, null is returned.
null if not attachedpublic UI getUI()
null is returned if
no UI ancestor is found (typically because the connector is not attached
to a proper hierarchy).
getUI in interface ClientConnectornull if none
is found.@Deprecated public void requestRepaintAll()
markAsDirtyRecursive() instead
requestRepaintAll in interface ClientConnectorpublic void markAsDirtyRecursive()
ClientConnectorThis should only be used in special cases, e.g when the state of a descendant depends on the state of an ancestor.
markAsDirtyRecursive in interface ClientConnectorClientConnector.markAsDirty()public static java.lang.Iterable<ClientConnector> getAllChildrenIterable(ClientConnector connector)
connector - the connector to get children for
public java.util.Collection<Extension> getExtensions()
ClientConnector
getExtensions in interface ClientConnectorprotected void addExtension(Extension extension)
extension - the extension to addpublic void removeExtension(Extension extension)
ClientConnector
removeExtension in interface ClientConnectorextension - 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 ClientConnectorparent - the parent connectorpublic ClientConnector getParent()
getParent in interface ClientConnectorgetParent in interface com.vaadin.shared.Connectorpublic 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 ClientConnectorpublic 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 getSession() and getUI() methods might return
null after this method is called.
detach in interface ClientConnectorpublic boolean isConnectorEnabled()
ClientConnector
isConnectorEnabled in interface ClientConnectorpublic void beforeClientResponse(boolean initial)
ClientConnector
This method must not alter the component hierarchy in any way. Calling
ClientConnector.markAsDirty() from this method will have no effect.
beforeClientResponse in interface ClientConnectorinitial - 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.
public boolean handleConnectorRequest(VaadinRequest request,
VaadinResponse response,
java.lang.String path)
throws java.io.IOException
ClientConnectorConnectorResources.
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.
DynamicConnectorResource can be used to easily make an
appropriate URL available to the client-side code.
handleConnectorRequest in interface ClientConnectorrequest - the request that should be handledresponse - the response object to which the response should be writtenpath - the requested relative path
true if the request has been handled,
false if no response has been written.
java.io.IOException - if there is a problem generating a response.protected Resource getResource(java.lang.String key)
setResource(String, Resource) with
the corresponding key.
key - the string identifier of the resource
null if there's no resource
associated with the given keysetResource(String, Resource)
protected void setResource(java.lang.String key,
Resource resource)
com.vaadin.terminal.gwt.client.ui.AbstractConnector#getResourceUrl(String)
with the same key.
key - the string key to associate the resource withresource - the resource to set, or null to clear a previous
association.
@Deprecated
protected void addListener(java.lang.String eventIdentifier,
java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.reflect.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.
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.protected boolean hasListeners(java.lang.Class<?> eventType)
Component.Event type is listened for this component.
eventType - the event type to be checked
protected void removeListener(java.lang.String eventIdentifier,
java.lang.Class<?> eventType,
java.lang.Object target)
object's methods that are
registered to listen to events of type eventType generated
by this component.
This method additionally informs the event-api to stop routing 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.
eventIdentifier - the identifier of the event to stop listening foreventType - the exact event type the object listens to.target - the target object that has registered to listen to events of
type eventType with one or more methods.
@Deprecated
public void addListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.reflect.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.
addListener in interface MethodEventSourceeventType - 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.
@Deprecated
public void addListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.String methodName)
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 addListener gets the name of the activation
method as a parameter. The actual method is reflected from
object, and unless exactly one match is found,
java.lang.IllegalArgumentException is 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) or
#addListener(com.vaadin.ui.Component.Listener) instead.
addListener in interface MethodEventSourceeventType - 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.
public void removeListener(java.lang.Class<?> eventType,
java.lang.Object target)
object's methods that are
registered to listen to events of type eventType generated
by this component.
For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.
removeListener in interface MethodEventSourceeventType - the exact event type the object listens to.target - the target object that has registered to listen to events of
type eventType with one or more methods.
@Deprecated
public void removeListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.reflect.Method method)
For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.
removeListener in interface MethodEventSourceeventType - the exact event type the object listens to.target - target object that has registered to listen to events of type
eventType with one or more methods.method - the method owned by target that's registered to
listen to events of type eventType.
public void removeListener(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.String methodName)
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 removeListener gets the name of the
activation method as a parameter. The actual method is reflected from
target, and unless exactly one match is found,
java.lang.IllegalArgumentException is thrown.
For more information on the inheritable event mechanism see the
com.vaadin.event package documentation.
removeListener in interface MethodEventSourceeventType - the exact event type the object listens to.target - the target object that has registered to listen to events of
type eventType with one or more methods.methodName - the name of the method owned by target that's
registered to listen to events of type eventType.public java.util.Collection<?> getListeners(java.lang.Class<?> eventType)
eventType - The type of event to return listeners for.
protected void fireEvent(java.util.EventObject event)
event - the Event to be sent to all listeners.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||