diff options
author | Artur Signell <artur@vaadin.com> | 2012-03-16 17:42:06 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-03-21 15:27:27 +0200 |
commit | ceda855ab44ffe2330e639b1e0f51a5152602c42 (patch) | |
tree | 8078937b3c4ce49c041fa0c1cb8c6a900e2bc0b4 /src | |
parent | 242b09c8ece1a35d7b2c1473537a0fafc70bd1bb (diff) | |
download | vaadin-framework-ceda855ab44ffe2330e639b1e0f51a5152602c42.tar.gz vaadin-framework-ceda855ab44ffe2330e639b1e0f51a5152602c42.zip |
Cleaned up code related to storing which type mappings have already been
sent to the client
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 0a4231941a..6a5bcce7d7 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -131,7 +131,7 @@ public abstract class AbstractCommunicationManager implements public static final char VAR_ESCAPE_CHARACTER = '\u001b'; - private final HashMap<Integer, OpenWindowCache> currentlyOpenWindowsInClient = new HashMap<Integer, OpenWindowCache>(); + private final HashMap<Integer, ClientCache> rootToClientCache = new HashMap<Integer, ClientCache>(); private static final int MAX_BUFFER_SIZE = 64 * 1024; @@ -799,13 +799,7 @@ public abstract class AbstractCommunicationManager implements JsonPaintTarget paintTarget = new JsonPaintTarget(this, outWriter, !repaintAll); - OpenWindowCache windowCache = currentlyOpenWindowsInClient.get(Integer - .valueOf(root.getRootId())); - if (windowCache == null) { - windowCache = new OpenWindowCache(); - currentlyOpenWindowsInClient.put(Integer.valueOf(root.getRootId()), - windowCache); - } + ClientCache clientCache = getClientCache(root); // TODO These seem unnecessary and could be removed/replaced by looping // through paintQueue without removing paintables from it @@ -1130,7 +1124,7 @@ public abstract class AbstractCommunicationManager implements .getUsedPaintableTypes(); boolean typeMappingsOpen = false; for (Class<? extends Paintable> class1 : usedPaintableTypes) { - if (windowCache.cache(class1)) { + if (clientCache.cache(class1)) { // client does not know the mapping key for this type, send // mapping to client if (!typeMappingsOpen) { @@ -1158,6 +1152,16 @@ public abstract class AbstractCommunicationManager implements } } + private ClientCache getClientCache(Root root) { + Integer rootId = Integer.valueOf(root.getRootId()); + ClientCache cache = rootToClientCache.get(rootId); + if (cache == null) { + cache = new ClientCache(); + rootToClientCache.put(rootId, cache); + } + return cache; + } + private boolean isVisible(Component child) { HasComponents parent = child.getParent(); if (parent == null || !child.isVisible()) { @@ -1269,11 +1273,7 @@ public abstract class AbstractCommunicationManager implements } } // clean WindowCache - OpenWindowCache openWindowCache = currentlyOpenWindowsInClient - .get(Integer.valueOf(root.getRootId())); - if (openWindowCache != null) { - openWindowCache.clear(); - } + getClientCache(root).clear(); } /** @@ -2191,7 +2191,7 @@ public abstract class AbstractCommunicationManager implements * * TODO make customlayout templates (from theme) to be cached here. */ - class OpenWindowCache implements Serializable { + class ClientCache implements Serializable { private final Set<Object> res = new HashSet<Object>(); |