com.vaadin.terminal.gwt.client.ui
Class AbstractConnector

java.lang.Object
  extended by com.vaadin.terminal.gwt.client.ui.AbstractConnector
All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler, StateChangeEvent.StateChangeHandler, Connector, ServerConnector, Serializable
Direct Known Subclasses:
AbstractComponentConnector

public abstract class AbstractConnector
extends Object
implements ServerConnector, StateChangeEvent.StateChangeHandler

An abstract implementation of Connector.

Since:
7.0.0
Version:
7.0.0.alpha2
Author:
Vaadin Ltd
See Also:
Serialized Form

Constructor Summary
AbstractConnector()
           
 
Method Summary
 com.google.web.bindery.event.shared.HandlerRegistration addStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
          Adds a handler that is called whenever some part of the state has been updated by the server.
 void doInit(String connectorId, ApplicationConnection connection)
          Called once by the framework to initialize the connector.
protected  com.google.gwt.event.shared.HandlerManager ensureHandlerManager()
           
 void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
          Sends the given event to all registered handlers.
 ApplicationConnection getConnection()
          Gets ApplicationConnection instance that created this connector.
 String getConnectorId()
          Returns the id for this connector.
<T extends ClientRpc>
Collection<T>
getRpcImplementations(String rpcInterfaceId)
          For internal use by the framework: returns the registered RPC implementations for an RPC interface identifier.
protected  void init()
          Called when the connector has been initialized.
 boolean isConnectorEnabled()
           
 void onStateChanged(StateChangeEvent stateChangeEvent)
           
 void onUnregister()
          Event called when connector has been unregistered.
protected
<T extends ClientRpc>
void
registerRpc(Class<T> rpcInterface, T implementation)
          Registers an implementation for a server to client RPC interface.
protected
<T extends ClientRpc>
void
unregisterRpc(Class<T> rpcInterface, T implementation)
          Unregisters an implementation for a server to client RPC interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.terminal.gwt.client.ServerConnector
isEnabled, setState
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getState
 

Constructor Detail

AbstractConnector

public AbstractConnector()
Method Detail

getConnection

public final ApplicationConnection getConnection()
Description copied from interface: ServerConnector
Gets ApplicationConnection instance that created this connector.

Specified by:
getConnection in interface ServerConnector
Returns:
The ApplicationConnection as set by ServerConnector.doInit(String, ApplicationConnection)

getConnectorId

public String getConnectorId()
Description copied from interface: Connector
Returns the id for this connector. This is set by the framework and does not change during the lifetime of a connector.

Specified by:
getConnectorId in interface Connector
Returns:
The id for the connector.

doInit

public final void doInit(String connectorId,
                         ApplicationConnection connection)
Called once by the framework to initialize the connector.

Note that the shared state is not yet available when this method is called.

Connector classes should override init() instead of this method.

Specified by:
doInit in interface ServerConnector

init

protected void init()
Called when the connector has been initialized. Override this method to perform initialization of the connector.


registerRpc

protected <T extends ClientRpc> void registerRpc(Class<T> rpcInterface,
                                                 T implementation)
Registers an implementation for a server to client RPC interface. Multiple registrations can be made for a single interface, in which case all of them receive corresponding RPC calls.

Type Parameters:
T - The type of the RPC interface that is being registered
Parameters:
rpcInterface - RPC interface
implementation - implementation that should receive RPC calls

unregisterRpc

protected <T extends ClientRpc> void unregisterRpc(Class<T> rpcInterface,
                                                   T implementation)
Unregisters an implementation for a server to client RPC interface.

Parameters:
rpcInterface - RPC interface
implementation - implementation to unregister

getRpcImplementations

public <T extends ClientRpc> Collection<T> getRpcImplementations(String rpcInterfaceId)
Description copied from interface: ServerConnector
For internal use by the framework: returns the registered RPC implementations for an RPC interface identifier. TODO interface identifier type or format may change

Specified by:
getRpcImplementations in interface ServerConnector
Parameters:
rpcInterfaceId - RPC interface identifier: fully qualified interface type name
Returns:
RPC interface implementations registered for an RPC interface, not null

isConnectorEnabled

public boolean isConnectorEnabled()

fireEvent

public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
Description copied from interface: ServerConnector
Sends the given event to all registered handlers.

Specified by:
fireEvent in interface ServerConnector
Parameters:
event - The event to send.

ensureHandlerManager

protected com.google.gwt.event.shared.HandlerManager ensureHandlerManager()

addStateChangeHandler

public com.google.web.bindery.event.shared.HandlerRegistration addStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
Description copied from interface: ServerConnector
Adds a handler that is called whenever some part of the state has been updated by the server.

Specified by:
addStateChangeHandler in interface ServerConnector
Parameters:
handler - The handler that should be added.
Returns:
A handler registration reference that can be used to unregister the handler

onStateChanged

public void onStateChanged(StateChangeEvent stateChangeEvent)
Specified by:
onStateChanged in interface StateChangeEvent.StateChangeHandler

onUnregister

public void onUnregister()
Description copied from interface: ServerConnector
Event called when connector has been unregistered.

Specified by:
onUnregister in interface ServerConnector


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.