Browse Source

repaintRequestListenersNotified and "cached" are no longer needed

tags/7.0.0.alpha2
Artur Signell 12 years ago
parent
commit
c11f276781

+ 0
- 5
src/com/vaadin/terminal/PaintTarget.java View 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

+ 3
- 0
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java View 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: '"

+ 21
- 34
src/com/vaadin/ui/AbstractComponent.java View 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);
}
}


+ 19
- 4
src/com/vaadin/ui/DirtyConnectorTracker.java View 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) {

Loading…
Cancel
Save