From: Artur Signell
Date: Wed, 11 Apr 2012 08:08:12 +0000 (+0300)
Subject: Component no longer implements Paintable
X-Git-Tag: 7.0.0.alpha2~87
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=496a0c003995f3f29c2bd1f3bbcc3fb77a9d859f;p=vaadin-framework.git
Component no longer implements Paintable
---
diff --git a/src/com/vaadin/event/ActionManager.java b/src/com/vaadin/event/ActionManager.java
index f362eb6c0a..08e9c85043 100644
--- a/src/com/vaadin/event/ActionManager.java
+++ b/src/com/vaadin/event/ActionManager.java
@@ -11,6 +11,7 @@ import com.vaadin.event.Action.Handler;
import com.vaadin.terminal.KeyMapper;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.VariableOwner;
import com.vaadin.ui.Component;
/**
@@ -47,7 +48,8 @@ public class ActionManager implements Action.Container, Action.Handler,
}
- public ActionManager(T viewer) {
+ public ActionManager(
+ T viewer) {
this.viewer = viewer;
}
@@ -57,7 +59,8 @@ public class ActionManager implements Action.Container, Action.Handler,
}
}
- public void setViewer(T viewer) {
+ public void setViewer(
+ T viewer) {
if (viewer == this.viewer) {
return;
}
@@ -153,7 +156,7 @@ public class ActionManager implements Action.Container, Action.Handler,
if (!actions.isEmpty() || clientHasActions) {
actionMapper = new KeyMapper();
- paintTarget.addVariable(viewer, "action", "");
+ paintTarget.addVariable((VariableOwner) viewer, "action", "");
paintTarget.startTag("actions");
for (final Action a : actions) {
diff --git a/src/com/vaadin/terminal/LegacyPaint.java b/src/com/vaadin/terminal/LegacyPaint.java
new file mode 100644
index 0000000000..692c05c5f6
--- /dev/null
+++ b/src/com/vaadin/terminal/LegacyPaint.java
@@ -0,0 +1,80 @@
+package com.vaadin.terminal;
+
+import com.vaadin.terminal.PaintTarget.PaintStatus;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HasComponents;
+
+public class LegacyPaint {
+ /**
+ *
+ *
+ * Paints the Paintable into a UIDL stream. This method creates the UIDL
+ * sequence describing it and outputs it to the given UIDL stream.
+ *
+ *
+ *
+ * It is called when the contents of the component should be painted in
+ * response to the component first being shown or having been altered so
+ * that its visual representation is changed.
+ *
+ *
+ *
+ * Do not override this to paint your component. Override
+ * {@link #paintContent(PaintTarget)} instead.
+ *
+ *
+ *
+ * @param target
+ * the target UIDL stream where the component should paint itself
+ * to.
+ * @throws PaintException
+ * if the paint operation failed.
+ */
+ public static void paint(Component component, PaintTarget target)
+ throws PaintException {
+ // Only paint content of visible components.
+ if (!isVisibleInContext(component)) {
+ return;
+ }
+
+ final String tag = target.getTag(component);
+ final PaintStatus status = target.startPaintable(component, tag);
+ if (PaintStatus.CACHED == status) {
+ // nothing to do but flag as cached and close the paintable tag
+ target.addAttribute("cached", true);
+ } else {
+ // Paint the contents of the component
+ if (component instanceof Vaadin6Component) {
+ ((Vaadin6Component) component).paintContent(target);
+ }
+
+ }
+ target.endPaintable(component);
+
+ }
+
+ /**
+ * Checks if the component is visible and its parent is visible,
+ * recursively.
+ *
+ * This is only a helper until paint is moved away from this class.
+ *
+ * @return
+ */
+ protected static boolean isVisibleInContext(Component c) {
+ HasComponents p = c.getParent();
+ while (p != null) {
+ if (!p.isVisible()) {
+ return false;
+ }
+ p = p.getParent();
+ }
+ if (c.getParent() != null && !c.getParent().isComponentVisible(c)) {
+ return false;
+ }
+
+ // All parents visible, return this state
+ return c.isVisible();
+ }
+
+}
diff --git a/src/com/vaadin/terminal/PaintTarget.java b/src/com/vaadin/terminal/PaintTarget.java
index 57dd711ba5..9cfa324133 100644
--- a/src/com/vaadin/terminal/PaintTarget.java
+++ b/src/com/vaadin/terminal/PaintTarget.java
@@ -9,6 +9,7 @@ import java.util.Map;
import com.vaadin.terminal.StreamVariable.StreamingStartEvent;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.server.ClientConnector;
/**
* This interface defines the methods for painting XML to the UIDL stream.
@@ -38,7 +39,7 @@ public interface PaintTarget extends Serializable {
/**
* Result of starting to paint a Paintable (
- * {@link PaintTarget#startPaintable(Paintable, String)}).
+ * {@link PaintTarget#startPaintable(ClientConnector, String)}).
*
* @since 7.0
*/
@@ -72,8 +73,8 @@ public interface PaintTarget extends Serializable {
*
*
* Each paintable being painted should be closed by a matching
- * {@link #endPaintable(Paintable)} regardless of the {@link PaintStatus}
- * returned.
+ * {@link #endPaintable(ClientConnector)} regardless of the
+ * {@link PaintStatus} returned.
*
*
* @param paintable
@@ -88,15 +89,15 @@ public interface PaintTarget extends Serializable {
* @see #startTag(String)
* @since 7.0 (previously using startTag(Paintable, String))
*/
- public PaintStatus startPaintable(Paintable paintable, String tag)
+ public PaintStatus startPaintable(ClientConnector paintable, String tag)
throws PaintException;
/**
* Prints paintable element end tag.
*
- * Calls to {@link #startPaintable(Paintable, String)} should be matched by
- * {@link #endPaintable(Paintable)}. If the parent tag is closed before
- * every child tag is closed a PaintException is raised.
+ * Calls to {@link #startPaintable(ClientConnector, String)}should be
+ * matched by {@link #endPaintable(ClientConnector)}. If the parent tag is
+ * closed before every child tag is closed a PaintException is raised.
*
* @param paintable
* the paintable to close.
@@ -104,7 +105,7 @@ public interface PaintTarget extends Serializable {
* if the paint operation failed.
* @since 7.0 (previously using engTag(String))
*/
- public void endPaintable(Paintable paintable) throws PaintException;
+ public void endPaintable(ClientConnector paintable) throws PaintException;
/**
* Prints element start tag.
@@ -288,7 +289,7 @@ public interface PaintTarget extends Serializable {
* the Paintable to be referenced on client side
* @throws PaintException
*/
- public void addAttribute(String name, Paintable value)
+ public void addAttribute(String name, ClientConnector value)
throws PaintException;
/**
@@ -420,8 +421,8 @@ public interface PaintTarget extends Serializable {
* @throws PaintException
* if the paint oparation fails
*/
- public void addVariable(VariableOwner owner, String name, Paintable value)
- throws PaintException;
+ public void addVariable(VariableOwner owner, String name,
+ ClientConnector value) throws PaintException;
/**
* Adds a upload stream type variable.
@@ -492,14 +493,15 @@ public interface PaintTarget extends Serializable {
/**
* @return the "tag" string used in communication to present given
- * {@link Paintable} type. Terminal may define how to present
- * paintable.
+ * {@link ClientConnector} type. Terminal may define how to present
+ * the connector.
*/
- public String getTag(Paintable paintable);
+ public String getTag(ClientConnector paintable);
/**
* @return true if a full repaint has been requested. E.g. refresh in a
* browser window or such.
*/
public boolean isFullRepaint();
+
}
diff --git a/src/com/vaadin/terminal/Paintable.java b/src/com/vaadin/terminal/Paintable.java
deleted file mode 100644
index d043cb2606..0000000000
--- a/src/com/vaadin/terminal/Paintable.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal;
-
-import java.io.Serializable;
-import java.util.EventObject;
-
-/**
- * Interface implemented by all classes that can be painted. Classes
- * implementing this interface know how to output themselves to a UIDL stream
- * and that way describing to the terminal how it should be displayed in the UI.
- *
- * @author Vaadin Ltd.
- * @version
- * @VERSION@
- * @since 3.0
- */
-public interface Paintable extends java.util.EventListener, Serializable {
-
- /**
- *
- * Paints the Paintable into a UIDL stream. This method creates the UIDL
- * sequence describing it and outputs it to the given UIDL stream.
- *
- *
- *
- * It is called when the contents of the component should be painted in
- * response to the component first being shown or having been altered so
- * that its visual representation is changed.
- *
- *
- * @param target
- * the target UIDL stream where the component should paint itself
- * to.
- * @throws PaintException
- * if the paint operation failed.
- */
- public void paint(PaintTarget target) throws PaintException;
-
- /**
- * Requests that the paintable should be repainted as soon as possible.
- */
- public void requestRepaint();
-
- /**
- * Adds an unique id for component that get's transferred to terminal for
- * testing purposes. Keeping identifiers unique throughout the Application
- * instance is on programmers responsibility.
- *
- * Note, that with the current terminal implementation the identifier cannot
- * be changed while the component is visible. This means that the identifier
- * should be set before the component is painted for the first time and kept
- * the same while visible in the client.
- *
- * @param id
- * A short (< 20 chars) alphanumeric id
- */
- public void setDebugId(String id);
-
- /**
- * Get's currently set debug identifier
- *
- * @return current debug id, null if not set
- */
- public String getDebugId();
-
- /**
- * Repaint request event is thrown when the paintable needs to be repainted.
- * This is typically done when the paint method would return
- * dissimilar UIDL from the previous call of the method.
- */
- @SuppressWarnings("serial")
- public class RepaintRequestEvent extends EventObject {
-
- /**
- * Constructs a new event.
- *
- * @param source
- * the paintable needing repaint.
- */
- public RepaintRequestEvent(Paintable source) {
- super(source);
- }
-
- /**
- * Gets the paintable needing repainting.
- *
- * @return Paintable for which the paint method will return
- * dissimilar UIDL from the previous call of the method.
- */
- public Paintable getPaintable() {
- return (Paintable) getSource();
- }
- }
-
- /**
- * Listens repaint requests. The repaintRequested method is
- * called when the paintable needs to be repainted. This is typically done
- * when the paint method would return dissimilar UIDL from the
- * previous call of the method.
- */
- public interface RepaintRequestListener extends Serializable {
-
- /**
- * Receives repaint request events.
- *
- * @param event
- * the repaint request event specifying the paintable source.
- */
- public void repaintRequested(RepaintRequestEvent event);
- }
-
- /**
- * Adds repaint request listener. In order to assure that no repaint
- * requests are missed, the new repaint listener should paint the paintable
- * right after adding itself as listener.
- *
- * @param listener
- * the listener to be added.
- */
- public void addListener(RepaintRequestListener listener);
-
- /**
- * Removes repaint request listener.
- *
- * @param listener
- * the listener to be removed.
- */
- public void removeListener(RepaintRequestListener listener);
-
- /**
- * Request sending of repaint events on any further visible changes.
- * Normally the paintable only send up to one repaint request for listeners
- * after paint as the paintable as the paintable assumes that the listeners
- * already know about the repaint need. This method resets the assumtion.
- * Paint implicitly does the assumtion reset functionality implemented by
- * this method.
- *
- * This method is normally used only by the terminals to note paintables
- * about implicit repaints (painting the component without actually invoking
- * paint method).
- *
+ * Paints the Paintable into a UIDL stream. This method creates the UIDL
+ * sequence describing it and outputs it to the given UIDL stream.
+ *
+ *
+ *
+ * It is called when the contents of the component should be painted in
+ * response to the component first being shown or having been altered so
+ * that its visual representation is changed.
+ *
+ *
+ * @param target
+ * the target UIDL stream where the component should paint itself
+ * to.
+ * @throws PaintException
+ * if the paint operation failed.
+ */
+ public void paintContent(PaintTarget target) throws PaintException;
+
+}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index 17e504a3bb..25f3154fd2 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -48,15 +48,16 @@ import com.vaadin.external.json.JSONArray;
import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
import com.vaadin.terminal.CombinedRequest;
+import com.vaadin.terminal.LegacyPaint;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.RequestHandler;
import com.vaadin.terminal.StreamVariable;
import com.vaadin.terminal.StreamVariable.StreamingEndEvent;
import com.vaadin.terminal.StreamVariable.StreamingErrorEvent;
import com.vaadin.terminal.Terminal.ErrorEvent;
import com.vaadin.terminal.Terminal.ErrorListener;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.VariableOwner;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.terminal.WrappedResponse;
@@ -81,14 +82,6 @@ import com.vaadin.ui.Window;
* JavaScript) and the server side components. Its client side counterpart is
* {@link ApplicationConnection}.
*
- * A server side component sends its state to the client in a paint request (see
- * {@link Paintable} and {@link PaintTarget} on the server side). The client
- * widget receives these paint requests as calls to
- * {@link com.vaadin.terminal.gwt.client.ComponentConnector#updateFromUIDL()}.
- * The client component communicates back to the server by sending a list of
- * variable changes (see {@link ApplicationConnection#updateVariable()} and
- * {@link VariableOwner#changeVariables(Object, Map)}).
- *
* TODO Document better!
*/
@SuppressWarnings("serial")
@@ -836,8 +829,8 @@ public abstract class AbstractCommunicationManager implements Serializable {
// widget mapping
JSONObject connectorTypes = new JSONObject();
- for (Connector connector : dirtyVisibleConnectors) {
- String connectorType = paintTarget.getTag((Paintable) connector);
+ for (ClientConnector connector : dirtyVisibleConnectors) {
+ String connectorType = paintTarget.getTag(connector);
try {
connectorTypes.put(connector.getConnectorId(), connectorType);
} catch (JSONException e) {
@@ -1105,22 +1098,22 @@ public abstract class AbstractCommunicationManager implements Serializable {
private void legacyPaint(PaintTarget paintTarget,
ArrayList dirtyVisibleConnectors)
throws PaintException {
- List legacyComponents = new ArrayList();
+ List legacyComponents = new ArrayList();
for (Connector connector : dirtyVisibleConnectors) {
- if (connector instanceof Paintable) {
+ if (connector instanceof Vaadin6Component) {
// All legacy Components must be Paintables as Component extends
// Paintable in Vaadin 6
- legacyComponents.add((Component) connector);
+ legacyComponents.add((Vaadin6Component) connector);
}
}
- sortByHierarchy(legacyComponents);
- for (Component c : legacyComponents) {
+ sortByHierarchy((List) legacyComponents);
+ for (Vaadin6Component c : legacyComponents) {
logger.info("Painting legacy Component " + c.getClass().getName()
+ "@" + Integer.toHexString(c.hashCode()));
paintTarget.startTag("change");
final String pid = c.getConnectorId();
paintTarget.addAttribute("pid", pid);
- c.paint(paintTarget);
+ LegacyPaint.paint(c, paintTarget);
paintTarget.endTag("change");
}
diff --git a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
index 78fc4d5fba..0140c0f799 100644
--- a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
+++ b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
@@ -20,7 +20,6 @@ import com.vaadin.terminal.ApplicationResource;
import com.vaadin.terminal.ExternalResource;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.StreamVariable;
import com.vaadin.terminal.ThemeResource;
@@ -55,7 +54,7 @@ public class JsonPaintTarget implements PaintTarget {
private final Stack openJsonTags;
// these match each other element-wise
- private final Stack openPaintables;
+ private final Stack openPaintables;
private final Stack openPaintableTags;
private final PrintWriter uidlBuffer;
@@ -74,8 +73,6 @@ public class JsonPaintTarget implements PaintTarget {
private boolean cacheEnabled = false;
- private final Collection paintedComponents = new HashSet();
-
private final Set> usedClientConnectors = new HashSet>();
/**
@@ -103,7 +100,7 @@ public class JsonPaintTarget implements PaintTarget {
mOpenTags = new Stack();
openJsonTags = new Stack();
- openPaintables = new Stack();
+ openPaintables = new Stack();
openPaintableTags = new Stack();
cacheEnabled = cachingRequired;
@@ -402,9 +399,9 @@ public class JsonPaintTarget implements PaintTarget {
}
- public void addAttribute(String name, Paintable value)
+ public void addAttribute(String name, ClientConnector value)
throws PaintException {
- final String id = getPaintIdentifier(value);
+ final String id = value.getConnectorId();
addAttribute(name, id);
}
@@ -420,9 +417,8 @@ public class JsonPaintTarget implements PaintTarget {
Object key = it.next();
Object mapValue = value.get(key);
sb.append("\"");
- if (key instanceof Paintable) {
- Paintable paintable = (Paintable) key;
- sb.append(getPaintIdentifier(paintable));
+ if (key instanceof ClientConnector) {
+ sb.append(((ClientConnector) key).getConnectorId());
} else {
sb.append(escapeJSON(key.toString()));
}
@@ -471,10 +467,9 @@ public class JsonPaintTarget implements PaintTarget {
tag.addVariable(new StringVariable(owner, name, escapeJSON(value)));
}
- public void addVariable(VariableOwner owner, String name, Paintable value)
- throws PaintException {
- tag.addVariable(new StringVariable(owner, name,
- getPaintIdentifier(value)));
+ public void addVariable(VariableOwner owner, String name,
+ ClientConnector value) throws PaintException {
+ tag.addVariable(new StringVariable(owner, name, value.getConnectorId()));
}
public void addVariable(VariableOwner owner, String name, int value)
@@ -650,19 +645,18 @@ public class JsonPaintTarget implements PaintTarget {
* @see com.vaadin.terminal.PaintTarget#startPaintable(com.vaadin.terminal
* .Paintable, java.lang.String)
*/
- public PaintStatus startPaintable(Paintable paintable, String tagName)
+ public PaintStatus startPaintable(ClientConnector connector, String tagName)
throws PaintException {
boolean topLevelPaintable = openPaintables.isEmpty();
- logger.fine("startPaintable for " + paintable.getClass().getName()
- + "@" + Integer.toHexString(paintable.hashCode()));
+ logger.fine("startPaintable for " + connector.getClass().getName()
+ + "@" + Integer.toHexString(connector.hashCode()));
startTag(tagName, true);
- openPaintables.push(paintable);
+ openPaintables.push(connector);
openPaintableTags.push(tagName);
- final String id = getPaintIdentifier(paintable);
- addAttribute("id", id);
+ addAttribute("id", connector.getConnectorId());
// Only paint top level paintables. All sub paintables are marked as
// queued and painted separately later.
@@ -670,24 +664,21 @@ public class JsonPaintTarget implements PaintTarget {
return PaintStatus.CACHED;
}
- // not a nested paintable, paint the it now
- paintedComponents.add(paintable);
-
- if (paintable instanceof CustomLayout) {
+ if (connector instanceof CustomLayout) {
customLayoutArgumentsOpen = true;
}
return PaintStatus.PAINTING;
}
- public void endPaintable(Paintable paintable) throws PaintException {
+ public void endPaintable(ClientConnector paintable) throws PaintException {
logger.fine("endPaintable for " + paintable.getClass().getName() + "@"
+ Integer.toHexString(paintable.hashCode()));
- Paintable openPaintable = openPaintables.peek();
+ ClientConnector openPaintable = openPaintables.peek();
if (paintable != openPaintable) {
throw new PaintException("Invalid UIDL: closing wrong paintable: '"
- + getPaintIdentifier(paintable) + "' expected: '"
- + getPaintIdentifier(openPaintable) + "'.");
+ + paintable.getConnectorId() + "' expected: '"
+ + openPaintable.getConnectorId() + "'.");
}
// remove paintable from the stack
openPaintables.pop();
@@ -695,15 +686,6 @@ public class JsonPaintTarget implements PaintTarget {
endTag(openTag);
}
- public String getPaintIdentifier(Paintable paintable) throws PaintException {
- // TODO This should be unnecessary as Paintable must be a Connector
- if (paintable instanceof Connector) {
- return ((Connector) paintable).getConnectorId();
- }
- throw new RuntimeException("Paintable " + paintable
- + " must implement Connector");
- }
-
/*
* (non-Javadoc)
*
@@ -979,25 +961,21 @@ public class JsonPaintTarget implements PaintTarget {
}
@SuppressWarnings("unchecked")
- public String getTag(Paintable paintable) {
- if (!(paintable instanceof ClientConnector)) {
- throw new IllegalArgumentException(
- "Tags are only available for ClientConnectors");
- }
- Class extends Paintable> paintableClass = paintable.getClass();
- while (paintableClass.isAnonymousClass()) {
- paintableClass = (Class extends Paintable>) paintableClass
+ public String getTag(ClientConnector clientConnector) {
+ Class extends ClientConnector> clientConnectorClass = clientConnector
+ .getClass();
+ while (clientConnectorClass.isAnonymousClass()) {
+ clientConnectorClass = (Class extends ClientConnector>) clientConnectorClass
.getSuperclass();
}
- Class> clazz = paintableClass;
+ Class> clazz = clientConnectorClass;
while (!usedClientConnectors.contains(clazz)
&& clazz.getSuperclass() != null
&& ClientConnector.class.isAssignableFrom(clazz)) {
usedClientConnectors.add((Class extends ClientConnector>) clazz);
clazz = clazz.getSuperclass();
}
- return manager
- .getTagForType((Class extends ClientConnector>) paintableClass);
+ return manager.getTagForType(clientConnectorClass);
}
Collection> getUsedClientConnectors() {
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java
index d1b554c358..6a0aa0f4c2 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java
@@ -31,7 +31,7 @@ import java.util.logging.Logger;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.event.dd.acceptcriteria.ClientCriterion;
-import com.vaadin.terminal.Paintable;
+import com.vaadin.terminal.gwt.server.ClientConnector;
/**
* Utility class to collect widgetset related information from classpath.
@@ -99,22 +99,20 @@ public class ClassPathExplorer {
* As a side effect, also accept criteria are searched under the same class
* path entries and added into the acceptCriterion collection.
*
- * @return a collection of {@link Paintable} classes
+ * @return a collection of {@link ClientConnector} classes
*/
- public static Collection> getPaintablesHavingWidgetAnnotation() {
- logger.info("Searching for paintables..");
+ public static void findAcceptCriteria() {
+ logger.info("Searching for accept criteria..");
long start = System.currentTimeMillis();
- Collection> paintables = new HashSet>();
Set keySet = classpathLocations.keySet();
for (String url : keySet) {
- logger.fine("Searching for paintables in "
+ logger.fine("Searching for accept criteria in "
+ classpathLocations.get(url));
- searchForPaintables(classpathLocations.get(url), url, paintables);
+ searchForPaintables(classpathLocations.get(url), url);
}
long end = System.currentTimeMillis();
logger.info("Search took " + (end - start) + "ms");
- return paintables;
}
@@ -128,7 +126,7 @@ public class ClassPathExplorer {
if (acceptCriterion.isEmpty()) {
// accept criterion are searched as a side effect, normally after
// paintable detection
- getPaintablesHavingWidgetAnnotation();
+ findAcceptCriteria();
}
return acceptCriterion;
}
@@ -456,11 +454,9 @@ public class ClassPathExplorer {
*
* @param location
* @param locationString
- * @param paintables
*/
private final static void searchForPaintables(URL location,
- String locationString,
- Collection> paintables) {
+ String locationString) {
// Get a File object for the package
File directory = new File(location.getFile());
@@ -477,7 +473,7 @@ public class ClassPathExplorer {
String packageName = locationString
.substring(locationString.lastIndexOf("/") + 1);
classname = packageName + "." + classname;
- tryToAdd(classname, paintables);
+ tryToAdd(classname);
}
}
} else {
@@ -509,7 +505,7 @@ public class ClassPathExplorer {
classname = classname.substring(1);
}
classname = classname.replace('/', '.');
- tryToAdd(classname, paintables);
+ tryToAdd(classname);
}
}
}
@@ -542,16 +538,12 @@ public class ClassPathExplorer {
/**
* Checks a class for the {@link ClientCriterion} annotations, and adds it
- * to the appropriate collection if it has either.
+ * to the appropriate collection.
*
* @param fullclassName
- * @param paintables
- * the collection to which to add server side classes with
- * {@link ClientCriterion} annotation
*/
@SuppressWarnings("unchecked")
- private static void tryToAdd(final String fullclassName,
- Collection> paintables) {
+ private static void tryToAdd(final String fullclassName) {
PrintStream out = System.out;
PrintStream err = System.err;
Throwable errorToShow = null;
@@ -663,10 +655,9 @@ public class ClassPathExplorer {
* Test method for helper tool
*/
public static void main(String[] args) {
- Collection> paintables = ClassPathExplorer
- .getPaintablesHavingWidgetAnnotation();
- logger.info("Found annotated paintables:");
- for (Class extends Paintable> cls : paintables) {
+ ClassPathExplorer.findAcceptCriteria();
+ logger.info("Found client criteria:");
+ for (Class extends AcceptCriterion> cls : acceptCriterion) {
logger.info(cls.getCanonicalName());
}
diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java
index 8c26911a9a..b54f5ee948 100644
--- a/src/com/vaadin/ui/AbstractComponent.java
+++ b/src/com/vaadin/ui/AbstractComponent.java
@@ -29,9 +29,6 @@ import com.vaadin.event.EventRouter;
import com.vaadin.event.MethodEventSource;
import com.vaadin.event.ShortcutListener;
import com.vaadin.terminal.ErrorMessage;
-import com.vaadin.terminal.PaintException;
-import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.PaintTarget.PaintStatus;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.gwt.client.ComponentState;
@@ -172,8 +169,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
/**
* Sets and replaces all previous style names of the component. This method
- * will trigger a {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * will trigger a {@link RepaintRequestEvent}.
*
* @param style
* the new style of the component.
@@ -273,8 +269,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
/**
* Sets the component's caption String. Caption is the visible
* name of the component. This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * {@link RepaintRequestEvent}.
*
* @param caption
* the new caption String for the component.
@@ -343,8 +338,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
/**
* Sets the component's icon. This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * {@link RepaintRequestEvent}.
*
* @param icon
* the icon to be shown with the component's caption.
@@ -413,8 +407,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
/**
* Sets the component's immediate mode to the specified status. This method
- * will trigger a {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * will trigger a {@link RepaintRequestEvent}.
*
* @param immediate
* the boolean value specifying if the component should be in the
@@ -518,8 +511,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
/**
* Sets the component's description. See {@link #getDescription()} for more
* information on what the description is. This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * {@link RepaintRequestEvent}.
*
* The description is displayed as HTML/XHTML in tooltips or directly in
* certain components so care should be taken to avoid creating the
@@ -708,84 +700,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
}
}
- /* Component painting */
-
- @Deprecated
- public void requestRepaintRequests() {
- // This is no longer needed. Remove when Component no longer extends
- // Paintable
- }
-
- /**
- *
- *
- * Paints the Paintable into a UIDL stream. This method creates the UIDL
- * sequence describing it and outputs it to the given UIDL stream.
- *
- *
- *
- * It is called when the contents of the component should be painted in
- * response to the component first being shown or having been altered so
- * that its visual representation is changed.
- *
- *
- *
- * Do not override this to paint your component. Override
- * {@link #paintContent(PaintTarget)} instead.
- *
- *
- *
- * @param target
- * the target UIDL stream where the component should paint itself
- * to.
- * @throws PaintException
- * if the paint operation failed.
- */
- public void paint(PaintTarget target) throws PaintException {
- // Only paint content of visible components.
- if (!isVisibleInContext()) {
- return;
- }
-
- final String tag = target.getTag(this);
- final PaintStatus status = target.startPaintable(this, tag);
- if (PaintStatus.CACHED == status) {
- // nothing to do but flag as cached and close the paintable tag
- target.addAttribute("cached", true);
- } else {
- // Paint the contents of the component
- paintContent(target);
-
- }
- target.endPaintable(this);
-
- }
-
- /**
- * Checks if the component is visible and its parent is visible,
- * recursively.
- *
- * This is only a helper until paint is moved away from this class.
- *
- * @return
- */
- @Deprecated
- protected boolean isVisibleInContext() {
- HasComponents p = getParent();
- while (p != null) {
- if (!p.isVisible()) {
- return false;
- }
- p = p.getParent();
- }
- if (getParent() != null && !getParent().isComponentVisible(this)) {
- return false;
- }
-
- // All parents visible, return this state
- return isVisible();
- }
-
/**
* Build CSS compatible string representation of height.
*
@@ -812,22 +726,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
}
}
- /**
- * Paints any needed component-specific things to the given UIDL stream. The
- * more general {@link #paint(PaintTarget)} method handles all general
- * attributes common to all components, and it calls this method to paint
- * any component-specific attributes to the UIDL stream.
- *
- * @param target
- * the target UIDL stream where the component should paint itself
- * to
- * @throws PaintException
- * if the paint operation failed.
- */
- public void paintContent(PaintTarget target) throws PaintException {
-
- }
-
/**
* Returns the shared state bean with information to be sent from the server
* to the client.
@@ -961,17 +859,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
}
}
- /* Component variable changes */
-
- /*
- * Invoked when the value of a variable has changed. Don't add a JavaDoc
- * comment here, we use the default documentation from implemented
- * interface.
- */
- public void changeVariables(Object source, Map variables) {
-
- }
-
/* General event framework */
private static final Method COMPONENT_EVENT_METHOD = ReflectTools
diff --git a/src/com/vaadin/ui/AbstractField.java b/src/com/vaadin/ui/AbstractField.java
index 9f5516a6ce..7ad2f20296 100644
--- a/src/com/vaadin/ui/AbstractField.java
+++ b/src/com/vaadin/ui/AbstractField.java
@@ -12,7 +12,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.logging.Logger;
import com.vaadin.Application;
@@ -1301,11 +1300,6 @@ public abstract class AbstractField extends AbstractComponent implements
setInternalValue(convertFromDataSource(event.getProperty().getValue()));
}
- @Override
- public void changeVariables(Object source, Map variables) {
- super.changeVariables(source, variables);
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/com/vaadin/ui/AbstractMedia.java b/src/com/vaadin/ui/AbstractMedia.java
index e164b087f3..09cfd5ff12 100644
--- a/src/com/vaadin/ui/AbstractMedia.java
+++ b/src/com/vaadin/ui/AbstractMedia.java
@@ -8,10 +8,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.ui.MediaBaseConnector;
import com.vaadin.terminal.gwt.client.ui.MediaBaseConnector.MediaControl;
@@ -20,7 +22,8 @@ import com.vaadin.terminal.gwt.client.ui.MediaBaseConnector.MediaControl;
*
* @author Vaadin Ltd
*/
-public class AbstractMedia extends AbstractComponent {
+public class AbstractMedia extends AbstractComponent implements
+ Vaadin6Component {
private List sources = new ArrayList();
@@ -189,9 +192,7 @@ public class AbstractMedia extends AbstractComponent {
getRpcProxy(MediaControl.class).play();
}
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
target.addAttribute(MediaBaseConnector.ATTR_CONTROLS, isShowControls());
if (getAltText() != null) {
target.addAttribute(MediaBaseConnector.ATTR_ALT_TEXT, getAltText());
@@ -208,4 +209,8 @@ public class AbstractMedia extends AbstractComponent {
}
target.addAttribute(MediaBaseConnector.ATTR_MUTED, isMuted());
}
+
+ public void changeVariables(Object source, Map variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
}
diff --git a/src/com/vaadin/ui/AbstractOrderedLayout.java b/src/com/vaadin/ui/AbstractOrderedLayout.java
index 97929dcf25..f7c4917650 100644
--- a/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -15,6 +15,7 @@ import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Sizeable;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.AbstractOrderedLayoutConnector.AbstractOrderedLayoutServerRPC;
@@ -23,7 +24,8 @@ import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
@SuppressWarnings("serial")
public abstract class AbstractOrderedLayout extends AbstractLayout implements
- Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
+ Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier,
+ Vaadin6Component {
private AbstractOrderedLayoutServerRPC rpc = new AbstractOrderedLayoutServerRPC() {
@@ -175,15 +177,16 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
* @throws PaintException
* if the paint operation failed.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
-
// Add child component alignment info to layout tag
target.addAttribute("alignments", componentToAlignment);
target.addAttribute("expandRatios", componentToExpandRatio);
}
+ public void changeVariables(Object source, Map variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
/* Documented in superclass */
public void replaceComponent(Component oldComponent, Component newComponent) {
diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java
index defe6e9a86..e586810b2d 100644
--- a/src/com/vaadin/ui/AbstractSelect.java
+++ b/src/com/vaadin/ui/AbstractSelect.java
@@ -32,6 +32,7 @@ import com.vaadin.terminal.KeyMapper;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.ui.dd.VIsOverId;
import com.vaadin.terminal.gwt.client.ui.dd.VItemIdIs;
import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation;
@@ -60,7 +61,7 @@ import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
public abstract class AbstractSelect extends AbstractField
*
*
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * This method will trigger a {@link RepaintRequestEvent}.
*
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * This method will trigger a {@link RepaintRequestEvent}.
*
*
* @param style
@@ -185,9 +180,7 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* style names defined in Vaadin or GWT can not be removed.
*
*
- * * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * * This method will trigger a {@link RepaintRequestEvent}.
*
* @param style
* the style name or style names to be removed
@@ -236,10 +229,9 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
*
*
*
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent} for the component and, if it is a
- * {@link ComponentContainer}, for all its children recursively.
+ * This method will trigger a {@link RepaintRequestEvent} for the component
+ * and, if it is a {@link ComponentContainer}, for all its children
+ * recursively.
*
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * This method will trigger a {@link RepaintRequestEvent}.
*
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}. A reimplementation should call the superclass
- * implementation.
+ * This method will trigger a {@link RepaintRequestEvent}. A
+ * reimplementation should call the superclass implementation.
*
*
* @param caption
@@ -531,9 +519,7 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* {@code v-caption} .
*
*
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * This method will trigger a {@link RepaintRequestEvent}.
*
* @param icon
* the icon of the component. If null, no icon is shown and it
@@ -718,6 +704,92 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
*/
public void updateState();
+ /**
+ * Adds an unique id for component that get's transferred to terminal for
+ * testing purposes. Keeping identifiers unique is the responsibility of the
+ * programmer.
+ *
+ * @param id
+ * An alphanumeric id
+ */
+ public void setDebugId(String id);
+
+ /**
+ * Get's currently set debug identifier
+ *
+ * @return current debug id, null if not set
+ */
+ public String getDebugId();
+
+ /**
+ * Requests that the component should be repainted as soon as possible.
+ */
+ public void requestRepaint();
+
+ /**
+ * Repaint request event is thrown when the connector needs to be repainted.
+ * This is typically done when the paint method would return
+ * dissimilar UIDL from the previous call of the method.
+ */
+ @SuppressWarnings("serial")
+ public static class RepaintRequestEvent extends EventObject {
+
+ /**
+ * Constructs a new event.
+ *
+ * @param source
+ * the paintable needing repaint.
+ */
+ public RepaintRequestEvent(ClientConnector source) {
+ super(source);
+ }
+
+ /**
+ * Gets the connector needing repainting.
+ *
+ * @return Paintable for which the paint method will return
+ * dissimilar UIDL from the previous call of the method.
+ */
+ public ClientConnector getConnector() {
+ return (ClientConnector) getSource();
+ }
+ }
+
+ /**
+ * Listens repaint requests. The repaintRequested method is
+ * called when the paintable needs to be repainted. This is typically done
+ * when the paint method would return dissimilar UIDL from the
+ * previous call of the method.
+ */
+ public interface RepaintRequestListener extends Serializable {
+
+ /**
+ * Receives repaint request events.
+ *
+ * @param event
+ * the repaint request event specifying the paintable source.
+ */
+ public void repaintRequested(RepaintRequestEvent event);
+ }
+
+ /**
+ * Adds repaint request listener. In order to assure that no repaint
+ * requests are missed, the new repaint listener should paint the paintable
+ * right after adding itself as listener.
+ *
+ * @param listener
+ * the listener to be added.
+ */
+ public void addListener(RepaintRequestListener listener);
+
+ /**
+ * Removes repaint request listener.
+ *
+ * @param listener
+ * the listener to be removed.
+ */
+ public void removeListener(RepaintRequestListener listener);
+
/* Component event framework */
/**
@@ -1106,4 +1178,5 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
public void setTabIndex(int tabIndex);
}
+
}
diff --git a/src/com/vaadin/ui/CustomField.java b/src/com/vaadin/ui/CustomField.java
index c333309fbf..806ee91335 100644
--- a/src/com/vaadin/ui/CustomField.java
+++ b/src/com/vaadin/ui/CustomField.java
@@ -9,8 +9,6 @@ import java.lang.reflect.Method;
import java.util.Iterator;
import com.vaadin.data.Property;
-import com.vaadin.terminal.PaintException;
-import com.vaadin.terminal.PaintTarget;
/**
* A {@link Field} whose UI content can be constructed by the user, enabling the
@@ -84,17 +82,6 @@ public abstract class CustomField extends AbstractField implements
getContent().detach();
}
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- if (getContent() == null) {
- throw new IllegalStateException(
- "Content component or layout of the field must be set before the "
- + getClass().getName() + " can be painted");
- }
-
- getContent().paint(target);
- }
-
/**
* Returns the content (UI) of the custom component.
*
diff --git a/src/com/vaadin/ui/DateField.java b/src/com/vaadin/ui/DateField.java
index 311019c2e4..0d0bb04fc9 100644
--- a/src/com/vaadin/ui/DateField.java
+++ b/src/com/vaadin/ui/DateField.java
@@ -26,6 +26,7 @@ import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.ui.VDateField;
/**
@@ -50,7 +51,7 @@ import com.vaadin.terminal.gwt.client.ui.VDateField;
*/
@SuppressWarnings("serial")
public class DateField extends AbstractField implements
- FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
+ FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, Vaadin6Component {
/**
* Resolutions for DateFields
@@ -285,9 +286,7 @@ public class DateField extends AbstractField implements
* Paints this component. Don't add a JavaDoc comment here, we use the
* default documentation from implemented interface.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
// Adds the locale as attribute
final Locale l = getLocale();
@@ -340,9 +339,7 @@ public class DateField extends AbstractField implements
* comment here, we use the default documentation from implemented
* interface.
*/
- @Override
public void changeVariables(Object source, Map variables) {
- super.changeVariables(source, variables);
if (!isReadOnly()
&& (variables.containsKey("year")
diff --git a/src/com/vaadin/ui/DirtyConnectorTracker.java b/src/com/vaadin/ui/DirtyConnectorTracker.java
index fa5604eb5f..84df7e7c7c 100644
--- a/src/com/vaadin/ui/DirtyConnectorTracker.java
+++ b/src/com/vaadin/ui/DirtyConnectorTracker.java
@@ -9,10 +9,10 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.vaadin.terminal.Paintable.RepaintRequestEvent;
-import com.vaadin.terminal.Paintable.RepaintRequestListener;
import com.vaadin.terminal.gwt.server.AbstractCommunicationManager;
import com.vaadin.terminal.gwt.server.ClientConnector;
+import com.vaadin.ui.Component.RepaintRequestEvent;
+import com.vaadin.ui.Component.RepaintRequestListener;
/**
* A class that tracks dirty {@link ClientConnector}s. A {@link ClientConnector}
@@ -44,7 +44,7 @@ public class DirtyConnectorTracker implements RepaintRequestListener {
}
public void repaintRequested(RepaintRequestEvent event) {
- markDirty((Component) event.getPaintable());
+ markDirty((Component) event.getConnector());
}
public void componentAttached(Component component) {
diff --git a/src/com/vaadin/ui/DragAndDropWrapper.java b/src/com/vaadin/ui/DragAndDropWrapper.java
index 937942f3d3..babe36be72 100644
--- a/src/com/vaadin/ui/DragAndDropWrapper.java
+++ b/src/com/vaadin/ui/DragAndDropWrapper.java
@@ -20,6 +20,7 @@ import com.vaadin.event.dd.TargetDetailsImpl;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.StreamVariable;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper;
import com.vaadin.terminal.gwt.client.ui.dd.HorizontalDropLocation;
@@ -27,7 +28,7 @@ import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation;
@SuppressWarnings("serial")
public class DragAndDropWrapper extends CustomComponent implements DropTarget,
- DragSource {
+ DragSource, Vaadin6Component {
public class WrapperTransferable extends TransferableImpl {
@@ -213,9 +214,11 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
requestRepaint();
}
- @Override
+ public void changeVariables(Object source, Map variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
target.addAttribute(VDragAndDropWrapper.DRAG_START_MODE,
dragStartMode.ordinal());
if (getDropHandler() != null) {
diff --git a/src/com/vaadin/ui/Embedded.java b/src/com/vaadin/ui/Embedded.java
index 8d31e0060d..797b486337 100644
--- a/src/com/vaadin/ui/Embedded.java
+++ b/src/com/vaadin/ui/Embedded.java
@@ -13,6 +13,7 @@ import com.vaadin.event.MouseEvents.ClickListener;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.ClickEventHandler;
import com.vaadin.terminal.gwt.client.ui.EmbeddedConnector;
@@ -27,7 +28,7 @@ import com.vaadin.terminal.gwt.client.ui.EmbeddedConnector.EmbeddedServerRPC;
* @since 3.0
*/
@SuppressWarnings("serial")
-public class Embedded extends AbstractComponent {
+public class Embedded extends AbstractComponent implements Vaadin6Component {
/**
* General object type.
@@ -119,7 +120,6 @@ public class Embedded extends AbstractComponent {
/**
* Invoked when the component state should be painted.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
switch (type) {
@@ -521,4 +521,8 @@ public class Embedded extends AbstractComponent {
ClickEvent.class, listener);
}
+ public void changeVariables(Object source, Map variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
}
diff --git a/src/com/vaadin/ui/Form.java b/src/com/vaadin/ui/Form.java
index fa0e1d1e31..3ff164cc53 100644
--- a/src/com/vaadin/ui/Form.java
+++ b/src/com/vaadin/ui/Form.java
@@ -30,6 +30,7 @@ import com.vaadin.terminal.ErrorMessage;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.UserError;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.ui.FormConnector.FormState;
/**
@@ -67,7 +68,8 @@ import com.vaadin.terminal.gwt.client.ui.FormConnector.FormState;
*/
@Deprecated
public class Form extends AbstractField implements Item.Editor,
- Buffered, Item, Validatable, Action.Notifier, HasComponents {
+ Buffered, Item, Validatable, Action.Notifier, HasComponents,
+ Vaadin6Component {
private Object propertyValue;
@@ -192,19 +194,13 @@ public class Form extends AbstractField implements Item.Editor,
}
/* Documented in interface */
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
-
if (ownActionManager != null) {
ownActionManager.paintActions(null, target);
}
}
- @Override
public void changeVariables(Object source, Map variables) {
- super.changeVariables(source, variables);
-
// Actions
if (ownActionManager != null) {
ownActionManager.handleActions(variables, this);
diff --git a/src/com/vaadin/ui/GridLayout.java b/src/com/vaadin/ui/GridLayout.java
index c076c8a273..bdc08607e4 100644
--- a/src/com/vaadin/ui/GridLayout.java
+++ b/src/com/vaadin/ui/GridLayout.java
@@ -15,8 +15,10 @@ import java.util.Map.Entry;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
+import com.vaadin.terminal.LegacyPaint;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.GridLayoutConnector.GridLayoutServerRPC;
@@ -51,7 +53,8 @@ import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
*/
@SuppressWarnings("serial")
public class GridLayout extends AbstractLayout implements
- Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
+ Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier,
+ Vaadin6Component {
private GridLayoutServerRPC rpc = new GridLayoutServerRPC() {
@@ -428,6 +431,10 @@ public class GridLayout extends AbstractLayout implements
return components.size();
}
+ public void changeVariables(Object source, Map variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
/**
* Paints the contents of this component.
*
@@ -436,11 +443,7 @@ public class GridLayout extends AbstractLayout implements
* @throws PaintException
* if the paint operation failed.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
-
- super.paintContent(target);
-
// TODO refactor attribute names in future release.
target.addAttribute("structuralChange", structuralChange);
structuralChange = false;
@@ -541,7 +544,7 @@ public class GridLayout extends AbstractLayout implements
if (rows > 1) {
target.addAttribute("h", rows);
}
- area.getComponent().paint(target);
+ LegacyPaint.paint(area.getComponent(), target);
alignmentsArray[index++] = String
.valueOf(getComponentAlignment(area.getComponent())
diff --git a/src/com/vaadin/ui/Label.java b/src/com/vaadin/ui/Label.java
index c69a68002b..e52090aa5f 100644
--- a/src/com/vaadin/ui/Label.java
+++ b/src/com/vaadin/ui/Label.java
@@ -5,11 +5,13 @@
package com.vaadin.ui;
import java.lang.reflect.Method;
+import java.util.Map;
import com.vaadin.data.Property;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
/**
* Label component for showing non-editable short texts.
@@ -39,7 +41,7 @@ import com.vaadin.terminal.PaintTarget;
// TODO generics for interface Property
public class Label extends AbstractComponent implements Property,
Property.Viewer, Property.ValueChangeListener,
- Property.ValueChangeNotifier, Comparable {
+ Property.ValueChangeNotifier, Comparable, Vaadin6Component {
/**
* Content modes defining how the client should interpret a Label's value.
@@ -255,7 +257,6 @@ public class Label extends AbstractComponent implements Property,
* @throws PaintException
* if the Paint Operation fails.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
String uidlName = contentMode.getUidlName();
if (uidlName != null) {
@@ -565,4 +566,8 @@ public class Label extends AbstractComponent implements Property,
return res.toString();
}
+ public void changeVariables(Object source, Map variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
}
diff --git a/src/com/vaadin/ui/Link.java b/src/com/vaadin/ui/Link.java
index 4f57acc6e5..ed5ffbba3a 100644
--- a/src/com/vaadin/ui/Link.java
+++ b/src/com/vaadin/ui/Link.java
@@ -4,9 +4,12 @@
package com.vaadin.ui;
+import java.util.Map;
+
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.Vaadin6Component;
/**
* Link is used to create external or internal URL links.
@@ -17,7 +20,7 @@ import com.vaadin.terminal.Resource;
* @since 3.0
*/
@SuppressWarnings("serial")
-public class Link extends AbstractComponent {
+public class Link extends AbstractComponent implements Vaadin6Component {
/* Target window border type constant: No window border */
public static final int TARGET_BORDER_NONE = Root.BORDER_NONE;
@@ -92,7 +95,6 @@ public class Link extends AbstractComponent {
* @throws PaintException
* if the paint operation failed.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
if (resource != null) {
@@ -230,4 +232,8 @@ public class Link extends AbstractComponent {
this.resource = resource;
requestRepaint();
}
+
+ public void changeVariables(Object source, Map variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
}
diff --git a/src/com/vaadin/ui/MenuBar.java b/src/com/vaadin/ui/MenuBar.java
index a58a742e8c..519f9e7372 100644
--- a/src/com/vaadin/ui/MenuBar.java
+++ b/src/com/vaadin/ui/MenuBar.java
@@ -13,6 +13,7 @@ import java.util.Stack;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.ui.VMenuBar;
/**
@@ -23,7 +24,7 @@ import com.vaadin.terminal.gwt.client.ui.VMenuBar;
*
*/
@SuppressWarnings("serial")
-public class MenuBar extends AbstractComponent {
+public class MenuBar extends AbstractComponent implements Vaadin6Component {
// Items of the top-level menu
private final List