diff options
author | Artur Signell <artur@vaadin.com> | 2013-08-19 12:34:29 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-08-19 12:34:29 +0300 |
commit | 65b262cd6947f893e4c554efeb7ae2bf0f617bfc (patch) | |
tree | f4d529baf4bc78da337d4c171e49820606dc504a /server | |
parent | 84651fdb6fc695e3d0752a75f7478577ad8a0063 (diff) | |
parent | 421922705b6e5bd2abf6a11d83f5b4a4791f968a (diff) | |
download | vaadin-framework-65b262cd6947f893e4c554efeb7ae2bf0f617bfc.tar.gz vaadin-framework-65b262cd6947f893e4c554efeb7ae2bf0f617bfc.zip |
Merge changes from origin/7.1
a53d487 Verify the connector hierarchy if assertions are enabled (#12271)
e9f3fcc Fix issue with hidden component cells in Table and TreeTable #12119
cbab936 Fixes light theme window sprites #12171
938d412 Fixes button :active state on firefox #12126
4219227 Fixed wrong classname in WindowThemes TB test #12171
Change-Id: I09bdb2fd0d16acad2afd84c544b26223d5f603a1
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/ConnectorTracker.java | 50 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/Table.java | 5 |
2 files changed, 54 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index c2aeebcd44..0f8ec60104 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -271,6 +272,12 @@ public class ConnectorTracker implements Serializable { } unregisteredConnectors.clear(); + // Do this expensive check only with assertions enabled + assert isHierarchyComplete() : "The connector hierarchy is corrupted. " + + "Check for missing calls to super.setParent(), super.attach() and super.detach() " + + "and that all custom component containers call child.setParent(this) when a child is added and child.setParent(null) when the child is no longer used. " + + "See previous log messages for details."; + // remove detached components from paintableIdMap so they // can be GC'ed Iterator<String> iterator = connectorIdToConnector.keySet().iterator(); @@ -313,6 +320,49 @@ public class ConnectorTracker implements Serializable { cleanStreamVariables(); } + private boolean isHierarchyComplete() { + boolean noErrors = true; + + Set<ClientConnector> danglingConnectors = new HashSet<ClientConnector>( + connectorIdToConnector.values()); + + LinkedList<ClientConnector> stack = new LinkedList<ClientConnector>(); + stack.add(uI); + while (!stack.isEmpty()) { + ClientConnector connector = stack.pop(); + danglingConnectors.remove(connector); + + Iterable<ClientConnector> children = AbstractClientConnector + .getAllChildrenIterable(connector); + for (ClientConnector child : children) { + stack.add(child); + + if (child.getParent() != connector) { + noErrors = false; + getLogger() + .log(Level.WARNING, + "{0} claims that {1} is its child, but the child claims {2} is its parent.", + new Object[] { + getConnectorString(connector), + getConnectorString(child), + getConnectorString(child + .getParent()) }); + } + } + } + + for (ClientConnector dangling : danglingConnectors) { + noErrors = false; + getLogger() + .log(Level.WARNING, + "{0} claims that {1} is its parent, but the parent does not acknowledge the parenthood.", + new Object[] { getConnectorString(dangling), + getConnectorString(dangling.getParent()) }); + } + + return noErrors; + } + /** * Finds the uI that the connector is attached to. * diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 5dbf927658..3507e6b0a5 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -54,6 +54,7 @@ import com.vaadin.event.dd.DropHandler; import com.vaadin.event.dd.DropTarget; import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion; import com.vaadin.server.KeyMapper; +import com.vaadin.server.LegacyCommunicationManager; import com.vaadin.server.LegacyPaint; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; @@ -3784,7 +3785,9 @@ public class Table extends AbstractSelect implements Action.Container, + currentColumn][indexInRowbuffer])) { final Component c = (Component) cells[CELL_FIRSTCOL + currentColumn][indexInRowbuffer]; - if (c == null) { + if (c == null + || !LegacyCommunicationManager + .isComponentVisibleToClient(c)) { target.addText(""); } else { LegacyPaint.paint(c, target); |