aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-03-30 18:10:56 +0300
committerArtur Signell <artur@vaadin.com>2012-03-30 18:33:07 +0300
commitf38da072d3d3846b987da3160bb458eaa14747e0 (patch)
tree9a63c1f9ef215d3aaf2fc4318c3ca1fae4ca60c9
parente4cedbca49dfb3ada5f4f16a4d67195c897a2c72 (diff)
downloadvaadin-framework-f38da072d3d3846b987da3160bb458eaa14747e0.tar.gz
vaadin-framework-f38da072d3d3846b987da3160bb458eaa14747e0.zip
Moved isConnectorEnabled() to ClientConnector and improved javadoc.
ServerConnector is always enabled.
-rw-r--r--src/com/vaadin/Application.java7
-rw-r--r--src/com/vaadin/terminal/gwt/client/Connector.java32
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java6
-rw-r--r--src/com/vaadin/terminal/gwt/server/ClientConnector.java7
-rw-r--r--src/com/vaadin/terminal/gwt/server/DragAndDropService.java8
5 files changed, 40 insertions, 20 deletions
diff --git a/src/com/vaadin/Application.java b/src/com/vaadin/Application.java
index fcd28a1f0c..448daea4c0 100644
--- a/src/com/vaadin/Application.java
+++ b/src/com/vaadin/Application.java
@@ -50,6 +50,7 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
import com.vaadin.terminal.gwt.server.ChangeVariablesErrorEvent;
+import com.vaadin.terminal.gwt.server.ClientConnector;
import com.vaadin.terminal.gwt.server.WebApplicationContext;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.AbstractField;
@@ -2388,7 +2389,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
return Collections.unmodifiableCollection(roots.values());
}
- private final HashMap<String, Connector> connectorIdToConnector = new HashMap<String, Connector>();
+ private final HashMap<String, ClientConnector> connectorIdToConnector = new HashMap<String, ClientConnector>();
private int connectorIdSequence = 0;
@@ -2400,7 +2401,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
* A connector that has not yet been assigned an id.
* @return A new id for the connector
*/
- public String createConnectorId(Connector connector) {
+ public String createConnectorId(ClientConnector connector) {
String connectorId = String.valueOf(connectorIdSequence++);
Connector oldReference = connectorIdToConnector.put(connectorId,
connector);
@@ -2420,7 +2421,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
* @return The connector with the given id or null if no connector has the
* given id
*/
- public Connector getConnector(String connectorId) {
+ public ClientConnector getConnector(String connectorId) {
return connectorIdToConnector.get(connectorId);
}
diff --git a/src/com/vaadin/terminal/gwt/client/Connector.java b/src/com/vaadin/terminal/gwt/client/Connector.java
index 22cdbdb4cd..1c61052735 100644
--- a/src/com/vaadin/terminal/gwt/client/Connector.java
+++ b/src/com/vaadin/terminal/gwt/client/Connector.java
@@ -6,36 +6,44 @@ package com.vaadin.terminal.gwt.client;
import java.io.Serializable;
import com.vaadin.terminal.gwt.client.communication.SharedState;
+import com.vaadin.terminal.gwt.server.ClientConnector;
/**
- * TODO Add javadoc
+ * Interface implemented by all classes that are capable of communicating with
+ * the server or the client side.
+ * <p>
+ * A connector consists of a shared state (server sets the state and
+ * automatically communicates changes to the client) and the possibility to do
+ * RPC calls either from the server to the client or from the client to the
+ * server.
+ * </p>
+ * <p>
+ * No classes should implement this interface directly, client side classes
+ * wanting to communicate with server side should implement
+ * {@link ServerConnector} and server side classes should implement
+ * {@link ClientConnector}.
+ * </p>
*
* @author Vaadin Ltd
* @version @VERSION@
* @since 7.0.0
- *
*/
public interface Connector extends Serializable {
/**
* Gets the current shared state of the connector.
*
- * @return state
+ * @since 7.0.
+ * @return state The shared state object. Can be any sub type of
+ * {@link SharedState}. Never null.
*/
public SharedState getState();
/**
- * Returns the id for this connector. This must always be what has been set
- * in {@link #doInit(String, ApplicationConnection)} and must never change.
+ * Returns the id for this connector. This is set by the framework and does
+ * not change during the lifetime of a connector.
*
* @return The id for the connector.
*/
public String getConnectorId();
- /**
- * Checks if the communicator is enabled. An enabled communicator is allowed
- * to receive messages from its counter-part.
- *
- * @return true if the connector can receive messages, false otherwise
- */
- public boolean isConnectorEnabled();
}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index 64d38dc110..505cebaabf 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -1433,7 +1433,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
applyInvocation(app, invocation);
continue;
}
- final Connector connector = getConnector(app,
+ final ClientConnector connector = getConnector(app,
invocation.getConnectorId());
final VariableOwner owner = (VariableOwner) connector;
@@ -1579,8 +1579,8 @@ public abstract class AbstractCommunicationManager implements Serializable {
owner.changeVariables(source, m);
}
- protected Connector getConnector(Application app, String connectorId) {
- Connector c = app.getConnector(connectorId);
+ protected ClientConnector getConnector(Application app, String connectorId) {
+ ClientConnector c = app.getConnector(connectorId);
if (c == null
&& connectorId.equals(getDragAndDropService().getConnectorId())) {
return getDragAndDropService();
diff --git a/src/com/vaadin/terminal/gwt/server/ClientConnector.java b/src/com/vaadin/terminal/gwt/server/ClientConnector.java
index 88138bb5a5..cc4c1161a0 100644
--- a/src/com/vaadin/terminal/gwt/server/ClientConnector.java
+++ b/src/com/vaadin/terminal/gwt/server/ClientConnector.java
@@ -28,4 +28,11 @@ public interface ClientConnector extends Connector {
*/
public List<ClientMethodInvocation> retrievePendingRpcCalls();
+ /**
+ * Checks if the communicator is enabled. An enabled communicator is allowed
+ * to receive messages from its counter-part.
+ *
+ * @return true if the connector can receive messages, false otherwise
+ */
+ public boolean isConnectorEnabled();
}
diff --git a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
index a637db2840..ca499d024d 100644
--- a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
+++ b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
@@ -4,6 +4,7 @@
package com.vaadin.terminal.gwt.server;
import java.io.PrintWriter;
+import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -18,13 +19,12 @@ import com.vaadin.event.dd.TargetDetailsImpl;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.VariableOwner;
-import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.communication.SharedState;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager.DragEventType;
import com.vaadin.ui.Component;
-public class DragAndDropService implements VariableOwner, Connector {
+public class DragAndDropService implements VariableOwner, ClientConnector {
private static final Logger logger = Logger
.getLogger(DragAndDropService.class.getName());
@@ -229,4 +229,8 @@ public class DragAndDropService implements VariableOwner, Connector {
// Drag'n'drop can't be disabled
return true;
}
+
+ public List<ClientMethodInvocation> retrievePendingRpcCalls() {
+ return null;
+ }
}