summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin')
-rw-r--r--server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java7
-rw-r--r--server/src/com/vaadin/ui/ConnectorTracker.java41
2 files changed, 45 insertions, 3 deletions
diff --git a/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java b/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java
index fe1cc0770c..16ed9985c4 100644
--- a/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java
+++ b/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java
@@ -91,16 +91,19 @@ public class ConnectorHierarchyWriter implements Serializable {
}
// Dummy assert just for conditionally storing away data that will be
// used by the real assert later on
- assert storeSentHierarchy(hierarchyInfo);
+ assert storeSentHierarchy(hierarchyInfo, stateUpdateConnectors);
writer.write(JsonUtil.stringify(hierarchyInfo));
}
- private boolean storeSentHierarchy(JsonObject hierarchyInfo) {
+ private boolean storeSentHierarchy(JsonObject hierarchyInfo,
+ Set<String> stateUpdateConnectors) {
VaadinRequest request = VaadinService.getCurrentRequest();
if (request != null) {
request.setAttribute(ConnectorHierarchyWriter.class.getName()
+ ".hierarchyInfo", hierarchyInfo);
+ request.setAttribute(ConnectorHierarchyWriter.class.getName()
+ + ".stateUpdateConnectors", stateUpdateConnectors);
}
// Always true, we're just setting up for another assert
diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java
index a060702319..159bd09c0d 100644
--- a/server/src/com/vaadin/ui/ConnectorTracker.java
+++ b/server/src/com/vaadin/ui/ConnectorTracker.java
@@ -368,7 +368,34 @@ public class ConnectorTracker implements Serializable {
}
if (!hierachyInfo.hasKey(firstVisibleParent.getConnectorId())) {
- return false;
+ /*
+ * No hierarchy change about to be sent, but this might be
+ * because of an optimization that omits explicit hierarchy
+ * changes for empty connectors that have state changes.
+ */
+ if (hasVisibleChild(firstVisibleParent)) {
+ // Not the optimization case if the parent has visible
+ // children
+ return false;
+ }
+
+ attributeName = ConnectorHierarchyWriter.class.getName()
+ + ".stateUpdateConnectors";
+ Object stateUpdateConnectorsObj = request
+ .getAttribute(attributeName);
+ if (stateUpdateConnectorsObj instanceof Set<?>) {
+ Set<?> stateUpdateConnectors = (Set<?>) stateUpdateConnectorsObj;
+ if (!stateUpdateConnectors.contains(firstVisibleParent
+ .getConnectorId())) {
+ // Not the optimization case if the parent is not marked
+ // as dirty
+ return false;
+ }
+ } else {
+ getLogger().warning(
+ "Request attribute " + attributeName
+ + " is not a Set");
+ }
}
} else {
getLogger().warning(
@@ -379,6 +406,18 @@ public class ConnectorTracker implements Serializable {
return true;
}
+ private static boolean hasVisibleChild(ClientConnector parent) {
+ Iterator<? extends ClientConnector> iterator = AbstractClientConnector
+ .getAllChildrenIterable(parent).iterator();
+ while (iterator.hasNext()) {
+ ClientConnector child = iterator.next();
+ if (LegacyCommunicationManager.isConnectorVisibleToClient(child)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private ClientConnector findFirstVisibleParent(ClientConnector connector) {
while (connector != null) {
connector = connector.getParent();