Browse Source

Component no longer implements Paintable

tags/7.0.0.alpha2
Artur Signell 12 years ago
parent
commit
496a0c0039
40 changed files with 410 additions and 542 deletions
  1. 6
    3
      src/com/vaadin/event/ActionManager.java
  2. 80
    0
      src/com/vaadin/terminal/LegacyPaint.java
  3. 16
    14
      src/com/vaadin/terminal/PaintTarget.java
  4. 0
    147
      src/com/vaadin/terminal/Paintable.java
  5. 30
    0
      src/com/vaadin/terminal/Vaadin6Component.java
  6. 10
    17
      src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
  7. 26
    48
      src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
  8. 15
    24
      src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java
  9. 5
    118
      src/com/vaadin/ui/AbstractComponent.java
  10. 0
    6
      src/com/vaadin/ui/AbstractField.java
  11. 8
    3
      src/com/vaadin/ui/AbstractMedia.java
  12. 7
    4
      src/com/vaadin/ui/AbstractOrderedLayout.java
  13. 3
    11
      src/com/vaadin/ui/AbstractSelect.java
  14. 2
    5
      src/com/vaadin/ui/AbstractTextField.java
  15. 9
    4
      src/com/vaadin/ui/Button.java
  16. 3
    6
      src/com/vaadin/ui/CheckBox.java
  17. 99
    26
      src/com/vaadin/ui/Component.java
  18. 0
    13
      src/com/vaadin/ui/CustomField.java
  19. 2
    5
      src/com/vaadin/ui/DateField.java
  20. 3
    3
      src/com/vaadin/ui/DirtyConnectorTracker.java
  21. 6
    3
      src/com/vaadin/ui/DragAndDropWrapper.java
  22. 6
    2
      src/com/vaadin/ui/Embedded.java
  23. 3
    7
      src/com/vaadin/ui/Form.java
  24. 9
    6
      src/com/vaadin/ui/GridLayout.java
  25. 7
    2
      src/com/vaadin/ui/Label.java
  26. 8
    2
      src/com/vaadin/ui/Link.java
  27. 3
    9
      src/com/vaadin/ui/MenuBar.java
  28. 5
    11
      src/com/vaadin/ui/Panel.java
  29. 5
    7
      src/com/vaadin/ui/PopupView.java
  30. 9
    2
      src/com/vaadin/ui/ProgressIndicator.java
  31. 3
    7
      src/com/vaadin/ui/RichTextArea.java
  32. 0
    4
      src/com/vaadin/ui/Root.java
  33. 2
    5
      src/com/vaadin/ui/Slider.java
  34. 6
    7
      src/com/vaadin/ui/TabSheet.java
  35. 3
    2
      src/com/vaadin/ui/Table.java
  36. 3
    3
      src/com/vaadin/ui/Upload.java
  37. 3
    1
      src/com/vaadin/ui/Window.java
  38. 3
    3
      tests/server-side/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatter.java
  39. 1
    1
      tests/server-side/com/vaadin/tests/server/components/TestComboBoxValueChange.java
  40. 1
    1
      tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java

+ 6
- 3
src/com/vaadin/event/ActionManager.java View File

@@ -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 <T extends Component & Container> ActionManager(T viewer) {
public <T extends Component & Container & VariableOwner> ActionManager(
T viewer) {
this.viewer = viewer;
}

@@ -57,7 +59,8 @@ public class ActionManager implements Action.Container, Action.Handler,
}
}

