com.vaadin.server
Class DragAndDropService

java.lang.Object
  extended by com.vaadin.server.DragAndDropService
All Implemented Interfaces:
ClientConnector, VariableOwner, com.vaadin.shared.Connector, java.io.Serializable

public class DragAndDropService
extends java.lang.Object
implements VariableOwner, ClientConnector

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
DragAndDropService(VaadinSession session)
           
 
Method Summary
 void addAttachListener(ClientConnector.AttachListener listener)
           
 void addDetachListener(ClientConnector.DetachListener listener)
           
 void attach()
          Notifies the connector that it is connected to a VaadinSession (and therefore also to a UI).
 void beforeClientResponse(boolean initial)
          Called before the shared state and RPC invocations are sent to the client.
 void changeVariables(java.lang.Object source, java.util.Map<java.lang.String,java.lang.Object> variables)
          Called when one or more variables handled by the implementing class are changed.
 void detach()
          Notifies the connector that it is detached from its VaadinSession.
 elemental.json.JsonObject encodeState()
          Called by the framework to encode the state to a JSONObject.
 java.lang.String getConnectorId()
           
 ErrorHandler getErrorHandler()
          Gets the error handler for the connector.
 java.util.Collection<Extension> getExtensions()
          Get a read-only collection of all extensions attached to this connector.
 ClientConnector getParent()
           
 ServerRpcManager<?> getRpcManager(java.lang.String interfaceName)
          Returns the RPC manager instance to use when receiving calls for an RPC interface.
 java.lang.Class<? extends com.vaadin.shared.communication.SharedState> getStateType()
          Returns the type of the shared state for this connector
 UI getUI()
          Returns the UI this connector is attached to
 boolean handleConnectorRequest(VaadinRequest request, VaadinResponse response, java.lang.String path)
          Handle a request directed to this connector.
 boolean isAttached()
          Checks if the connector is attached to a VaadinSession.
 boolean isConnectorEnabled()
          Checks if the communicator is enabled.
 boolean isEnabled()
           Tests if the variable owner is enabled or not.
 boolean isImmediate()
           Tests if the variable owner is in immediate mode or not.
 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.
 void printJSONResponse(java.io.Writer outWriter)
           
 void removeAttachListener(ClientConnector.AttachListener listener)
           
 void removeDetachListener(ClientConnector.DetachListener listener)
           
 void removeExtension(Extension extension)
          Remove an extension from this connector.
 void requestRepaint()
          Deprecated. 
 void requestRepaintAll()
          Deprecated. 
 java.util.List<ClientMethodInvocation> retrievePendingRpcCalls()
          Returns the list of pending server to client RPC calls and clears the list.
 void setErrorHandler(ErrorHandler errorHandler)
          Sets the error handler for the connector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DragAndDropService

public DragAndDropService(VaadinSession session)
Method Detail

changeVariables

