Pārlūkot izejas kodu

Paintable -> Connector

tags/7.0.0.alpha2
Artur Signell pirms 12 gadiem
vecāks
revīzija
a462479569

+ 4
- 7
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java Parādīt failu

@@ -57,13 +57,10 @@ import com.vaadin.terminal.gwt.server.AbstractCommunicationManager;
* communication with its server side counterpart
* {@link AbstractCommunicationManager}.
*
* Client-side widgets receive updates from the corresponding server-side
* components as calls to
* {@link ComponentConnector#updateFromUIDL(UIDL, ApplicationConnection)} (not
* to be confused with the server side interface
* {@link com.vaadin.terminal.Paintable} ). Any client-side changes (typically
* resulting from user actions) are sent back to the server as variable changes
* (see {@link #updateVariable()}).
* Client-side connectors receive updates from the corresponding server-side
* connector (typically component) as state updates or RPC calls. The connector
* has the possibility to communicate back with its server side counter part
* through RPC calls.
*
* TODO document better
*

+ 1
- 2
src/com/vaadin/terminal/gwt/client/ConnectorMap.java Parādīt failu

@@ -12,7 +12,6 @@ import java.util.Map;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.Paintable;

public class ConnectorMap {

@@ -130,7 +129,7 @@ public class ConnectorMap {
* root element for a connector, otherwise no id will be found. Use
* {@link #getConnectorId(ServerConnector)} instead whenever possible.
*
* @see #getConnectorId(Paintable)
* @see #getConnectorId(ServerConnector)
* @param el
* element of the connector whose id is desired
* @return the id of the element's connector, if it's a connector

+ 20
- 19
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java Parādīt failu

@@ -1059,7 +1059,8 @@ public abstract class AbstractCommunicationManager implements Serializable {
outWriter.print("\"");
outWriter.print(canonicalName);
outWriter.print("\" : ");
outWriter.print(getTagForType(class1));
outWriter
.print(getTagForType((Class<? extends ClientConnector>) class1));
}
}
if (typeMappingsOpen) {
@@ -1077,33 +1078,33 @@ public abstract class AbstractCommunicationManager implements Serializable {
private void legacyPaint(PaintTarget paintTarget,
ArrayList<ClientConnector> dirtyVisibleConnectors)
throws PaintException {
List<Paintable> paintables = new ArrayList<Paintable>();
List<Component> legacyComponents = new ArrayList<Component>();
for (Connector connector : dirtyVisibleConnectors) {
if (connector instanceof Paintable) {
paintables.add((Paintable) connector);
// All legacy Components must be Paintables as Component extends
// Paintable in Vaadin 6
legacyComponents.add((Component) connector);
}
}
sortByHierarchy(paintables);
for (Paintable p : paintables) {
logger.info("Painting legacy Paintable " + p.getClass().getName()
+ "@" + Integer.toHexString(p.hashCode()));
sortByHierarchy(legacyComponents);
for (Component c : legacyComponents) {
logger.info("Painting legacy Component " + c.getClass().getName()
+ "@" + Integer.toHexString(c.hashCode()));
paintTarget.startTag("change");
final String pid = ((Connector) p).getConnectorId();
final String pid = c.getConnectorId();
paintTarget.addAttribute("pid", pid);
p.paint(paintTarget);
c.paint(paintTarget);
paintTarget.endTag("change");
}

}

private void sortByHierarchy(List<Paintable> paintables) {
private void sortByHierarchy(List<Component> paintables) {
// Vaadin 6 requires parents to be painted before children as component
// containers rely on that their updateFromUIDL method has been called
// before children start calling e.g. updateCaption
Collections.sort(paintables, new Comparator<Paintable>() {
public int compare(Paintable o1, Paintable o2) {
Component c1 = (Component) o1;
Component c2 = (Component) o2;
Collections.sort(paintables, new Comparator<Component>() {
public int compare(Component c1, Component c2) {
int depth1 = 0;
while (c1.getParent() != null) {
depth1++;
@@ -1195,11 +1196,11 @@ public abstract class AbstractCommunicationManager implements Serializable {
}

/**
* Collects all pending RPC calls from listed {@link Paintable}s and clears
* their RPC queues.
* Collects all pending RPC calls from listed {@link ClientConnector}s and
* clears their RPC queues.
*
* @param rpcPendingQueue
* list of {@link Paintable} of interest
* list of {@link ClientConnector} of interest
* @return ordered list of pending RPC calls
*/
private List<ClientMethodInvocation> collectPendingRpcCalls(
@@ -1994,12 +1995,12 @@ public abstract class AbstractCommunicationManager implements Serializable {

}

private final HashMap<Class<? extends Paintable>, Integer> typeToKey = new HashMap<Class<? extends Paintable>, Integer>();
private final HashMap<Class<? extends ClientConnector>, Integer> typeToKey = new HashMap<Class<? extends ClientConnector>, Integer>();
private int nextTypeKey = 0;

private BootstrapHandler bootstrapHandler;

String getTagForType(Class<? extends Paintable> class1) {
String getTagForType(Class<? extends ClientConnector> class1) {
Integer object = typeToKey.get(class1);
if (object == null) {
object = nextTypeKey++;

+ 2
- 3
src/com/vaadin/terminal/gwt/server/JsonCodec.java Parādīt failu

@@ -23,7 +23,6 @@ import com.vaadin.Application;
import com.vaadin.external.json.JSONArray;
import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.communication.JsonEncoder;

@@ -70,7 +69,7 @@ public class JsonCodec implements Serializable {
* @param value
* JSON array with two elements
* @param application
* mapper between paintable ID and {@link Paintable} objects
* mapper between connector ID and {@link Connector} objects
* @return converted value (does not contain JSON types)
* @throws JSONException
* if the conversion fails
@@ -177,7 +176,7 @@ public class JsonCodec implements Serializable {
* @param value
* value to convert
* @param application
* mapper between paintable ID and {@link Paintable} objects
* mapper between connector ID and {@link Connector} objects
* @return JSON representation of the value
* @throws JSONException
* if encoding a value fails (e.g. NaN or infinite number)

+ 1
- 1
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java Parādīt failu

@@ -1023,7 +1023,7 @@ public class JsonPaintTarget implements PaintTarget {
}

usedPaintableTypes.add(class1);
return manager.getTagForType(class1);
return manager.getTagForType((Class<? extends ClientConnector>) class1);

}


+ 6
- 6
src/com/vaadin/terminal/gwt/server/ServerRpcManager.java Parādīt failu

@@ -10,15 +10,15 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.communication.MethodInvocation;

/**
* Server side RPC manager that handles RPC calls coming from the client.
*
* Each {@link RpcTarget} (typically a {@link Paintable}) should have its own
* instance of {@link ServerRpcManager} if it wants to receive RPC calls from
* the client.
* Each {@link RpcTarget} (typically a {@link ClientConnector}) should have its
* own instance of {@link ServerRpcManager} if it wants to receive RPC calls
* from the client.
*
* @since 7.0
*/
@@ -51,7 +51,7 @@ public class ServerRpcManager<T> implements RpcManager {
* Create a RPC manager for an RPC target.
*
* @param target
* RPC call target (normally a {@link Paintable})
* RPC call target (normally a {@link Connector})
* @param implementation
* RPC interface implementation for the target
* @param rpcInterface
@@ -96,7 +96,7 @@ public class ServerRpcManager<T> implements RpcManager {
/**
* Returns the RPC target of this RPC manager instance.
*
* @return RpcTarget, typically a {@link Paintable}
* @return RpcTarget, typically a {@link Connector}
*/
public RpcTarget getTarget() {
return target;

Notiek ielāde…
Atcelt
Saglabāt