]> source.dussan.org Git - vaadin-framework.git/commitdiff
Discard reference state for invisible connectors (#9400)
authorLeif Åstrand <leif@vaadin.com>
Mon, 27 Aug 2012 15:10:28 +0000 (18:10 +0300)
committerLeif Åstrand <leif@vaadin.com>
Mon, 27 Aug 2012 15:11:58 +0000 (18:11 +0300)
server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
server/src/com/vaadin/ui/ConnectorTracker.java

index 64a6e76e7ecfcdddbc35d65ba3fed0b422daba9e..81c497713b8e037c6b69e087ab9fbc9d88c63848 100644 (file)
@@ -1415,7 +1415,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
      * @return <code>true</code> if the connector is visible to the client,
      *         <code>false</code> otherwise
      */
-    static boolean isVisible(ClientConnector connector) {
+    public static boolean isVisible(ClientConnector connector) {
         if (connector instanceof Component) {
             return isVisible((Component) connector);
         } else {
index ad5990137ce5bb7d43371bf9e6062c8087442c77..b44189f838c3504308874bc200c573e28ef98bf8 100644 (file)
@@ -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
-     * {@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) {