public <T extends Component & Container> void setViewer(T viewer) {
public <T extends Component & Container & VariableOwner> 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<Action>();

paintTarget.addVariable(viewer, "action", "");
paintTarget.addVariable((VariableOwner) viewer, "action", "");
paintTarget.startTag("actions");

for (final Action a : actions) {

+ 80
- 0
src/com/vaadin/terminal/LegacyPaint.java View File

@@ -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 {
/**
*
* <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();
}

}

+ 16
- 14
src/com/vaadin/terminal/PaintTarget.java View File

@@ -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 {
* </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
@@ -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();

}

+ 0
- 147
src/com/vaadin/terminal/Paintable.java View File

@@ -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 {

/**
* <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();
}

+ 30
- 0
src/com/vaadin/terminal/Vaadin6Component.java View File

@@ -0,0 +1,30 @@
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;

}

+ 10
- 17
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java View File

@@ -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<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");
}


+ 26
- 48
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java View File

@@ -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<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;
@@ -74,8 +73,6 @@ public class JsonPaintTarget implements PaintTarget {

private boolean cacheEnabled = false;

private final Collection<Paintable> paintedComponents = new HashSet<Paintable>();

private final Set<Class<? extends ClientConnector>> usedClientConnectors = new HashSet<Class<? extends ClientConnector>>();

/**
@@ -103,7 +100,7 @@ public class JsonPaintTarget implements PaintTarget {
mOpenTags = new Stack<String>();
openJsonTags = new Stack<JsonTag>();

openPaintables = new Stack<Paintable>();
openPaintables = new Stack<ClientConnector>();
openPaintableTags = new Stack<String>();

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<Class<? extends ClientConnector>> getUsedClientConnectors() {

+ 15
- 24
src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java View File

@@ -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<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;

}

@@ -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<Class<? extends Paintable>> 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<Class<? extends Paintable>> 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<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());
}


+ 5
- 118
src/com/vaadin/ui/AbstractComponent.java View File

@@ -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 <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.
@@ -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
}

/**
*
* <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.
*
@@ -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<String, Object> variables) {

}

/* General event framework */

private static final Method COMPONENT_EVENT_METHOD = ReflectTools

+ 0
- 6
src/com/vaadin/ui/AbstractField.java View File

@@ -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<T> extends AbstractComponent implements
setInternalValue(convertFromDataSource(event.getProperty().getValue()));
}

@Override
public void changeVariables(Object source, Map<String, Object> variables) {
super.changeVariables(source, variables);
}

/**
* {@inheritDoc}
*/

+ 8
- 3
src/com/vaadin/ui/AbstractMedia.java View File

@@ -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<Resource> sources = new ArrayList<Resource>();

@@ -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<String, Object> variables) {
// TODO Remove once Vaadin6Component is no longer implemented
}
}

+ 7
- 4
src/com/vaadin/ui/AbstractOrderedLayout.java View File

@@ -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<String, Object> variables) {
// TODO Remove once Vaadin6Component is no longer implemented
}

/* Documented in superclass */
public void replaceComponent(Component oldComponent, Component newComponent) {


+ 3
- 11
src/com/vaadin/ui/AbstractSelect.java View File

@@ -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<Object> implements
Container, Container.Viewer, Container.PropertySetChangeListener,
Container.PropertySetChangeNotifier, Container.ItemSetChangeNotifier,
Container.ItemSetChangeListener {
Container.ItemSetChangeListener, Vaadin6Component {

public enum ItemCaptionMode {
/**
@@ -322,12 +323,8 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
* @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");
@@ -428,9 +425,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
* @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()) {
@@ -582,10 +577,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
* to the terminal or null if no items is visible.
*/
public Collection<?> getVisibleItemIds() {
if (isVisibleInContext()) {
return getItemIds();
}
return null;
return getItemIds();
}

/* Property methods */

+ 2
- 5
src/com/vaadin/ui/AbstractTextField.java View File

@@ -18,10 +18,11 @@ import com.vaadin.event.FieldEvents.TextChangeListener;
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.
@@ -99,9 +100,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements
super();
}

@Override
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);

if (getMaxLength() >= 0) {
target.addAttribute("maxLength", getMaxLength());
@@ -185,12 +184,10 @@ public abstract class AbstractTextField extends AbstractField<String> implements
}
}

@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);

+ 9
- 4
src/com/vaadin/ui/Button.java View File

