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;
/**
}
- public <T extends Component & Container> ActionManager(T viewer) {
+ public <T extends Component & Container & VariableOwner> ActionManager(
+ T viewer) {
this.viewer = viewer;
}
}
}
- public <T extends Component & Container> void setViewer(T viewer) {
+ public <T extends Component & Container & VariableOwner> void setViewer(
+ T viewer) {
if (viewer == this.viewer) {
return;
}
if (!actions.isEmpty() || clientHasActions) {
actionMapper = new KeyMapper<Action>();
- paintTarget.addVariable(viewer, "action", "");
+ paintTarget.addVariable((VariableOwner) viewer, "action", "");
paintTarget.startTag("actions");
for (final Action a : actions) {
--- /dev/null
+package com.vaadin.terminal;
+
+import com.vaadin.terminal.PaintTarget.PaintStatus;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HasComponents;
+
+public class LegacyPaint {
+ /**
+ *
+ * <p>
+ * Paints the Paintable into a UIDL stream. This method creates the UIDL
+ * sequence describing it and outputs it to the given UIDL stream.
+ * </p>
+ *
+ * <p>
+ * 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.
+ * </p>
+ *
+ * <p>
+ * <b>Do not override this to paint your component.</b> Override
+ * {@link #paintContent(PaintTarget)} instead.
+ * </p>
+ *
+ *
+ * @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.
+ * <p>
+ * 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();
+ }
+
+}
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.
/**
* Result of starting to paint a Paintable (
- * {@link PaintTarget#startPaintable(Paintable, String)}).
+ * {@link PaintTarget#startPaintable(ClientConnector, String)}).
*
* @since 7.0
*/
* </p>
* <p>
* 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.
* </p>
*
* @param paintable
* @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.
* 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.
* 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;
/**
* @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.
/**
* @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();
+
}
+++ /dev/null
-/*
-@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 {
-
- /**
- * <p>
- * Paints the Paintable into a UIDL stream. This method creates the UIDL
- * sequence describing it and outputs it to the given UIDL stream.
- * </p>
- *
- * <p>
- * 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.
- * </p>
- *
- * @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.
- * <p>
- * 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 <code>paint</code> 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 <code>paint</code> method will return
- * dissimilar UIDL from the previous call of the method.
- */
- public Paintable getPaintable() {
- return (Paintable) getSource();
- }
- }
-
- /**
- * Listens repaint requests. The <code>repaintRequested</code> method is
- * called when the paintable needs to be repainted. This is typically done
- * when the <code>paint</code> 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.
- * <p>
- * This method is normally used only by the terminals to note paintables
- * about implicit repaints (painting the component without actually invoking
- * paint method).
- * </p>
- */
- public void requestRepaintRequests();
-}
--- /dev/null
+package com.vaadin.terminal;
+
+import java.util.EventListener;
+
+import com.vaadin.ui.Component;
+
+public interface Vaadin6Component extends VariableOwner, Component,
+ EventListener {
+
+ /**
+ * <p>
+ * Paints the Paintable into a UIDL stream. This method creates the UIDL
+ * sequence describing it and outputs it to the given UIDL stream.
+ * </p>
+ *
+ * <p>
+ * 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.
+ * </p>
+ *
+ * @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;
+
+}
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;
* 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")
// 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) {
private void legacyPaint(PaintTarget paintTarget,
ArrayList<ClientConnector> dirtyVisibleConnectors)
throws PaintException {
- List<Component> legacyComponents = new ArrayList<Component>();
+ List<Vaadin6Component> legacyComponents = new ArrayList<Vaadin6Component>();
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");
}
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;
private final Stack<JsonTag> openJsonTags;
// these match each other element-wise
- private final Stack<Paintable> openPaintables;
+ private final Stack<ClientConnector> openPaintables;
private final Stack<String> openPaintableTags;
private final PrintWriter uidlBuffer;
private boolean cacheEnabled = false;
- private final Collection<Paintable> paintedComponents = new HashSet<Paintable>();
-
private final Set<Class<? extends ClientConnector>> usedClientConnectors = new HashSet<Class<? extends ClientConnector>>();
/**
mOpenTags = new Stack<String>();
openJsonTags = new Stack<JsonTag>();
- openPaintables = new Stack<Paintable>();
+ openPaintables = new Stack<ClientConnector>();
openPaintableTags = new Stack<String>();
cacheEnabled = cachingRequired;
}
- 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);
}
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()));
}
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)
* @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.
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();
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)
*
}
@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<Class<? extends ClientConnector>> getUsedClientConnectors() {
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.
* 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<Class<? extends Paintable>> getPaintablesHavingWidgetAnnotation() {
- logger.info("Searching for paintables..");
+ public static void findAcceptCriteria() {
+ logger.info("Searching for accept criteria..");
long start = System.currentTimeMillis();
- Collection<Class<? extends Paintable>> paintables = new HashSet<Class<? extends Paintable>>();
Set<String> 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;
}
if (acceptCriterion.isEmpty()) {
// accept criterion are searched as a side effect, normally after
// paintable detection
- getPaintablesHavingWidgetAnnotation();
+ findAcceptCriteria();
}
return acceptCriterion;
}
*
* @param location
* @param locationString
- * @param paintables
*/
private final static void searchForPaintables(URL location,
- String locationString,
- Collection<Class<? extends Paintable>> paintables) {
+ String locationString) {
// Get a File object for the package
File directory = new File(location.getFile());
String packageName = locationString
.substring(locationString.lastIndexOf("/") + 1);
classname = packageName + "." + classname;
- tryToAdd(classname, paintables);
+ tryToAdd(classname);
}
}
} else {
classname = classname.substring(1);
}
classname = classname.replace('/', '.');
- tryToAdd(classname, paintables);
+ tryToAdd(classname);
}
}
}
/**
* 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<Class<? extends Paintable>> paintables) {
+ private static void tryToAdd(final String fullclassName) {
PrintStream out = System.out;
PrintStream err = System.err;
Throwable errorToShow = null;
* Test method for helper tool
*/
public static void main(String[] args) {
- Collection<Class<? extends Paintable>> 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());
}
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;
/**
* 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.
/**
* Sets the component's caption <code>String</code>. 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 <code>String</code> for the component.
/**
* 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.
/**
* 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
/**
* 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
}
}
- /* Component painting */
-
- @Deprecated
- public void requestRepaintRequests() {
- // This is no longer needed. Remove when Component no longer extends
- // Paintable
- }
-
- /**
- *
- * <p>
- * Paints the Paintable into a UIDL stream. This method creates the UIDL
- * sequence describing it and outputs it to the given UIDL stream.
- * </p>
- *
- * <p>
- * 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.
- * </p>
- *
- * <p>
- * <b>Do not override this to paint your component.</b> Override
- * {@link #paintContent(PaintTarget)} instead.
- * </p>
- *
- *
- * @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.
- * <p>
- * 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.
*
}
}
- /**
- * 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.
}
}
- /* 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<String, Object> variables) {
-
- }
-
/* General event framework */
private static final Method COMPONENT_EVENT_METHOD = ReflectTools
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;
setInternalValue(convertFromDataSource(event.getProperty().getValue()));
}
- @Override
- public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
- }
-
/**
* {@inheritDoc}
*/
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;
*
* @author Vaadin Ltd
*/
-public class AbstractMedia extends AbstractComponent {
+public class AbstractMedia extends AbstractComponent implements
+ Vaadin6Component {
private List<Resource> sources = new ArrayList<Resource>();
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());
}
target.addAttribute(MediaBaseConnector.ATTR_MUTED, isMuted());
}
+
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
}
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;
@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() {
* @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<String, Object> variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
/* Documented in superclass */
public void replaceComponent(Component oldComponent, Component newComponent) {
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;
public abstract class AbstractSelect extends AbstractField<Object> implements
Container, Container.Viewer, Container.PropertySetChangeListener,
Container.PropertySetChangeNotifier, Container.ItemSetChangeNotifier,
- Container.ItemSetChangeListener {
+ Container.ItemSetChangeListener, Vaadin6Component {
public enum ItemCaptionMode {
/**
* @throws PaintException
* if the paint operation failed.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- // Paints field properties
- super.paintContent(target);
-
// Paints select attributes
if (isMultiSelect()) {
target.addAttribute("selectmode", "multi");
* @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object,
* java.util.Map)
*/
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
// New option entered (and it is allowed)
if (isNewItemsAllowed()) {
* to the terminal or null if no items is visible.
*/
public Collection<?> getVisibleItemIds() {
- if (isVisibleInContext()) {
- return getItemIds();
- }
- return null;
+ return getItemIds();
}
/* Property methods */
import com.vaadin.event.FieldEvents.TextChangeNotifier;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.ui.VTextField;
public abstract class AbstractTextField extends AbstractField<String> implements
- BlurNotifier, FocusNotifier, TextChangeNotifier {
+ BlurNotifier, FocusNotifier, TextChangeNotifier, Vaadin6Component {
/**
* Value formatter used to format the string contents.
super();
}
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
if (getMaxLength() >= 0) {
target.addAttribute("maxLength", getMaxLength());
}
}
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
changingVariables = true;
try {
- super.changeVariables(source, variables);
if (variables.containsKey(VTextField.VAR_CURSOR)) {
Integer object = (Integer) variables.get(VTextField.VAR_CURSOR);
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.event.ShortcutAction.ModifierKey;
import com.vaadin.event.ShortcutListener;
+import com.vaadin.terminal.PaintException;
+import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.ButtonConnector.ButtonServerRpc;
import com.vaadin.terminal.gwt.client.ui.ButtonState;
@SuppressWarnings("serial")
public class Button extends AbstractComponent implements
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, Focusable,
- Action.ShortcutNotifier {
+ Action.ShortcutNotifier, Vaadin6Component {
private ButtonServerRpc rpc = new ButtonServerRpc() {
public void click(MouseEventDetails mouseEventDetails) {
* @param source
* @param variables
*/
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
-
if (variables.containsKey(FocusEvent.EVENT_ID)) {
fireEvent(new FocusEvent(this));
}
}
}
+ public void paintContent(PaintTarget target) throws PaintException {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
/**
* Click event. This event is thrown, when the button is clicked.
*
public ButtonState getState() {
return (ButtonState) super.getState();
}
+
}
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.VCheckBox;
-public class CheckBox extends AbstractField<Boolean> {
+public class CheckBox extends AbstractField<Boolean> implements
+ Vaadin6Component {
/**
* Creates a new checkbox.
*/
return Boolean.class;
}
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
-
Boolean value = getValue();
boolean booleanValue = (value != null) ? value : false;
target.addVariable(this, VCheckBox.VARIABLE_STATE, booleanValue);
}
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
if (!isReadOnly() && variables.containsKey(VCheckBox.VARIABLE_STATE)) {
// Gets the new and old states
import com.vaadin.Application;
import com.vaadin.event.FieldEvents;
import com.vaadin.terminal.ErrorMessage;
-import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.Sizeable;
import com.vaadin.terminal.VariableOwner;
* @VERSION@
* @since 3.0
*/
-public interface Component extends ClientConnector, Paintable, VariableOwner,
- Sizeable, Serializable, RpcTarget {
+public interface Component extends ClientConnector, Sizeable, Serializable,
+ RpcTarget {
/**
* Gets all user-defined CSS style names of a component. If the component
* </p>
*
* <p>
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * This method will trigger a {@link RepaintRequestEvent}.
* </p>
*
* @param style
* </pre>
*
* <p>
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * This method will trigger a {@link RepaintRequestEvent}.
* </p>
*
* @param style
* style names defined in Vaadin or GWT can not be removed.
* </p>
*
- * * 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
* </pre>
*
* <p>
- * 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.
* </p>
*
* @param enabled
* </p>
*
* <p>
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent}.
+ * This method will trigger a {@link RepaintRequestEvent}.
* </p>
*
* @param readOnly
* </p>
*
* <p>
- * 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.
* </p>
*
* @param caption
* {@code v-caption} .
* </p>
*
- * 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
*/
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 <code>paint</code> 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 <code>paint</code> method will return
+ * dissimilar UIDL from the previous call of the method.
+ */
+ public ClientConnector getConnector() {
+ return (ClientConnector) getSource();
+ }
+ }
+
+ /**
+ * Listens repaint requests. The <code>repaintRequested</code> method is
+ * called when the paintable needs to be repainted. This is typically done
+ * when the <code>paint</code> 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 */
/**
public void setTabIndex(int tabIndex);
}
+
}
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
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.
*
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;
/**
*/
@SuppressWarnings("serial")
public class DateField extends AbstractField<Date> implements
- FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
+ FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, Vaadin6Component {
/**
* Resolutions for DateFields
* 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();
* comment here, we use the default documentation from implemented
* interface.
*/
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
if (!isReadOnly()
&& (variables.containsKey("year")
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}
}
public void repaintRequested(RepaintRequestEvent event) {
- markDirty((Component) event.getPaintable());
+ markDirty((Component) event.getConnector());
}
public void componentAttached(Component component) {
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;
@SuppressWarnings("serial")
public class DragAndDropWrapper extends CustomComponent implements DropTarget,
- DragSource {
+ DragSource, Vaadin6Component {
public class WrapperTransferable extends TransferableImpl {
requestRepaint();
}
- @Override
+ public void changeVariables(Object source, Map<String, Object> 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) {
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;
* @since 3.0
*/
@SuppressWarnings("serial")
-public class Embedded extends AbstractComponent {
+public class Embedded extends AbstractComponent implements Vaadin6Component {
/**
* General object type.
/**
* Invoked when the component state should be painted.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
switch (type) {
ClickEvent.class, listener);
}
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
}
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;
/**
*/
@Deprecated
public class Form extends AbstractField<Object> implements Item.Editor,
- Buffered, Item, Validatable, Action.Notifier, HasComponents {
+ Buffered, Item, Validatable, Action.Notifier, HasComponents,
+ Vaadin6Component {
private Object propertyValue;
}
/* 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<String, Object> variables) {
- super.changeVariables(source, variables);
-
// Actions
if (ownActionManager != null) {
ownActionManager.handleActions(variables, this);
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;
*/
@SuppressWarnings("serial")
public class GridLayout extends AbstractLayout implements
- Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
+ Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier,
+ Vaadin6Component {
private GridLayoutServerRPC rpc = new GridLayoutServerRPC() {
return components.size();
}
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
/**
* Paints the contents of this component.
*
* @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;
if (rows > 1) {
target.addAttribute("h", rows);
}
- area.getComponent().paint(target);
+ LegacyPaint.paint(area.getComponent(), target);
alignmentsArray[index++] = String
.valueOf(getComponentAlignment(area.getComponent())
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.
// TODO generics for interface Property
public class Label extends AbstractComponent implements Property,
Property.Viewer, Property.ValueChangeListener,
- Property.ValueChangeNotifier, Comparable<Object> {
+ Property.ValueChangeNotifier, Comparable<Object>, Vaadin6Component {
/**
* Content modes defining how the client should interpret a Label's value.
* @throws PaintException
* if the Paint Operation fails.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
String uidlName = contentMode.getUidlName();
if (uidlName != null) {
return res.toString();
}
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
+
}
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.
* @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;
* @throws PaintException
* if the paint operation failed.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
if (resource != null) {
this.resource = resource;
requestRepaint();
}
+
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+ }
}
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;
/**
* </p>
*/
@SuppressWarnings("serial")
-public class MenuBar extends AbstractComponent {
+public class MenuBar extends AbstractComponent implements Vaadin6Component {
// Items of the top-level menu
private final List<MenuItem> menuItems;
private boolean htmlContentAllowed;
/** Paint (serialise) the component for the client. */
- @Override
public void paintContent(PaintTarget target) throws PaintException {
-
- // Superclass writes any common attributes in the paint target.
- super.paintContent(target);
-
target.addAttribute(VMenuBar.OPEN_ROOT_MENU_ON_HOWER, openRootOnHover);
if (isHtmlContentAllowed()) {
}
/** Deserialize changes received from client. */
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
Stack<MenuItem> items = new Stack<MenuItem>();
boolean found = false;
/**
* Sets the items'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}.
*
* @param description
* the new description string for the component.
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Scrollable;
+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.PanelConnector;
import com.vaadin.terminal.gwt.client.ui.PanelConnector.PanelServerRPC;
import com.vaadin.terminal.gwt.client.ui.PanelConnector.PanelState;
import com.vaadin.ui.Component.Focusable;
@SuppressWarnings("serial")
public class Panel extends AbstractComponentContainer implements Scrollable,
ComponentContainer.ComponentAttachListener,
- ComponentContainer.ComponentDetachListener, Action.Notifier, Focusable {
+ ComponentContainer.ComponentDetachListener, Action.Notifier, Focusable,
+ Vaadin6Component {
/**
* Content of the panel.
* (non-Javadoc)
*
* @see
- * com.vaadin.ui.AbstractComponent#paintContent(com.vaadin.terminal.PaintTarget
- * )
+ * com.vaadin.terminal.Vaadin6Component#paintContent(com.vaadin.terminal
+ * .PaintTarget)
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- // This is needed for now for paint to be ever run for the child
- content.paint(target);
-
if (actionManager != null) {
actionManager.paintActions(null, target);
}
* @see com.vaadin.terminal.VariableOwner#changeVariables(Object, Map)
*/
@SuppressWarnings("unchecked")
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
-
// Get new size
final Integer newWidth = (Integer) variables.get("width");
final Integer newHeight = (Integer) variables.get("height");
import java.util.Iterator;
import java.util.Map;
+import com.vaadin.terminal.LegacyPaint;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
/**
*
* @author Vaadin Ltd.
*/
@SuppressWarnings("serial")
-public class PopupView extends AbstractComponentContainer {
+public class PopupView extends AbstractComponentContainer implements
+ Vaadin6Component {
private Content content;
private boolean hideOnMouseOut;
*
* @see com.vaadin.ui.AbstractComponent#paintContent(com.vaadin.terminal.PaintTarget)
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- // Superclass writes any common attributes in the paint target.
- super.paintContent(target);
-
String html = content.getMinimizedValueAsHTML();
if (html == null) {
html = "";
// Only paint component to client if we know that the popup is showing
if (isPopupVisible()) {
target.startTag("popupComponent");
- visibleComponent.paint(target);
+ LegacyPaint.paint(visibleComponent, target);
target.endTag("popupComponent");
}
* @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object,
* java.util.Map)
*/
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
if (variables.containsKey("popupVisibility")) {
setPopupVisible(((Boolean) variables.get("popupVisibility"))
package com.vaadin.ui;
+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;
/**
* <code>ProgressIndicator</code> is component that shows user state of a
*/
@SuppressWarnings("serial")
public class ProgressIndicator extends AbstractField<Number> implements
- Property.Viewer, Property.ValueChangeListener {
+ Property.Viewer, Property.ValueChangeListener, Vaadin6Component {
/**
* Content mode, where the label contains only plain text. The getValue()
* @throws PaintException
* if the Paint Operation fails.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
target.addAttribute("indeterminate", indeterminate);
target.addAttribute("pollinginterval", pollingInterval);
return pollingInterval;
}
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ // TODO Remove once Vaadin6Component is no longer implemented
+
+ }
+
}
import com.vaadin.data.Property;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
/**
* A simple RichTextArea to edit HTML format text.
* {@link RichTextArea} may produce unexpected results as formatting is counted
* into length of field.
*/
-public class RichTextArea extends AbstractField<String> {
+public class RichTextArea extends AbstractField<String> implements
+ Vaadin6Component {
/**
* Value formatter used to format the string contents.
setCaption(caption);
}
- @Override
public void paintContent(PaintTarget target) throws PaintException {
if (selectAll) {
target.addAttribute("selectAll", true);
}
target.addVariable(this, "text", value);
- super.paintContent(target);
}
@Override
}
}
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
-
- super.changeVariables(source, variables);
-
// Sets the text
if (variables.containsKey("text") && !isReadOnly()) {
return application;
}
- @Override
public void paintContent(PaintTarget target) throws PaintException {
// Open requested resource
synchronized (openList) {
}
@SuppressWarnings("unchecked")
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
-
if (variables.containsKey(CLICK_EVENT_ID)) {
fireClick((Map<String, Object>) variables.get(CLICK_EVENT_ID));
}
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
/**
* A component for selecting a numerical value within a range.
*
* @author Vaadin Ltd.
*/
-public class Slider extends AbstractField<Double> {
+public class Slider extends AbstractField<Double> implements Vaadin6Component {
public static final int ORIENTATION_HORIZONTAL = 0;
super.setValue(newFieldValue);
}
- @Override
public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
target.addAttribute("min", min);
if (max > min) {
* @param source
* @param variables
*/
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
- super.changeVariables(source, variables);
if (variables.containsKey("value")) {
final Object value = variables.get("value");
final Double newValue = new Double(value.toString());
import com.vaadin.event.FieldEvents.FocusNotifier;
import com.vaadin.terminal.ErrorMessage;
import com.vaadin.terminal.KeyMapper;
+import com.vaadin.terminal.LegacyPaint;
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.TabsheetBaseConnector;
import com.vaadin.terminal.gwt.client.ui.VTabsheet;
import com.vaadin.ui.Component.Focusable;
* @since 3.0
*/
public class TabSheet extends AbstractComponentContainer implements Focusable,
- FocusNotifier, BlurNotifier {
+ FocusNotifier, BlurNotifier, Vaadin6Component {
/**
* List of component tabs (tab contents). In addition to being on this list,
* @throws PaintException
* if the paint operation failed.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
if (areTabsHidden()) {
target.addAttribute("key", keyMapper.key(component));
if (component.equals(selected)) {
target.addAttribute("selected", true);
- component.paint(target);
+ LegacyPaint.paint(component, target);
}
target.endTag("tab");
}
}
// inherits javadoc
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
if (variables.containsKey("selected")) {
setSelectedTab(keyMapper.get((String) variables.get("selected")));
* </pre>
*
* <p>
- * This method will trigger a
- * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
- * RepaintRequestEvent} on the TabSheet to which the Tab belongs.
+ * This method will trigger a {@link RepaintRequestEvent} on the
+ * TabSheet to which the Tab belongs.
* </p>
*
* @param styleName
import com.vaadin.event.dd.acceptcriteria.ClientCriterion;
import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion;
import com.vaadin.terminal.KeyMapper;
+import com.vaadin.terminal.LegacyPaint;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
target.addText("");
paintCellTooltips(target, itemId, columnId);
} else {
- c.paint(target);
+ LegacyPaint.paint(c, target);
}
} else {
target.addText((String) cells[CELL_FIRSTCOL + currentColumn][indexInRowbuffer]);
@Override
public void setVisible(boolean visible) {
- if (!isVisibleInContext() && visible) {
+ if (visible) {
// We need to ensure that the rows are sent to the client when the
// Table is made visible if it has been rendered as invisible.
setRowCacheInvalidated(true);
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.StreamVariable.StreamingProgressEvent;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.server.NoInputStreamException;
import com.vaadin.terminal.gwt.server.NoOutputStreamException;
* @since 3.0
*/
@SuppressWarnings("serial")
-public class Upload extends AbstractComponent implements Component.Focusable {
+public class Upload extends AbstractComponent implements Component.Focusable,
+ Vaadin6Component {
/**
* Should the field be focused on next repaint?
* @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object,
* java.util.Map)
*/
- @Override
public void changeVariables(Object source, Map<String, Object> variables) {
if (variables.containsKey("pollForStart")) {
int id = (Integer) variables.get("pollForStart");
* @throws PaintException
* if the paint operation failed.
*/
- @Override
public void paintContent(PaintTarget target) throws PaintException {
if (notStarted) {
target.addAttribute("notStarted", true);
import com.vaadin.event.ShortcutListener;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.WindowConnector.WindowServerRPC;
import com.vaadin.terminal.gwt.client.ui.WindowConnector.WindowState;
* @since 3.0
*/
@SuppressWarnings("serial")
-public class Window extends Panel implements FocusNotifier, BlurNotifier {
+public class Window extends Panel implements FocusNotifier, BlurNotifier,
+ Vaadin6Component {
private WindowServerRPC rpc = new WindowServerRPC() {
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.data.util.PropertyFormatter;
-import com.vaadin.terminal.Paintable;
-import com.vaadin.terminal.Paintable.RepaintRequestEvent;
+import com.vaadin.ui.Component.RepaintRequestEvent;
+import com.vaadin.ui.Component.RepaintRequestListener;
import com.vaadin.ui.TextField;
public class TextFieldWithPropertyFormatter extends TestCase {
};
field.addListener(listener);
- field.addListener(new Paintable.RepaintRequestListener() {
+ field.addListener(new RepaintRequestListener() {
public void repaintRequested(RepaintRequestEvent event) {
repainted++;
}
protected void setValue(AbstractField<Object> field) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("selected", new String[] { "myvalue" });
- field.changeVariables(field, variables);
+ ((ComboBox) field).changeVariables(field, variables);
}
}
protected void setValue(AbstractField<String> field) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("text", "newValue");
- field.changeVariables(field, variables);
+ ((TextField) field).changeVariables(field, variables);
}
/**