summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-08-01 12:39:06 +0000
committerJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-08-01 12:39:06 +0000
commit6e497d11b86421e90a15072aad68d9b5537b98f6 (patch)
treeeab5039fe23707c23ad476bb5e9700181dc0ecf2
parentb3347b132a9280613f7eb110c969527bf2837c42 (diff)
downloadvaadin-framework-6e497d11b86421e90a15072aad68d9b5537b98f6.tar.gz
vaadin-framework-6e497d11b86421e90a15072aad68d9b5537b98f6.zip
Implemented review comments for #6766
svn changeset:20063/svn branch:6.7
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java52
-rw-r--r--src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java14
2 files changed, 28 insertions, 38 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index 3a8ff9096f..d43ee32884 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -682,14 +682,15 @@ public abstract class AbstractCommunicationManager implements
requestThemeName = request.getParameter("theme");
maxInactiveInterval = request.getSession().getMaxInactiveInterval();
// repaint requested or session has timed out and new one is created
+ boolean repaintAll;
final OutputStream out;
- setRepaintAll(request.getParameter(GET_PARAM_REPAINT_ALL) != null);
+ repaintAll = (request.getParameter(GET_PARAM_REPAINT_ALL) != null);
// || (request.getSession().isNew()); FIXME What the h*ll is this??
out = response.getOutputStream();
boolean analyzeLayouts = false;
- if (isRepaintAll()) {
+ if (repaintAll) {
// analyzing can be done only with repaintAll
analyzeLayouts = (request.getParameter(GET_PARAM_ANALYZE_LAYOUTS) != null);
}
@@ -747,11 +748,11 @@ public abstract class AbstractCommunicationManager implements
}
}
// No message to show, let's just repaint all.
- setRepaintAll(true);
+ repaintAll = true;
}
- paintAfterVariableChanges(request, response, callback, outWriter,
- window, analyzeLayouts);
+ paintAfterVariableChanges(request, response, callback, repaintAll,
+ outWriter, window, analyzeLayouts);
if (closingWindowName != null) {
currentlyOpenWindowsInClient.remove(closingWindowName);
@@ -769,6 +770,7 @@ public abstract class AbstractCommunicationManager implements
* @param request
* @param response
* @param callback
+ * @param repaintAll
* @param outWriter
* @param window
* @param analyzeLayouts
@@ -776,10 +778,11 @@ public abstract class AbstractCommunicationManager implements
* @throws IOException
*/
private void paintAfterVariableChanges(Request request, Response response,
- Callback callback, final PrintWriter outWriter, Window window,
- boolean analyzeLayouts) throws PaintException, IOException {
+ Callback callback, boolean repaintAll, final PrintWriter outWriter,
+ Window window, boolean analyzeLayouts) throws PaintException,
+ IOException {
- if (isRepaintAll()) {
+ if (repaintAll) {
makeAllPaintablesDirty(window);
}
@@ -819,10 +822,11 @@ public abstract class AbstractCommunicationManager implements
application, window);
if (newWindow != window) {
window = newWindow;
- setRepaintAll(true);
+ repaintAll = true;
}
- writeUidlResponse(callback, outWriter, window, analyzeLayouts);
+ writeUidlResponse(callback, repaintAll, outWriter, window,
+ analyzeLayouts);
}
closeJsonMessage(outWriter);
@@ -831,7 +835,7 @@ public abstract class AbstractCommunicationManager implements
}
- public void writeUidlResponse(Callback callback,
+ public void writeUidlResponse(Callback callback, boolean repaintAll,
final PrintWriter outWriter, Window window, boolean analyzeLayouts)
throws PaintException {
outWriter.print("\"changes\":[");
@@ -841,7 +845,7 @@ public abstract class AbstractCommunicationManager implements
List<InvalidLayout> invalidComponentRelativeSizes = null;
JsonPaintTarget paintTarget = new JsonPaintTarget(this, outWriter,
- !isRepaintAll());
+ repaintAll);
OpenWindowCache windowCache = currentlyOpenWindowsInClient.get(window
.getName());
if (windowCache == null) {
@@ -850,7 +854,7 @@ public abstract class AbstractCommunicationManager implements
}
// Paints components
- if (isRepaintAll()) {
+ if (repaintAll) {
paintables = new ArrayList<Paintable>();
paintables.add(window);
@@ -965,7 +969,7 @@ public abstract class AbstractCommunicationManager implements
outWriter.print(", \"meta\" : {");
boolean metaOpen = false;
- if (isRepaintAll()) {
+ if (repaintAll) {
metaOpen = true;
outWriter.write("\"repaintAll\":true");
if (analyzeLayouts) {
@@ -1011,7 +1015,7 @@ public abstract class AbstractCommunicationManager implements
&& ci.getSessionExpiredCaption() == null
&& ci.isSessionExpiredNotificationEnabled()) {
int newTimeoutInterval = getTimeoutInterval();
- if (isRepaintAll() || (timeoutInterval != newTimeoutInterval)) {
+ if (repaintAll || (timeoutInterval != newTimeoutInterval)) {
String escapedURL = ci.getSessionExpiredURL() == null ? "" : ci
.getSessionExpiredURL().replace("/", "\\/");
if (metaOpen) {
@@ -1102,7 +1106,6 @@ public abstract class AbstractCommunicationManager implements
if (dragAndDropService != null) {
dragAndDropService.printJSONResponse(outWriter);
}
- setRepaintAll(false);
}
private int getTimeoutInterval() {
@@ -1215,9 +1218,8 @@ public abstract class AbstractCommunicationManager implements
final PrintWriter outWriter = new PrintWriter(
new CharArrayWriter());
- setRepaintAll(true);
paintAfterVariableChanges(request, response, callback,
- outWriter, window, false);
+ true, outWriter, window, false);
}
@@ -2119,8 +2121,6 @@ public abstract class AbstractCommunicationManager implements
private final HashMap<Class<? extends Paintable>, Integer> typeToKey = new HashMap<Class<? extends Paintable>, Integer>();
private int nextTypeKey = 0;
- private boolean repaintAll = false;
-
String getTagForType(Class<? extends Paintable> class1) {
Integer object = typeToKey.get(class1);
if (object == null) {
@@ -2310,16 +2310,4 @@ public abstract class AbstractCommunicationManager implements
return b;
}
}
-
- private void setRepaintAll(boolean repaintAll) {
- this.repaintAll = repaintAll;
- }
-
- /**
- * @return true if a RepaintAll has been requested. E.g. by refreshing the
- * browser window or such.
- */
- public boolean isRepaintAll() {
- return repaintAll;
- }
}
diff --git a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
index da7f838bda..cd31d4bbca 100644
--- a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
+++ b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
@@ -79,7 +79,7 @@ public class JsonPaintTarget implements PaintTarget {
private int errorsOpen;
- private boolean cacheEnabled = false;
+ private boolean fullRepaint = false;
private final Collection<Paintable> paintedComponents = new HashSet<Paintable>();
@@ -94,12 +94,14 @@ public class JsonPaintTarget implements PaintTarget {
* @param manager
* @param outWriter
* A character-output stream.
+ * @param fullRepaint
+ * true if this is a full repaint, i.e. caches are to be
+ * bypassed.
* @throws PaintException
* if the paint operation failed.
*/
public JsonPaintTarget(AbstractCommunicationManager manager,
- PrintWriter outWriter, boolean cachingRequired)
- throws PaintException {
+ PrintWriter outWriter, boolean fullRepaint) throws PaintException {
this.manager = manager;
@@ -109,7 +111,7 @@ public class JsonPaintTarget implements PaintTarget {
// Initialize tag-writing
mOpenTags = new Stack<String>();
openJsonTags = new Stack<JsonTag>();
- cacheEnabled = cachingRequired;
+ this.fullRepaint = fullRepaint;
}
public void startTag(String tagName) throws PaintException {
@@ -684,7 +686,7 @@ public class JsonPaintTarget implements PaintTarget {
customLayoutArgumentsOpen = true;
}
- return cacheEnabled && isPreviouslyPainted;
+ return !fullRepaint && isPreviouslyPainted;
}
@Deprecated
@@ -1117,7 +1119,7 @@ public class JsonPaintTarget implements PaintTarget {
* @see com.vaadin.terminal.PaintTarget#isFullRepaint()
*/
public boolean isFullRepaint() {
- return manager.isRepaintAll();
+ return fullRepaint;
}
}