]> source.dussan.org Git - vaadin-framework.git/commitdiff
repaintRequestListenersNotified and "cached" are no longer needed
authorArtur Signell <artur@vaadin.com>
Fri, 16 Mar 2012 18:17:33 +0000 (20:17 +0200)
committerArtur Signell <artur@vaadin.com>
Wed, 21 Mar 2012 13:27:34 +0000 (15:27 +0200)
src/com/vaadin/terminal/PaintTarget.java
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
src/com/vaadin/ui/AbstractComponent.java
src/com/vaadin/ui/DirtyConnectorTracker.java

index f5de7bf136b12c3e2d05ec0ffdcb77caaaf04dff..1e0fab7b548ef589e6adb6abfb1c7c2f97652817 100644 (file)
@@ -48,11 +48,6 @@ public interface PaintTarget extends Serializable {
          * be called.
          */
         PAINTING,
-        /**
-         * Paintable is cached on the client side and unmodified - only an
-         * indication of that should be painted.
-         */
-        CACHED,
         /**
          * A previously unpainted or painted {@link Paintable} has been queued
          * be created/update later in a separate change in the same set of
index 930a5bec34b463d4b6bc8b20f3a3dfc3af9ca44f..aaca43e6e98c5e346c9ccd4d129ee46a060962ae 100644 (file)
@@ -722,6 +722,9 @@ public class JsonPaintTarget implements PaintTarget {
     }
 
     public void endPaintable(Paintable paintable) throws PaintException {
+        System.out.println("endPaintable for " + paintable.getClass().getName()
+                + "@" + Integer.toHexString(paintable.hashCode()));
+
         Paintable openPaintable = openPaintables.peek();
         if (paintable != openPaintable) {
             throw new PaintException("Invalid UIDL: closing wrong paintable: '"
index c4bfa9298ea08f6b0246900e7834209bc2429a33..2c5dfbe6f32bcc0612fa25ab36723ec81e4448cd 100644 (file)
@@ -100,11 +100,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      */
     private LinkedList<RepaintRequestListener> repaintRequestListeners = null;
 
-    /**
-     * Are all the repaint listeners notified about recent changes ?
-     */
-    private boolean repaintRequestListenersNotified = false;
-
     private String testingId;
 
     /* Sizeable fields */
@@ -726,9 +721,10 @@ public abstract class AbstractComponent implements Component, MethodEventSource
 
     /* Component painting */
 
-    /* Documented in super interface */
+    @Deprecated
     public void requestRepaintRequests() {
-        repaintRequestListenersNotified = false;
+        // This is no longer needed. Remove when Component no longer extends
+        // Paintable
     }
 
     /**
@@ -763,10 +759,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
             // nothing to do but flag as deferred and close the paintable tag
             // paint() will be called again later to paint the contents
             target.addAttribute("deferred", true);
-        } else if (PaintStatus.CACHED == status
-                && !repaintRequestListenersNotified) {
-            // Contents have not changed, only cached presentation can be used
-            target.addAttribute("cached", true);
         } else {
             // Paint the contents of the component
 
@@ -790,7 +782,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
         }
         target.endPaintable(this);
 
-        repaintRequestListenersNotified = false;
     }
 
     /**
@@ -938,31 +929,27 @@ public abstract class AbstractComponent implements Component, MethodEventSource
     private void fireRequestRepaintEvent(
             Collection<RepaintRequestListener> alreadyNotified) {
         // Notify listeners only once
-        if (!repaintRequestListenersNotified) {
-            // Notify the listeners
-            if (repaintRequestListeners != null
-                    && !repaintRequestListeners.isEmpty()) {
-                final Object[] listeners = repaintRequestListeners.toArray();
-                final RepaintRequestEvent event = new RepaintRequestEvent(this);
-                for (int i = 0; i < listeners.length; i++) {
-                    if (alreadyNotified == null) {
-                        alreadyNotified = new LinkedList<RepaintRequestListener>();
-                    }
-                    if (!alreadyNotified.contains(listeners[i])) {
-                        ((RepaintRequestListener) listeners[i])
-                                .repaintRequested(event);
-                        alreadyNotified
-                                .add((RepaintRequestListener) listeners[i]);
-                        repaintRequestListenersNotified = true;
-                    }
+        // Notify the listeners
+        if (repaintRequestListeners != null
+                && !repaintRequestListeners.isEmpty()) {
+            final Object[] listeners = repaintRequestListeners.toArray();
+            final RepaintRequestEvent event = new RepaintRequestEvent(this);
+            for (int i = 0; i < listeners.length; i++) {
+                if (alreadyNotified == null) {
+                    alreadyNotified = new LinkedList<RepaintRequestListener>();
+                }
+                if (!alreadyNotified.contains(listeners[i])) {
+                    ((RepaintRequestListener) listeners[i])
+                            .repaintRequested(event);
+                    alreadyNotified.add((RepaintRequestListener) listeners[i]);
                 }
             }
+        }
 
-            // Notify the parent
-            final Component parent = getParent();
-            if (parent != null) {
-                parent.childRequestedRepaint(alreadyNotified);
-            }
+        // Notify the parent
+        final Component parent = getParent();
+        if (parent != null) {
+            parent.childRequestedRepaint(alreadyNotified);
         }
     }
 
index 2e844e096dabce3d351622b2db2faaa5b8dc89cd..dc9c72ba0defc4550d9090b79d223c1b9f96b001 100644 (file)
@@ -7,11 +7,29 @@ import java.util.logging.Logger;
 
 import com.vaadin.terminal.Paintable.RepaintRequestEvent;
 import com.vaadin.terminal.Paintable.RepaintRequestListener;
-
+import com.vaadin.terminal.gwt.server.ClientConnector;
+
+/**
+ * A class that tracks dirty {@link ClientConnector}s. A {@link ClientConnector}
+ * is dirty when an operation has been performed on it on the server and as a
+ * result of this operation new information needs to be sent to its client side
+ * counterpart.
+ * 
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0.0
+ * 
+ */
 public class DirtyConnectorTracker implements RepaintRequestListener {
     private Set<Component> dirtyComponents = new HashSet<Component>();
     private Root root;
 
+    /**
+     * Gets a logger for this class
+     * 
+     * @return A logger instance for logging within this class
+     * 
+     */
     public static Logger getLogger() {
         return Logger.getLogger(DirtyConnectorTracker.class.getName());
     }
@@ -49,9 +67,6 @@ public class DirtyConnectorTracker implements RepaintRequestListener {
         }
         dirtyComponents.remove(component);
 
-        // TODO .... WTF ....
-        component.requestRepaintRequests();
-
     }
 
     private String getDebugInfo(Component component) {