try {
String connectorId = keyArray.get(i);
String connectorType = types.getString(connectorId);
- Connector connector = connectorMap
+ ServerConnector connector = connectorMap
.getConnector(connectorId);
if (connector != null) {
continue;
for (int i = 0; i < keyArray.length(); i++) {
try {
String connectorId = keyArray.get(i);
- Connector paintable = connectorMap
+ ServerConnector paintable = connectorMap
.getConnector(connectorId);
if (null != paintable) {
for (int i = 0; i < hierarchyKeys.length(); i++) {
try {
String connectorId = hierarchyKeys.get(i);
- Connector connector = connectorMap
+ ServerConnector connector = connectorMap
.getConnector(connectorId);
if (!(connector instanceof ComponentContainerConnector)) {
VConsole.error("Retrieved a hierarchy update for a connector ("
.getJSStringArray(connectorId);
int childConnectorSize = childConnectorIds.length();
- List<Connector> newChildren = new ArrayList<Connector>();
+ List<ServerConnector> newChildren = new ArrayList<ServerConnector>();
for (int connectorIndex = 0; connectorIndex < childConnectorSize; connectorIndex++) {
String childConnectorId = childConnectorIds
.get(connectorIndex);
* true if the update is to be sent as soon as possible
*/
public void updateVariable(String paintableId, String variableName,
- Connector newValue, boolean immediate) {
+ ServerConnector newValue, boolean immediate) {
addVariableToQueue(paintableId, variableName, newValue, immediate);
}
}
@Deprecated
- public void unregisterPaintable(Connector p) {
+ public void unregisterPaintable(ServerConnector p) {
connectorMap.unregisterConnector(p);
}
* Updates can be sent back to the server using the
* {@link ApplicationConnection#updateVariable()} methods.
*/
-public interface ComponentConnector extends Connector {
+public interface ComponentConnector extends ServerConnector {
/*
* (non-Javadoc)
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-import java.util.Collection;
-
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-
-/**
- * Interface implemented by all client side classes that can be communicate with
- * the server. Classes implementing this interface are initialized by the
- * framework when needed and have the ability to communicate with the server.
- *
- * @author Vaadin Ltd
- * @version @VERSION@
- * @since 7.0.0
- */
-public interface Connector {
- /**
- * TODO
- *
- * @param uidl
- * @param client
- */
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client);
-
- /**
- * Gets the current shared state of the connector.
- *
- * @return state
- */
- public SharedState getState();
-
- /**
- * Sets a new state for the connector.
- *
- * @param state
- * The new state
- * @deprecated This should be removed. Framework should update what is
- * returned by getState() instead of setting a new state object.
- */
- @Deprecated
- public void setState(SharedState state);
-
- /**
- * Returns the id for this connector. This must always be what has been set
- * in {@link #doInit(String, ApplicationConnection)} and must never change.
- *
- * @return The id for the connector.
- */
- public String getId();
-
- /**
- * Gets ApplicationConnection instance that created this connector.
- *
- * @return The ApplicationConnection as set by
- * {@link #doInit(String, ApplicationConnection)}
- */
- public ApplicationConnection getConnection();
-
- /**
- * Tests whether the connector is enabled or not. Disabled connectors will
- * ignore all attempts at communications. Received messages will be
- * discarded. This method must check that the connector is enabled in
- * context, that is if it's parent is disabled, this method must return
- * false.
- *
- * @return true if the connector is enabled, false otherwise
- */
- public boolean isEnabled();
-
- /**
- *
- * Called once by the framework to initialize the connector.
- * <p>
- * Note that the shared state is not yet available at this point nor any
- * hierarchy information.
- */
- public void doInit(String connectorId, ApplicationConnection connection);
-
- /**
- * For internal use by the framework: returns the registered RPC
- * implementations for an RPC interface identifier.
- *
- * TODO interface identifier type or format may change
- *
- * @param rpcInterfaceId
- * RPC interface identifier: fully qualified interface type name
- * @return RPC interface implementations registered for an RPC interface,
- * not null
- */
- public <T extends ClientRpc> Collection<T> getRpcImplementations(
- String rpcInterfaceId);
-
-}
import java.util.List;
/**
- * Event for containing data related to a change in the {@link Connector}
+ * Event for containing data related to a change in the {@link ServerConnector}
* hierarchy. A {@link ConnectorHierarchyChangedEvent} is fired when an update
* from the server has been fully processed and all hierarchy updates have been
* completed.
public class ConnectorMap {
- private Map<String, Connector> idToConnector = new HashMap<String, Connector>();
+ private Map<String, ServerConnector> idToConnector = new HashMap<String, ServerConnector>();
public static ConnectorMap get(ApplicationConnection applicationConnection) {
return applicationConnection.getConnectorMap();
private Set<String> unregistryBag = new HashSet<String>();
/**
- * Returns a {@link Connector} by its id
+ * Returns a {@link ServerConnector} by its id
*
* @param id
* The connector id
* @return A connector or null if a connector with the given id has not been
* registered
*/
- public Connector getConnector(String connectorId) {
+ public ServerConnector getConnector(String connectorId) {
return idToConnector.get(connectorId);
}
return getConnector(widget.getElement());
}
- public void registerConnector(String id, Connector connector) {
+ public void registerConnector(String id, ServerConnector connector) {
ComponentDetail componentDetail = GWT.create(ComponentDetail.class);
idToComponentDetail.put(id, componentDetail);
idToConnector.put(id, connector);
* the connector whose id is needed
* @return the id for the given connector or null if the connector could not
* be found
- * @deprecated use {@link Connector#getId()} instead
+ * @deprecated use {@link ServerConnector#getId()} instead
*/
@Deprecated
- public String getConnectorId(Connector connector) {
+ public String getConnectorId(ServerConnector connector) {
if (connector == null) {
return null;
}
/**
* Gets the connector id using a DOM element - the element should be the
* root element for a connector, otherwise no id will be found. Use
- * {@link #getConnectorId(Connector)} instead whenever possible.
+ * {@link #getConnectorId(ServerConnector)} instead whenever possible.
*
* @see #getConnectorId(Paintable)
* @param el
* @return the element for the connector corresponding to the id
*/
public Element getElement(String connectorId) {
- Connector p = getConnector(connectorId);
+ ServerConnector p = getConnector(connectorId);
if (p instanceof ComponentConnector) {
return ((ComponentConnector) p).getWidget().getElement();
}
* @param connector
* the connector to remove
*/
- public void unregisterConnector(Connector connector) {
+ public void unregisterConnector(ServerConnector connector) {
// add to unregistry queue
public ComponentConnector[] getRegisteredComponentConnectors() {
ArrayList<ComponentConnector> result = new ArrayList<ComponentConnector>();
- for (Connector connector : getConnectors()) {
+ for (ServerConnector connector : getConnectors()) {
if (connector instanceof ComponentConnector) {
ComponentConnector componentConnector = (ComponentConnector) connector;
if (!unregistryBag.contains(connector.getId())) {
if (unregisterConnectors) {
for (String connectorId : unregistryBag) {
// TODO purge shared state for pid
- Connector connector = getConnector(connectorId);
+ ServerConnector connector = getConnector(connectorId);
if (connector == null) {
/*
* this should never happen, but it does :-( See e.g.
* not unregister the given container itself. Does not actually remove the
* widgets from the DOM.
*
- * @see #unregisterConnector(Connector)
+ * @see #unregisterConnector(ServerConnector)
* @param container
* The container that contains the connectors that should be
* unregistered
return getTooltipInfo(getConnector(widget), key);
}
- public Collection<? extends Connector> getConnectors() {
+ public Collection<? extends ServerConnector> getConnectors() {
return Collections.unmodifiableCollection(idToConnector.values());
}
for (int i = 0; i < needsWidthUpdateArray.length(); i++) {
String pid = needsWidthUpdateArray.get(i);
- Connector paintable = paintableMap.getConnector(pid);
+ ServerConnector paintable = paintableMap.getConnector(pid);
if (paintable instanceof DirectionalManagedLayout) {
DirectionalManagedLayout cl = (DirectionalManagedLayout) paintable;
cl.layoutHorizontally();
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+package com.vaadin.terminal.gwt.client;
+
+import java.util.Collection;
+
+import com.vaadin.terminal.gwt.client.communication.ClientRpc;
+import com.vaadin.terminal.gwt.client.communication.SharedState;
+
+/**
+ * Interface implemented by all client side classes that can be communicate with
+ * the server. Classes implementing this interface are initialized by the
+ * framework when needed and have the ability to communicate with the server.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0.0
+ */
+public interface ServerConnector {
+ /**
+ * TODO
+ *
+ * @param uidl
+ * @param client
+ */
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client);
+
+ /**
+ * Gets the current shared state of the connector.
+ *
+ * @return state
+ */
+ public SharedState getState();
+
+ /**
+ * Sets a new state for the connector.
+ *
+ * @param state
+ * The new state
+ * @deprecated This should be removed. Framework should update what is
+ * returned by getState() instead of setting a new state object.
+ */
+ @Deprecated
+ public void setState(SharedState state);
+
+ /**
+ * Returns the id for this connector. This must always be what has been set
+ * in {@link #doInit(String, ApplicationConnection)} and must never change.
+ *
+ * @return The id for the connector.
+ */
+ public String getId();
+
+ /**
+ * Gets ApplicationConnection instance that created this connector.
+ *
+ * @return The ApplicationConnection as set by
+ * {@link #doInit(String, ApplicationConnection)}
+ */
+ public ApplicationConnection getConnection();
+
+ /**
+ * Tests whether the connector is enabled or not. Disabled connectors will
+ * ignore all attempts at communications. Received messages will be
+ * discarded. This method must check that the connector is enabled in
+ * context, that is if it's parent is disabled, this method must return
+ * false.
+ *
+ * @return true if the connector is enabled, false otherwise
+ */
+ public boolean isEnabled();
+
+ /**
+ *
+ * Called once by the framework to initialize the connector.
+ * <p>
+ * Note that the shared state is not yet available at this point nor any
+ * hierarchy information.
+ */
+ public void doInit(String connectorId, ApplicationConnection connection);
+
+ /**
+ * For internal use by the framework: returns the registered RPC
+ * implementations for an RPC interface identifier.
+ *
+ * TODO interface identifier type or format may change
+ *
+ * @param rpcInterfaceId
+ * RPC interface identifier: fully qualified interface type name
+ * @return RPC interface implementations registered for an RPC interface,
+ * not null
+ */
+ public <T extends ClientRpc> Collection<T> getRpcImplementations(
+ String rpcInterfaceId);
+
+}
* the name of the attribute
* @return the Paintable referenced by the attribute, if it exists
*/
- public Connector getPaintableAttribute(String name,
+ public ServerConnector getPaintableAttribute(String name,
ApplicationConnection connection) {
return ConnectorMap.get(connection).getConnector(
getStringAttribute(name));
* the name of the variable
* @return the Paintable referenced by the variable, if it exists
*/
- public Connector getPaintableVariable(String name,
+ public ServerConnector getPaintableVariable(String name,
ApplicationConnection connection) {
return ConnectorMap.get(connection).getConnector(
getStringVariable(name));
}
String pid = paintableMap.getConnectorId(paintable);
if (pid != null) {
- Connector otherPaintable = paintableMap.getConnector(pid);
+ ServerConnector otherPaintable = paintableMap.getConnector(pid);
if (otherPaintable == paintable) {
return applicationConnection;
}
Object value = parameters[1];
// TODO paintables inside lists/maps get rendered as
// components in the debug console
- String formattedValue = value instanceof Connector ? c
+ String formattedValue = value instanceof ServerConnector ? c
.getConnectorMap()
- .getConnectorId((Connector) value) : String
+ .getConnectorId((ServerConnector) value) : String
.valueOf(value);
formattedParams = parameters[0] + " : " + formattedValue;
}
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
/**
* @param jsonArray
* JSON array with two elements
* @param idMapper
- * mapper between connector ID and {@link Connector} objects
+ * mapper between connector ID and {@link ServerConnector} objects
* @param connection
* reference to the current ApplicationConnection
* @return decoded value (does not contain JSON types)
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
/**
jsonMap.put(mapKey, encode(mapValue, connectorMap, connection));
}
return combineTypeAndValue(VTYPE_MAP, jsonMap);
- } else if (value instanceof Connector) {
- Connector paintable = (Connector) value;
+ } else if (value instanceof ServerConnector) {
+ ServerConnector paintable = (ServerConnector) value;
return combineTypeAndValue(VTYPE_PAINTABLE, new JSONString(
connectorMap.getConnectorId(paintable)));
} else {
private static String getTransportType(Object value) {
if (value instanceof String) {
return VTYPE_STRING;
- } else if (value instanceof Connector) {
+ } else if (value instanceof ServerConnector) {
return VTYPE_PAINTABLE;
} else if (value instanceof Boolean) {
return VTYPE_BOOLEAN;
import java.util.Map;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.communication.ClientRpc;
/**
* @since 7.0.0
*
*/
-public abstract class AbstractConnector implements Connector {
+public abstract class AbstractConnector implements ServerConnector {
private ApplicationConnection connection;
private String id;
import com.google.gwt.xhr.client.XMLHttpRequest;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
import com.vaadin.terminal.gwt.client.RenderInformation;
}
private String getPid() {
- return ConnectorMap.get(client).getConnectorId((Connector) this);
+ return ConnectorMap.get(client).getConnectorId((ServerConnector) this);
}
public VDropHandler getDropHandler() {
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.communication.ClientRpc;
import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
}
}
sourceWriter
- .println(Connector.class.getName()
+ .println(ServerConnector.class.getName()
+ " connector = connectorMap.getConnector(invocation.getConnectorId());");
sourceWriter
.println("for ("