aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-02-19 11:04:55 +0200
committerVaadin Code Review <review@vaadin.com>2013-02-19 14:39:37 +0000
commit9da1979af798324cbe1eea2b6adde0886774f73b (patch)
tree5bcb8f1e3c652945b703cc57f966e3286ef797e4 /client
parent28c6623948ab503a1bf53973dbe567ee9d79eeca (diff)
downloadvaadin-framework-9da1979af798324cbe1eea2b6adde0886774f73b.tar.gz
vaadin-framework-9da1979af798324cbe1eea2b6adde0886774f73b.zip
Properly detach old connectors for repaintAll response (#11067)
Change-Id: I6491a9b30ea4c0e4ff141497b9bd78e5d1c4c98c
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java36
1 files changed, 32 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 3157bd0685..8ecc90bdd5 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -1395,15 +1395,12 @@ public class ApplicationConnection {
Profiler.leave("Handling locales");
Profiler.enter("Handling meta information");
- boolean repaintAll = false;
ValueMap meta = null;
if (json.containsKey("meta")) {
VConsole.log(" * Handling meta information");
meta = json.getValueMap("meta");
if (meta.containsKey("repaintAll")) {
- repaintAll = true;
- uIConnector.getWidget().clear();
- getConnectorMap().clear();
+ prepareRepaintAll();
if (meta.containsKey("invalidLayouts")) {
validatingLayouts = true;
}
@@ -1532,6 +1529,37 @@ public class ApplicationConnection {
}
+ /**
+ * Properly clean up any old stuff to ensure everything is properly
+ * reinitialized.
+ */
+ private void prepareRepaintAll() {
+ String uiConnectorId = uIConnector.getConnectorId();
+ if (uiConnectorId == null) {
+ // Nothing to clear yet
+ return;
+ }
+
+ // Create fake server response that says that the uiConnector
+ // has no children
+ JSONObject fakeHierarchy = new JSONObject();
+ fakeHierarchy.put(uiConnectorId, new JSONArray());
+ JSONObject fakeJson = new JSONObject();
+ fakeJson.put("hierarchy", fakeHierarchy);
+ ValueMap fakeValueMap = fakeJson.getJavaScriptObject().cast();
+
+ // Update hierarchy based on the fake response
+ ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(fakeValueMap);
+
+ // Send hierarchy events based on the fake update
+ sendHierarchyChangeEvents(connectorHierarchyUpdateResult.events);
+
+ // Unregister all the old connectors that have now been removed
+ unregisterRemovedConnectors();
+
+ getLayoutManager().cleanMeasuredSizes();
+ }
+
private void updateCaptions(
Collection<StateChangeEvent> pendingStateChangeEvents,
Collection<ServerConnector> parentChanged) {