From c11f2767818e803a0f93e50b3ef0aefa45bbd465 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 16 Mar 2012 20:17:33 +0200 Subject: [PATCH] repaintRequestListenersNotified and "cached" are no longer needed --- src/com/vaadin/terminal/PaintTarget.java | 5 -- .../terminal/gwt/server/JsonPaintTarget.java | 3 + src/com/vaadin/ui/AbstractComponent.java | 55 +++++++------------ src/com/vaadin/ui/DirtyConnectorTracker.java | 23 ++++++-- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/com/vaadin/terminal/PaintTarget.java b/src/com/vaadin/terminal/PaintTarget.java index f5de7bf136..1e0fab7b54 100644 --- a/src/com/vaadin/terminal/PaintTarget.java +++ b/src/com/vaadin/terminal/PaintTarget.java @@ -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 diff --git a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java index 930a5bec34..aaca43e6e9 100644 --- a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java +++ b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java @@ -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: '" diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java index c4bfa9298e..2c5dfbe6f3 100644 --- a/src/com/vaadin/ui/AbstractComponent.java +++ b/src/com/vaadin/ui/AbstractComponent.java @@ -100,11 +100,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource */ private LinkedList 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 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(); - } - 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(); + } + 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); } } diff --git a/src/com/vaadin/ui/DirtyConnectorTracker.java b/src/com/vaadin/ui/DirtyConnectorTracker.java index 2e844e096d..dc9c72ba0d 100644 --- a/src/com/vaadin/ui/DirtyConnectorTracker.java +++ b/src/com/vaadin/ui/DirtyConnectorTracker.java @@ -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 dirtyComponents = new HashSet(); 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) { -- 2.39.5