summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2007-11-16 13:42:51 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2007-11-16 13:42:51 +0000
commitd517ebf66d111e6537d40a97e2982086b44c0143 (patch)
tree8c4ad6d50d8eefc0960c61483a4f35f1d64d8a52 /src
parentf0aabb657aeb417d6b430a84416ec3ebc05a42f4 (diff)
downloadvaadin-framework-d517ebf66d111e6537d40a97e2982086b44c0143.tar.gz
vaadin-framework-d517ebf66d111e6537d40a97e2982086b44c0143.zip
ThemeResource now works in Embedded
svn changeset:2853/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java87
1 files changed, 49 insertions, 38 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java
index fe3715d08a..3b4134ba20 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java
@@ -8,44 +8,55 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
public class IEmbedded extends HTML implements Paintable {
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (client.updateComponent(this, uidl, true)) {
- return;
- }
- String w = uidl.hasAttribute("width") ? uidl
- .getStringAttribute("width") : "100%";
- String h = uidl.hasAttribute("height") ? uidl
- .getStringAttribute("height") : "100%";
- DOM.setStyleAttribute(getElement(), "width", w);
- DOM.setStyleAttribute(getElement(), "height", h);
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ if (client.updateComponent(this, uidl, true)) {
+ return;
+ }
+ String w = uidl.hasAttribute("width") ? uidl
+ .getStringAttribute("width") : "100%";
+ String h = uidl.hasAttribute("height") ? uidl
+ .getStringAttribute("height") : "100%";
+ DOM.setStyleAttribute(getElement(), "width", w);
+ DOM.setStyleAttribute(getElement(), "height", h);
- if (uidl.hasAttribute("type")) {
- String type = uidl.getStringAttribute("type");
- if (type.equals("image")) {
- setHTML("<img src=\"" + uidl.getStringAttribute("src") + "\"/>");
- } else if (type.equals("browser")) {
- setHTML("<iframe width=\"100%\" height=\"100%\" frameborder=\"0\" src=\""
- + uidl.getStringAttribute("src") + "\"></iframe>");
- } else {
- ApplicationConnection.getConsole().log(
- "Unknown Embedded type '" + type + "'");
- }
- } else if (uidl.hasAttribute("mimetype")) {
- String mime = uidl.getStringAttribute("mimetype");
- if (mime.equals("application/x-shockwave-flash")) {
- setHTML("<object width=\"" + w + "\" height=\"" + h
- + "\"><param name=\"movie\" value=\""
- + uidl.getStringAttribute("src") + "\"><embed src=\""
- + uidl.getStringAttribute("src") + "\" width=\"" + w
- + "\" height=\"" + h + "\"></embed></object>");
- } else {
- ApplicationConnection.getConsole().log(
- "Unknown Embedded mimetype '" + mime + "'");
- }
- } else {
- ApplicationConnection.getConsole().log(
- "Unknown Embedded; no type or mimetype attribute");
- }
+ if (uidl.hasAttribute("type")) {
+ String type = uidl.getStringAttribute("type");
+ if (type.equals("image")) {
+ setHTML("<img src=\"" + getSrc(uidl, client) + "\"/>");
+ } else if (type.equals("browser")) {
+ setHTML("<iframe width=\"100%\" height=\"100%\" frameborder=\"0\" src=\""
+ + getSrc(uidl, client) + "\"></iframe>");
+ } else {
+ ApplicationConnection.getConsole().log(
+ "Unknown Embedded type '" + type + "'");
+ }
+ } else if (uidl.hasAttribute("mimetype")) {
+ String mime = uidl.getStringAttribute("mimetype");
+ if (mime.equals("application/x-shockwave-flash")) {
+ setHTML("<object width=\"" + w + "\" height=\"" + h
+ + "\"><param name=\"movie\" value=\""
+ + getSrc(uidl, client) + "\"><embed src=\""
+ + getSrc(uidl, client) + "\" width=\"" + w
+ + "\" height=\"" + h + "\"></embed></object>");
+ } else {
+ ApplicationConnection.getConsole().log(
+ "Unknown Embedded mimetype '" + mime + "'");
+ }
+ } else {
+ ApplicationConnection.getConsole().log(
+ "Unknown Embedded; no type or mimetype attribute");
+ }
- }
+ }
+
+ /**
+ * Helper to return translated src attribute from embeddeds uidl
+ *
+ * @param uidl
+ * @param client
+ * @return
+ */
+ private String getSrc(UIDL uidl, ApplicationConnection client) {
+ return client.translateToolkitUri(uidl.getStringAttribute("src"));
+ }
}