diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-08-06 09:56:53 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-08-06 09:56:53 +0300 |
commit | 5813e0e9e5af4f946e5ea9c73d426e95d93b7bc4 (patch) | |
tree | 60eee45fc207229b1737dbd228b448499e4d08c8 /src/com/vaadin | |
parent | 46e2ee52c1302a7ea607b41ff913ed2eae9a5a53 (diff) | |
download | vaadin-framework-5813e0e9e5af4f946e5ea9c73d426e95d93b7bc4.tar.gz vaadin-framework-5813e0e9e5af4f946e5ea9c73d426e95d93b7bc4.zip |
Make JsonPaintTarget use ResourceReference for getting urls (#9212)
Diffstat (limited to 'src/com/vaadin')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java index aed1c2c0e3..5a830ddb63 100644 --- a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java +++ b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java @@ -15,14 +15,10 @@ import java.util.Stack; import java.util.Vector; import java.util.logging.Logger; -import com.vaadin.Application; -import com.vaadin.terminal.ApplicationResource; -import com.vaadin.terminal.ExternalResource; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Resource; import com.vaadin.terminal.StreamVariable; -import com.vaadin.terminal.ThemeResource; import com.vaadin.terminal.VariableOwner; import com.vaadin.ui.Alignment; import com.vaadin.ui.Component; @@ -339,33 +335,12 @@ public class JsonPaintTarget implements PaintTarget { } @Override - @SuppressWarnings("deprecation") public void addAttribute(String name, Resource value) throws PaintException { - - if (value instanceof ExternalResource) { - addAttribute(name, ((ExternalResource) value).getURL()); - - } else if (value instanceof ApplicationResource) { - final ApplicationResource r = (ApplicationResource) value; - final Application a = r.getApplication(); - if (a == null) { - throw new PaintException( - "Application not specified for resorce " - + value.getClass().getName()); - } - final String uri = a.getRelativeLocation(r); - addAttribute(name, uri); - - } else if (value instanceof ThemeResource) { - final String uri = "theme://" - + ((ThemeResource) value).getResourceId(); - addAttribute(name, uri); - } else { - throw new PaintException("Ajax adapter does not " - + "support resources of type: " - + value.getClass().getName()); + if (value == null) { + throw new NullPointerException(); } - + ResourceReference reference = ResourceReference.create(value); + addAttribute(name, reference.getURL()); } @Override |