aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-11-09 08:11:52 +0000
committerMarc Englund <marc.englund@itmill.com>2007-11-09 08:11:52 +0000
commit496dd015643a175d746baad418f3e9865e6fd8e4 (patch)
treeb497454e41e67890e9c5ec479cbb82915ec638fa
parent6fffaaec02a877449b2d3caddd28ef0df0a859c7 (diff)
downloadvaadin-framework-496dd015643a175d746baad418f3e9865e6fd8e4.tar.gz
vaadin-framework-496dd015643a175d746baad418f3e9865e6fd8e4.zip
Embedded TYPE_HTML -> TYPE_BROWSER, IEmbedded updated
svn changeset:2770/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java54
-rw-r--r--src/com/itmill/toolkit/ui/Embedded.java10
2 files changed, 41 insertions, 23 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 b0677746ca..56006f23fc 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java
@@ -1,5 +1,6 @@
package com.itmill.toolkit.terminal.gwt.client.ui;
+import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HTML;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
@@ -8,27 +9,44 @@ 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))
+ 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")
- && uidl.getStringAttribute("type").equals("image")) {
- setHTML("<img src=\"" + uidl.getStringAttribute("src") + "\"/>");
- } else if (uidl.hasAttribute("mimetype")
- && uidl.getStringAttribute("mimetype").equals(
- "application/x-shockwave-flash")) {
- String w = uidl.hasAttribute("width") ? uidl
- .getStringAttribute("width") : "100";
- String h = uidl.hasAttribute("height") ? uidl
- .getStringAttribute("height") : "100";
-
- setHTML("<object width=\"" + w + "\" height=\"" + h
- + "\"><param name=\"movie\" value=\""
- + uidl.getStringAttribute("src") + "\"><embed src=\""
- + uidl.getStringAttribute("src") + "\" width=\"" + w
- + "\" height=\"" + h + "\"></embed></object>");
+ 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 style=\"width:" + w + ";height:" + h
+ + ";border: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 {
- setText("Terminal don't know how ty handle this type of embed");
+ ApplicationConnection.getConsole().log(
+ "Unknown Embedded; no type or mimetype attribute");
}
+
}
}
diff --git a/src/com/itmill/toolkit/ui/Embedded.java b/src/com/itmill/toolkit/ui/Embedded.java
index b68a1a7311..6a2a93cd26 100644
--- a/src/com/itmill/toolkit/ui/Embedded.java
+++ b/src/com/itmill/toolkit/ui/Embedded.java
@@ -57,9 +57,9 @@ public class Embedded extends AbstractComponent implements Sizeable {
public static final int TYPE_IMAGE = 1;
/**
- * HTML types.
+ * Browser ("iframe") type.
*/
- public static final int TYPE_HTML = 2;
+ public static final int TYPE_BROWSER = 2;
/**
* Type of the object.
@@ -152,8 +152,8 @@ public class Embedded extends AbstractComponent implements Sizeable {
case TYPE_IMAGE:
target.addAttribute("type", "image");
break;
- case TYPE_HTML:
- target.addAttribute("type", "html");
+ case TYPE_BROWSER:
+ target.addAttribute("type", "browser");
break;
default:
break;
@@ -472,7 +472,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
* the type to set.
*/
public void setType(int type) {
- if (type != TYPE_OBJECT && type != TYPE_IMAGE && type != TYPE_HTML) {
+ if (type != TYPE_OBJECT && type != TYPE_IMAGE && type != TYPE_BROWSER) {
throw new IllegalArgumentException("Unsupported type");
}
if (type != this.type) {