From ea1c43b087b92bba0a5e97e803feb9671996aebd Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Mon, 27 Aug 2012 18:10:28 +0300 Subject: Discard reference state for invisible connectors (#9400) --- .../gwt/server/AbstractCommunicationManager.java | 2 +- server/src/com/vaadin/ui/ConnectorTracker.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'server/src/com') diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 64a6e76e7e..81c497713b 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -1415,7 +1415,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @return true if the connector is visible to the client, * false otherwise */ - static boolean isVisible(ClientConnector connector) { + public static boolean isVisible(ClientConnector connector) { if (connector instanceof Component) { return isVisible((Component) connector); } else { diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index ad5990137c..b44189f838 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -26,6 +26,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.vaadin.terminal.AbstractClientConnector; +import com.vaadin.terminal.gwt.server.AbstractCommunicationManager; import com.vaadin.terminal.gwt.server.ClientConnector; /** @@ -69,8 +70,8 @@ public class ConnectorTracker implements Serializable { /** * Creates a new ConnectorTracker for the given uI. A tracker is always - * attached to a uI and the uI cannot be changed during the lifetime of - * a {@link ConnectorTracker}. + * attached to a uI and the uI cannot be changed during the lifetime of a + * {@link ConnectorTracker}. * * @param uI * The uI to attach to. Cannot be null. @@ -226,6 +227,14 @@ public class ConnectorTracker implements Serializable { uninitializedConnectors.remove(connector); diffStates.remove(connector); iterator.remove(); + } else if (!AbstractCommunicationManager.isVisible(connector) + && !uninitializedConnectors.contains(connector)) { + uninitializedConnectors.add(connector); + diffStates.remove(connector); + getLogger().fine( + "cleanConnectorMap removed state for " + + getConnectorAndParentInfo(connector) + + " as it is not visible"); } } @@ -236,8 +245,8 @@ public class ConnectorTracker implements Serializable { * * @param connector * The connector to lookup - * @return The uI the connector is attached to or null if it is not - * attached to any uI. + * @return The uI the connector is attached to or null if it is not attached + * to any uI. */ private UI getUIForConnector(ClientConnector connector) { if (connector == null) { -- cgit v1.2.3