public void changeVariables(java.lang.Object source,
                            java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.

Specified by:
changeVariables in interface VariableOwner
Parameters:
source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
variables - the Mapping from variable names to new variable values.

isEnabled

public boolean isEnabled()
Description copied from interface: VariableOwner

Tests if the variable owner is enabled or not. The terminal should not send any variable changes to disabled variable owners.

Specified by:
isEnabled in interface VariableOwner
Returns:
true if the variable owner is enabled, false if not

isImmediate

public boolean isImmediate()
Description copied from interface: VariableOwner

Tests if the variable owner is in immediate mode or not. Being in immediate mode means that all variable changes are required to be sent back from the terminal immediately when they occur.

Note: VariableOwner does not include a set- method for the immediateness property. This is because not all VariableOwners wish to offer the functionality. Such VariableOwners are never in the immediate mode, thus they always return false in VariableOwner.isImmediate().

Specified by:
isImmediate in interface VariableOwner
Returns:
true if the component is in immediate mode, false if not.

printJSONResponse

public void printJSONResponse(java.io.Writer outWriter)
                       throws java.io.IOException
Throws:
java.io.IOException

getConnectorId

public java.lang.String getConnectorId()
Specified by:
getConnectorId in interface com.vaadin.shared.Connector

isConnectorEnabled

public boolean isConnectorEnabled()
Description copied from interface: ClientConnector
Checks if the communicator is enabled. An enabled communicator is allowed to receive messages from its counter-part.

Specified by:
isConnectorEnabled in interface ClientConnector
Returns:
true if the connector can receive messages, false otherwise

retrievePendingRpcCalls

public java.util.List<ClientMethodInvocation> retrievePendingRpcCalls()
Description copied from interface: ClientConnector
Returns the list of pending server to client RPC calls and clears the list.

Specified by:
retrievePendingRpcCalls in interface ClientConnector
Returns:
an unmodifiable ordered list of pending server to client method calls (not null)

getRpcManager

public ServerRpcManager<?> getRpcManager(java.lang.String interfaceName)
Description copied from interface: ClientConnector
Returns the RPC manager instance to use when receiving calls for an RPC interface.

Specified by:
getRpcManager in interface ClientConnector
Parameters:
interfaceName - name of the interface for which the call was made
Returns:
ServerRpcManager or null if none found for the interface

getStateType

public java.lang.Class<? extends com.vaadin.shared.communication.SharedState> getStateType()
Description copied from interface: ClientConnector
Returns the type of the shared state for this connector

Specified by:
getStateType in interface ClientConnector
Returns:
The type of the state. Must never return null.

requestRepaint

@Deprecated
public void requestRepaint()
Deprecated. 

Specified by:
requestRepaint in interface ClientConnector

markAsDirty

public void markAsDirty()
Description copied from interface: ClientConnector
Marks that this connector's state might have changed. When the framework is about to send new data to the client-side, it will run ClientConnector.beforeClientResponse(boolean) followed by ClientConnector.encodeState() for all connectors that are marked as dirty and send any updated state info to the client.

Specified by:
markAsDirty in interface ClientConnector

getParent

public ClientConnector getParent()
Specified by:
getParent in interface ClientConnector
Specified by:
getParent in interface com.vaadin.shared.Connector

requestRepaintAll

@Deprecated
public void requestRepaintAll()
Deprecated. 

Specified by:
requestRepaintAll in interface ClientConnector

markAsDirtyRecursive

public void markAsDirtyRecursive()
Description copied from interface: ClientConnector
Causes 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:
markAsDirtyRecursive in interface ClientConnector
See Also:
ClientConnector.markAsDirty()

attach

public void attach()
Description copied from interface: ClientConnector
Notifies the connector that it is connected to a VaadinSession (and therefore also to a UI).

The caller of this method is #setParent(ClientConnector) if the parent is itself already attached to the session. If not, the parent will call the ClientConnector.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:
attach in interface ClientConnector

detach

public void detach()
Description copied from interface: ClientConnector
Notifies the connector that it is detached from its VaadinSession.

The caller of this method is #setParent(ClientConnector) if the parent is in the session. When the parent is detached from the session it is its responsibility to call ClientConnector.detach() for each of its children.

Specified by:
detach in interface ClientConnector

getExtensions

public java.util.Collection<Extension> getExtensions()
Description copied from interface: ClientConnector
Get a read-only collection of all extensions attached to this connector.

Specified by:
getExtensions in interface ClientConnector
Returns:
a collection of extensions

removeExtension

public void removeExtension(Extension extension)
Description copied from interface: ClientConnector
Remove an extension from this connector.

Specified by:
removeExtension in interface ClientConnector
Parameters:
extension - the extension to remove.

getUI

public UI getUI()
Description copied from interface: ClientConnector
Returns the UI this connector is attached to

Specified by:
getUI in interface ClientConnector
Returns:
The UI this connector is attached to or null if it is not attached to any UI

beforeClientResponse

public void beforeClientResponse(boolean initial)
Description copied from interface: ClientConnector
Called 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.

This method must not alter the component hierarchy in any way. Calling ClientConnector.markAsDirty() from this method will have no effect.

Specified by:
beforeClientResponse in interface ClientConnector
Parameters:
initial - 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.

encodeState

public elemental.json.JsonObject encodeState()
Description copied from interface: ClientConnector
Called by the framework to encode the state to a JSONObject. This is typically done by calling the static method LegacyCommunicationManager.encodeState(ClientConnector, SharedState) .

Specified by:
encodeState in interface ClientConnector
Returns:
a JSON object with the encoded connector state if the state can not be encoded

handleConnectorRequest

public boolean handleConnectorRequest(VaadinRequest request,
                                      VaadinResponse response,
                                      java.lang.String path)
                               throws java.io.IOException
Description copied from interface: ClientConnector
Handle a request directed to this connector. This can be used by connectors to dynamically generate a response and it is also used internally when serving ConnectorResources.

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:
handleConnectorRequest in interface ClientConnector
Parameters:
request - the request that should be handled
response - the response object to which the response should be written
path - the requested relative path
Returns:
true if the request has been handled, false if no response has been written.
Throws:
java.io.IOException - if there is a problem generating a response.

getErrorHandler

public ErrorHandler getErrorHandler()
Description copied from interface: ClientConnector
Gets 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:
getErrorHandler in interface ClientConnector
Returns:
The error handler or null if not set

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Description copied from interface: ClientConnector
Sets 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:
setErrorHandler in interface ClientConnector
Parameters:
errorHandler - The error handler for this connector

addAttachListener

public void addAttachListener(ClientConnector.AttachListener listener)
Specified by:
addAttachListener in interface ClientConnector

removeAttachListener

public void removeAttachListener(ClientConnector.AttachListener listener)
Specified by:
removeAttachListener in interface ClientConnector

addDetachListener

public void addDetachListener(ClientConnector.DetachListener listener)
Specified by:
addDetachListener in interface ClientConnector

removeDetachListener

public void removeDetachListener(ClientConnector.DetachListener listener)
Specified by:
removeDetachListener in interface ClientConnector

isAttached

public boolean isAttached()
Description copied from interface: ClientConnector
Checks if the connector is attached to a VaadinSession.

Specified by:
isAttached in interface ClientConnector
Returns:
true if the connector is attached to a session, false otherwise


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