@@ -18,6 +18,9 @@ import com.vaadin.event.ShortcutAction;
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;
@@ -35,7 +38,7 @@ import com.vaadin.ui.Component.Focusable;
@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) {
@@ -87,10 +90,7 @@ public class Button extends AbstractComponent implements
* @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));
}
@@ -99,6 +99,10 @@ public class Button extends AbstractComponent implements
}
}

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.
*
@@ -499,4 +503,5 @@ public class Button extends AbstractComponent implements
public ButtonState getState() {
return (ButtonState) super.getState();
}

}

+ 3
- 6
src/com/vaadin/ui/CheckBox.java View File

@@ -13,9 +13,11 @@ 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.VCheckBox;

public class CheckBox extends AbstractField<Boolean> {
public class CheckBox extends AbstractField<Boolean> implements
Vaadin6Component {
/**
* Creates a new checkbox.
*/
@@ -64,18 +66,13 @@ public class CheckBox extends AbstractField<Boolean> {
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

+ 99
- 26
src/com/vaadin/ui/Component.java View File

@@ -12,7 +12,6 @@ import java.util.Locale;
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;
@@ -53,8 +52,8 @@ import com.vaadin.terminal.gwt.server.RpcTarget;
* @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
@@ -117,9 +116,7 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* </p>
*
* <p>
* This method will trigger a
* {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
* RepaintRequestEvent}.
* This method will trigger a {@link RepaintRequestEvent}.
* </p>
*
* @param style
@@ -161,9 +158,7 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* </pre>
*
* <p>
* This method will trigger a
* {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
* RepaintRequestEvent}.
* This method will trigger a {@link RepaintRequestEvent}.
* </p>
*
* @param style
@@ -185,9 +180,7 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* 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
@@ -236,10 +229,9 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* </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
@@ -389,9 +381,7 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* </p>
*
* <p>
* This method will trigger a
* {@link com.vaadin.terminal.Paintable.RepaintRequestEvent
* RepaintRequestEvent}.
* This method will trigger a {@link RepaintRequestEvent}.
* </p>
*
* @param readOnly
@@ -458,10 +448,8 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* </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
@@ -531,9 +519,7 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
* {@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
@@ -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 <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 */

/**
@@ -1106,4 +1178,5 @@ public interface Component extends ClientConnector, Paintable, VariableOwner,
public void setTabIndex(int tabIndex);

}

}

+ 0
- 13
src/com/vaadin/ui/CustomField.java View File

@@ -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<T> extends AbstractField<T> 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.
*

+ 2
- 5
src/com/vaadin/ui/DateField.java View File

@@ -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<Date> implements
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, Vaadin6Component {

/**
* Resolutions for DateFields
@@ -285,9 +286,7 @@ public class DateField extends AbstractField<Date> 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<Date> implements
* 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")

+ 3
- 3
src/com/vaadin/ui/DirtyConnectorTracker.java View File

@@ -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) {

+ 6
- 3
src/com/vaadin/ui/DragAndDropWrapper.java View File

@@ -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<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) {

+ 6
- 2
src/com/vaadin/ui/Embedded.java View File

@@ -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<String, Object> variables) {
// TODO Remove once Vaadin6Component is no longer implemented
}

}

+ 3
- 7
src/com/vaadin/ui/Form.java View File

@@ -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<Object> 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<Object> 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<String, Object> variables) {
super.changeVariables(source, variables);

// Actions
if (ownActionManager != null) {
ownActionManager.handleActions(variables, this);

+ 9
- 6
src/com/vaadin/ui/GridLayout.java View File

@@ -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<String, Object> 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())

+ 7
- 2
src/com/vaadin/ui/Label.java View File

@@ -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<Object> {
Property.ValueChangeNotifier, Comparable<Object>, 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<String, Object> variables) {
// TODO Remove once Vaadin6Component is no longer implemented
}

}

+ 8
- 2
src/com/vaadin/ui/Link.java View File

@@ -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<String, Object> variables) {
// TODO Remove once Vaadin6Component is no longer implemented
}
}

+ 3
- 9
src/com/vaadin/ui/MenuBar.java View File

@@ -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;
* </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;
@@ -38,12 +39,7 @@ public class MenuBar extends AbstractComponent {
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()) {
@@ -129,7 +125,6 @@ public class MenuBar extends AbstractComponent {
}

/** Deserialize changes received from client. */
@Override
public void changeVariables(Object source, Map<String, Object> variables) {
Stack<MenuItem> items = new Stack<MenuItem>();
boolean found = false;
@@ -731,8 +726,7 @@ public class MenuBar extends AbstractComponent {
/**
* 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.

+ 5
- 11
src/com/vaadin/ui/Panel.java View File

@@ -15,9 +15,9 @@ import com.vaadin.event.MouseEvents.ClickListener;
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;
@@ -33,7 +33,8 @@ 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.
@@ -221,14 +222,10 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
* (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);
}
@@ -289,10 +286,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
* @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");

+ 5
- 7
src/com/vaadin/ui/PopupView.java View File

@@ -8,8 +8,10 @@ import java.lang.reflect.Method;
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;

/**
*
@@ -21,7 +23,8 @@ import com.vaadin.terminal.PaintTarget;
* @author Vaadin Ltd.
*/
@SuppressWarnings("serial")
public class PopupView extends AbstractComponentContainer {
public class PopupView extends AbstractComponentContainer implements
Vaadin6Component {

private Content content;
private boolean hideOnMouseOut;
@@ -304,11 +307,7 @@ public class PopupView extends AbstractComponentContainer {
*
* @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 = "";
@@ -319,7 +318,7 @@ public class PopupView extends AbstractComponentContainer {
// 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");
}

@@ -332,7 +331,6 @@ public class PopupView extends AbstractComponentContainer {
* @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"))

+ 9
- 2
src/com/vaadin/ui/ProgressIndicator.java View File

@@ -4,10 +4,13 @@

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
@@ -25,7 +28,7 @@ import com.vaadin.terminal.PaintTarget;
*/
@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()
@@ -108,7 +111,6 @@ public class ProgressIndicator extends AbstractField<Number> implements
* @throws PaintException
* if the Paint Operation fails.
*/
@Override
public void paintContent(PaintTarget target) throws PaintException {
target.addAttribute("indeterminate", indeterminate);
target.addAttribute("pollinginterval", pollingInterval);
@@ -245,4 +247,9 @@ public class ProgressIndicator extends AbstractField<Number> implements
return pollingInterval;
}

public void changeVariables(Object source, Map<String, Object> variables) {
// TODO Remove once Vaadin6Component is no longer implemented

}

}

+ 3
- 7
src/com/vaadin/ui/RichTextArea.java View File

@@ -10,6 +10,7 @@ import java.util.Map;
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.
@@ -18,7 +19,8 @@ import com.vaadin.terminal.PaintTarget;
* {@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.
@@ -101,7 +103,6 @@ public class RichTextArea extends AbstractField<String> {
setCaption(caption);
}

@Override
public void paintContent(PaintTarget target) throws PaintException {
if (selectAll) {
target.addAttribute("selectAll", true);
@@ -119,7 +120,6 @@ public class RichTextArea extends AbstractField<String> {
}
target.addVariable(this, "text", value);

super.paintContent(target);
}

@Override
@@ -185,11 +185,7 @@ public class RichTextArea extends AbstractField<String> {
}
}

@Override
public void changeVariables(Object source, Map<String, Object> variables) {

super.changeVariables(source, variables);

// Sets the text
if (variables.containsKey("text") && !isReadOnly()) {


+ 0
- 4
src/com/vaadin/ui/Root.java View File

@@ -494,7 +494,6 @@ public abstract class Root extends AbstractComponentContainer implements
return application;
}

@Override
public void paintContent(PaintTarget target) throws PaintException {
// Open requested resource
synchronized (openList) {
@@ -600,10 +599,7 @@ public abstract class Root extends AbstractComponentContainer implements
}

@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));
}

+ 2
- 5
src/com/vaadin/ui/Slider.java View File

@@ -8,6 +8,7 @@ import java.util.Map;

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.
@@ -45,7 +46,7 @@ import com.vaadin.terminal.PaintTarget;
*
* @author Vaadin Ltd.
*/
public class Slider extends AbstractField<Double> {
public class Slider extends AbstractField<Double> implements Vaadin6Component {

public static final int ORIENTATION_HORIZONTAL = 0;

@@ -277,9 +278,7 @@ public class Slider extends AbstractField<Double> {
super.setValue(newFieldValue);
}

@Override
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);

target.addAttribute("min", min);
if (max > min) {
@@ -308,9 +307,7 @@ public class Slider extends AbstractField<Double> {
* @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());

+ 6
- 7
src/com/vaadin/ui/TabSheet.java View File

@@ -20,9 +20,11 @@ import com.vaadin.event.FieldEvents.FocusListener;
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;
@@ -59,7 +61,7 @@ import com.vaadin.ui.themes.Runo;
* @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,
@@ -357,7 +359,6 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
* @throws PaintException
* if the paint operation failed.
*/
@Override
public void paintContent(PaintTarget target) throws PaintException {

if (areTabsHidden()) {
@@ -422,7 +423,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
target.addAttribute("key", keyMapper.key(component));
if (component.equals(selected)) {
target.addAttribute("selected", true);
component.paint(target);
LegacyPaint.paint(component, target);
}
target.endTag("tab");
}
@@ -678,7 +679,6 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
}

// inherits javadoc
@Override
public void changeVariables(Object source, Map<String, Object> variables) {
if (variables.containsKey("selected")) {
setSelectedTab(keyMapper.get((String) variables.get("selected")));
@@ -1057,9 +1057,8 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
* </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

+ 3
- 2
src/com/vaadin/ui/Table.java View File

@@ -43,6 +43,7 @@ import com.vaadin.event.dd.DropTarget;
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;
@@ -3361,7 +3362,7 @@ public class Table extends AbstractSelect implements Action.Container,
target.addText("");
paintCellTooltips(target, itemId, columnId);
} else {
c.paint(target);
LegacyPaint.paint(c, target);
}
} else {
target.addText((String) cells[CELL_FIRSTCOL + currentColumn][indexInRowbuffer]);
@@ -5272,7 +5273,7 @@ public class Table extends AbstractSelect implements Action.Container,

@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);

+ 3
- 3
src/com/vaadin/ui/Upload.java View File

@@ -15,6 +15,7 @@ import java.util.Map;
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;

@@ -59,7 +60,8 @@ 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?
@@ -120,7 +122,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
* @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");
@@ -140,7 +141,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
* @throws PaintException
* if the paint operation failed.
*/
@Override
public void paintContent(PaintTarget target) throws PaintException {
if (notStarted) {
target.addAttribute("notStarted", true);

+ 3
- 1
src/com/vaadin/ui/Window.java View File

@@ -22,6 +22,7 @@ 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.WindowConnector.WindowServerRPC;
import com.vaadin.terminal.gwt.client.ui.WindowConnector.WindowState;
@@ -72,7 +73,8 @@ 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() {


+ 3
- 3
tests/server-side/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatter.java View File

@@ -9,8 +9,8 @@ import com.vaadin.data.Property.ValueChangeEvent;
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 {
@@ -61,7 +61,7 @@ public class TextFieldWithPropertyFormatter extends TestCase {
};

field.addListener(listener);
field.addListener(new Paintable.RepaintRequestListener() {
field.addListener(new RepaintRequestListener() {
public void repaintRequested(RepaintRequestEvent event) {
repainted++;
}

+ 1
- 1
tests/server-side/com/vaadin/tests/server/components/TestComboBoxValueChange.java View File

@@ -25,7 +25,7 @@ public class TestComboBoxValueChange extends
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);
}

}

+ 1
- 1
tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java View File

@@ -40,7 +40,7 @@ public class TestTextFieldValueChange extends
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);
}

/**

Loading…
Cancel
Save