summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java38
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/VEmbeddedBrowser.java120
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/flash/FlashConnector.java44
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/flash/VFlash.java228
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/image/ImageConnector.java67
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/image/VImage.java10
-rw-r--r--server/src/com/vaadin/ui/AbstractEmbedded.java84
-rw-r--r--server/src/com/vaadin/ui/EmbeddedBrowser.java19
-rw-r--r--server/src/com/vaadin/ui/Flash.java136
-rw-r--r--server/src/com/vaadin/ui/Image.java94
-rw-r--r--shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java27
-rw-r--r--shared/src/com/vaadin/shared/ui/embeddedbrowser/EmbeddedBrowserState.java7
-rw-r--r--shared/src/com/vaadin/shared/ui/flash/FlashState.java68
-rw-r--r--shared/src/com/vaadin/shared/ui/image/ImageServerRpc.java8
-rw-r--r--shared/src/com/vaadin/shared/ui/image/ImageState.java7
15 files changed, 957 insertions, 0 deletions
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java
new file mode 100644
index 0000000000..61231c4fba
--- /dev/null
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java
@@ -0,0 +1,38 @@
+package com.vaadin.terminal.gwt.client.ui.embeddedbrowser;
+
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.embeddedbrowser.EmbeddedBrowserState;
+import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
+
+@Connect(com.vaadin.ui.EmbeddedBrowser.class)
+public class EmbeddedBrowserConnector extends AbstractComponentConnector {
+
+ @Override
+ protected void init() {
+ super.init();
+ }
+
+ @Override
+ public VEmbeddedBrowser getWidget() {
+ return (VEmbeddedBrowser) super.getWidget();
+ }
+
+ @Override
+ public EmbeddedBrowserState getState() {
+ return (EmbeddedBrowserState) super.getState();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+
+ super.onStateChanged(stateChangeEvent);
+
+ getWidget().setAlternateText(getState().getAlternateText());
+ getWidget().setSource(
+ getState().getSource() != null ? getState().getSource()
+ .getURL() : null);
+ getWidget().setName(getConnectorId());
+ }
+
+}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/VEmbeddedBrowser.java b/client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/VEmbeddedBrowser.java
new file mode 100644
index 0000000000..fffbff049e
--- /dev/null
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/embeddedbrowser/VEmbeddedBrowser.java
@@ -0,0 +1,120 @@
+package com.vaadin.terminal.gwt.client.ui.embeddedbrowser;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.IFrameElement;
+import com.google.gwt.user.client.ui.Widget;
+
+public class VEmbeddedBrowser extends Widget {
+
+ protected IFrameElement iframe;
+ protected Element altElement;
+ protected String altText;
+
+ public VEmbeddedBrowser() {
+ Element root = Document.get().createDivElement();
+ setElement(root);
+
+ setStylePrimaryName("v-embeddedbrowser");
+
+ createAltTextElement();
+ }
+
+ /**
+ * Always creates new iframe inside widget. Will replace previous iframe.
+ *
+ * @return
+ */
+ protected IFrameElement createIFrameElement(String src) {
+ String name = null;
+
+ // Remove alt text
+ if (altElement != null) {
+ getElement().removeChild(altElement);
+ altElement = null;
+ }
+
+ // Remove old iframe
+ if (iframe != null) {
+ name = iframe.getAttribute("name");
+ getElement().removeChild(iframe);
+ iframe = null;
+ }
+
+ iframe = Document.get().createIFrameElement();
+ iframe.setSrc(src);
+ iframe.setFrameBorder(0);
+ iframe.setAttribute("width", "100%");
+ iframe.setAttribute("height", "100%");
+ iframe.setAttribute("allowTransparency", "true");
+
+ getElement().appendChild(iframe);
+
+ // Reset old attributes (except src)
+ if (name != null) {
+ iframe.setName(name);
+ }
+
+ return iframe;
+ }
+
+ protected void createAltTextElement() {
+ if (iframe != null) {
+ return;
+ }
+
+ if (altElement == null) {
+ altElement = Document.get().createSpanElement();
+ getElement().appendChild(altElement);
+ }
+
+ if (altText != null) {
+ altElement.setInnerText(altText);
+ } else {
+ altElement.setInnerText("");
+ }
+ }
+
+ public void setAlternateText(String altText) {
+ if (this.altText != altText) {
+ this.altText = altText;
+ if (altElement != null) {
+ if (altText != null) {
+ altElement.setInnerText(altText);
+ } else {
+ altElement.setInnerText("");
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the source (the "src" attribute) of iframe. Will replace old iframe
+ * with new.
+ *
+ * @param source
+ * Source of iframe.
+ */
+ public void setSource(String source) {
+
+ if (source == null) {
+ if (iframe != null) {
+ getElement().removeChild(iframe);
+ iframe = null;
+ }
+ createAltTextElement();
+ setAlternateText(altText);
+ return;
+ }
+
+ if (iframe == null || iframe.getSrc() != source) {
+ createIFrameElement(source);
+ }
+ }
+
+ public void setName(String name) {
+ if (iframe != null) {
+ iframe.setName(name);
+ }
+ }
+}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/flash/FlashConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/flash/FlashConnector.java
new file mode 100644
index 0000000000..a9e7a71013
--- /dev/null
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/flash/FlashConnector.java
@@ -0,0 +1,44 @@
+package com.vaadin.terminal.gwt.client.ui.flash;
+
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.flash.FlashState;
+import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
+
+@Connect(com.vaadin.ui.Flash.class)
+public class FlashConnector extends AbstractComponentConnector {
+
+ @Override
+ protected void init() {
+ super.init();
+ }
+
+ @Override
+ public VFlash getWidget() {
+ return (VFlash) super.getWidget();
+ }
+
+ @Override
+ public FlashState getState() {
+ return (FlashState) super.getState();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+
+ super.onStateChanged(stateChangeEvent);
+
+ getWidget().setSource(
+ getState().getSource() != null ? getState().getSource()
+ .getURL() : null);
+ getWidget().setArchive(getState().getArchive());
+ getWidget().setClassId(getState().getClassId());
+ getWidget().setCodebase(getState().getCodebase());
+ getWidget().setCodetype(getState().getCodetype());
+ getWidget().setStandby(getState().getStandby());
+ getWidget().setAlternateText(getState().getAlternateText());
+ getWidget().setEmbedParams(getState().getEmbedParams());
+
+ getWidget().rebuildIfNeeded();
+ }
+}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/flash/VFlash.java b/client/src/com/vaadin/terminal/gwt/client/ui/flash/VFlash.java
new file mode 100644
index 0000000000..5d60dc66aa
--- /dev/null
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/flash/VFlash.java
@@ -0,0 +1,228 @@
+package com.vaadin.terminal.gwt.client.ui.flash;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.terminal.gwt.client.Util;
+
+public class VFlash extends HTML {
+
+ protected String source;
+ protected String altText;
+ protected String classId;
+ protected String codebase;
+ protected String codetype;
+ protected String standby;
+ protected String archive;
+ protected Map<String, String> embedParams = new HashMap<String, String>();
+ protected boolean needsRebuild = false;
+ protected String width;
+ protected String height;
+
+ public VFlash() {
+ setStylePrimaryName("v-flash");
+ }
+
+ public void setSource(String source) {
+ if (this.source != source) {
+ this.source = source;
+ needsRebuild = true;
+ }
+ }
+
+ public void setAlternateText(String altText) {
+ if (this.altText != altText) {
+ this.altText = altText;
+ needsRebuild = true;
+ }
+ }
+
+ public void setClassId(String classId) {
+ if (this.classId != classId) {
+ this.classId = classId;
+ needsRebuild = true;
+ }
+ }
+
+ public void setCodebase(String codebase) {
+ if (this.codebase != codebase) {
+ this.codebase = codebase;
+ needsRebuild = true;
+ }
+ }
+
+ public void setCodetype(String codetype) {
+ if (this.codetype != codetype) {
+ this.codetype = codetype;
+ needsRebuild = true;
+ }
+ }
+
+ public void setStandby(String standby) {
+ if (this.standby != standby) {
+ this.standby = standby;
+ needsRebuild = true;
+ }
+ }
+
+ public void setArchive(String archive) {
+ if (this.archive != archive) {
+ this.archive = archive;
+ needsRebuild = true;
+ }
+ }
+
+ /**
+ * Call this after changing values of widget. It will rebuild embedding
+ * structure if needed.
+ */
+ public void rebuildIfNeeded() {
+ if (needsRebuild) {
+ needsRebuild = false;
+ this.setHTML(createFlashEmbed());
+ }
+ }
+
+ @Override
+ public void setWidth(String width) {
+ // super.setWidth(height);
+
+ if (this.width != width) {
+ this.width = width;
+ needsRebuild = true;
+ }
+ }
+
+ @Override
+ public void setHeight(String height) {
+ // super.setHeight(height);
+
+ if (this.height != height) {
+ this.height = height;
+ needsRebuild = true;
+ }
+ }
+
+ public void setEmbedParams(Map<String, String> params) {
+ if (params == null) {
+ if (!embedParams.isEmpty()) {
+ embedParams.clear();
+ needsRebuild = true;
+ }
+ return;
+ }
+
+ if (!embedParams.equals(params)) {
+ embedParams = new HashMap<String, String>(params);
+ needsRebuild = true;
+ }
+ }
+
+ protected String createFlashEmbed() {
+ /*
+ * To ensure cross-browser compatibility we are using the twice-cooked
+ * method to embed flash i.e. we add a OBJECT tag for IE ActiveX and
+ * inside it a EMBED for all other browsers.
+ */
+
+ StringBuilder html = new StringBuilder();
+
+ // Start the object tag
+ html.append("<object ");
+
+ /*
+ * Add classid required for ActiveX to recognize the flash. This is a
+ * predefined value which ActiveX recognizes and must be the given
+ * value. More info can be found on
+ * http://kb2.adobe.com/cps/415/tn_4150.html. Allow user to override
+ * this by setting his own classid.
+ */
+ if (classId != null) {
+ html.append("classid=\"" + Util.escapeAttribute(classId) + "\" ");
+ } else {
+ html.append("classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
+ }
+
+ /*
+ * Add codebase required for ActiveX and must be exactly this according
+ * to http://kb2.adobe.com/cps/415/tn_4150.html to work with the above
+ * given classid. Again, see more info on
+ * http://kb2.adobe.com/cps/415/tn_4150.html. Limiting Flash version to
+ * 6.0.0.0 and above. Allow user to override this by setting his own
+ * codebase
+ */
+ if (codebase != null) {
+ html.append("codebase=\"" + Util.escapeAttribute(codebase) + "\" ");
+ } else {
+ html.append("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" ");
+ }
+
+ // Add width and height
+ html.append("width=\"" + Util.escapeAttribute(width) + "\" ");
+ html.append("height=\"" + Util.escapeAttribute(height) + "\" ");
+ html.append("type=\"application/x-shockwave-flash\" ");
+
+ // Codetype
+ if (codetype != null) {
+ html.append("codetype=\"" + Util.escapeAttribute(codetype) + "\" ");
+ }
+
+ // Standby
+ if (standby != null) {
+ html.append("standby=\"" + Util.escapeAttribute(standby) + "\" ");
+ }
+
+ // Archive
+ if (archive != null) {
+ html.append("archive=\"" + Util.escapeAttribute(archive) + "\" ");
+ }
+
+ // End object tag
+ html.append(">");
+
+ // Ensure we have an movie parameter
+ if (embedParams.get("movie") == null) {
+ embedParams.put("movie", source);
+ }
+
+ // Add parameters to OBJECT
+ for (String name : embedParams.keySet()) {
+ html.append("<param ");
+ html.append("name=\"" + Util.escapeAttribute(name) + "\" ");
+ html.append("value=\""
+ + Util.escapeAttribute(embedParams.get(name)) + "\" ");
+ html.append("/>");
+ }
+
+ // Build inner EMBED tag
+ html.append("<embed ");
+ html.append("src=\"" + Util.escapeAttribute(source) + "\" ");
+ html.append("width=\"" + Util.escapeAttribute(width) + "\" ");
+ html.append("height=\"" + Util.escapeAttribute(height) + "\" ");
+ html.append("type=\"application/x-shockwave-flash\" ");
+
+ // Add the parameters to the Embed
+ for (String name : embedParams.keySet()) {
+ html.append(Util.escapeAttribute(name));
+ html.append("=");
+ html.append("\"" + Util.escapeAttribute(embedParams.get(name))
+ + "\"");
+ }
+
+ // End embed tag
+ html.append("></embed>");
+
+ if (altText != null) {
+ html.append("<noembed>");
+ html.append(altText);
+ html.append("</noembed>");
+ }
+
+ // End object tag
+ html.append("</object>");
+
+ return html.toString();
+ }
+
+}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/image/ImageConnector.java b/client/src/com/vaadin/terminal/gwt/client/ui/image/ImageConnector.java
new file mode 100644
index 0000000000..d36e224a03
--- /dev/null
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/image/ImageConnector.java
@@ -0,0 +1,67 @@
+package com.vaadin.terminal.gwt.client.ui.image;
+
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.event.dom.client.LoadEvent;
+import com.google.gwt.event.dom.client.LoadHandler;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.image.ImageServerRpc;
+import com.vaadin.shared.ui.image.ImageState;
+import com.vaadin.terminal.gwt.client.communication.RpcProxy;
+import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
+import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
+import com.vaadin.terminal.gwt.client.ui.ClickEventHandler;
+
+@Connect(com.vaadin.ui.Image.class)
+public class ImageConnector extends AbstractComponentConnector {
+
+ ImageServerRpc rpc;
+
+ @Override
+ protected void init() {
+ super.init();
+ rpc = RpcProxy.create(ImageServerRpc.class, this);
+ getWidget().addHandler(new LoadHandler() {
+
+ @Override
+ public void onLoad(LoadEvent event) {
+ getLayoutManager().setNeedsMeasure(ImageConnector.this);
+ }
+
+ }, LoadEvent.getType());
+ }
+
+ @Override
+ public VImage getWidget() {
+ return (VImage) super.getWidget();
+ }
+
+ @Override
+ public ImageState getState() {
+ return (ImageState) super.getState();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+
+ clickEventHandler.handleEventHandlerRegistration();
+
+ getWidget().setUrl(
+ getState().getSource() != null ? getState().getSource()
+ .getURL() : null);
+ getWidget().setAltText(getState().getAlternateText());
+ }
+
+ protected final ClickEventHandler clickEventHandler = new ClickEventHandler(
+ this) {
+
+ @Override
+ protected void fireClick(NativeEvent event,
+ MouseEventDetails mouseDetails) {
+ rpc.click(mouseDetails);
+ }
+
+ };
+
+}
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/image/VImage.java b/client/src/com/vaadin/terminal/gwt/client/ui/image/VImage.java
new file mode 100644
index 0000000000..7e6b77ed4a
--- /dev/null
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/image/VImage.java
@@ -0,0 +1,10 @@
+package com.vaadin.terminal.gwt.client.ui.image;
+
+import com.google.gwt.user.client.ui.Image;
+
+public class VImage extends Image {
+
+ public VImage() {
+ setStylePrimaryName("v-image");
+ }
+}
diff --git a/server/src/com/vaadin/ui/AbstractEmbedded.java b/server/src/com/vaadin/ui/AbstractEmbedded.java
new file mode 100644
index 0000000000..9396af5c44
--- /dev/null
+++ b/server/src/com/vaadin/ui/AbstractEmbedded.java
@@ -0,0 +1,84 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.ui;
+
+import com.vaadin.shared.ui.AbstractEmbeddedState;
+import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.gwt.server.ResourceReference;
+
+/**
+ * Abstract base for embedding components.
+ *
+ * @author Vaadin Ltd.
+ * @version
+ * @VERSION@
+ * @since 7.0
+ */
+@SuppressWarnings("serial")
+public abstract class AbstractEmbedded extends AbstractComponent {
+
+ @Override
+ public AbstractEmbeddedState getState() {
+ return (AbstractEmbeddedState) super.getState();
+ }
+
+ /**
+ * Sets the object source resource. The dimensions are assumed if possible.
+ * The type is guessed from resource.
+ *
+ * @param source
+ * the source to set.
+ */
+ public void setSource(Resource source) {
+ if (source == null) {
+ getState().setSource(null);
+ } else {
+ getState().setSource(new ResourceReference(source));
+ }
+ requestRepaint();
+ }
+
+ /**
+ * Get the object source resource.
+ *
+ * @return the source
+ */
+ public Resource getSource() {
+ ResourceReference ref = ((ResourceReference) getState().getSource());
+ if (ref == null) {
+ return null;
+ } else {
+ return ref.getResource();
+ }
+ }
+
+ /**
+ * Sets this component's alternate text that can be presented instead of the
+ * component's normal content for accessibility purposes.
+ *
+ * @param altText
+ * A short, human-readable description of this component's
+ * content.
+ */
+ public void setAlternateText(String altText) {
+ if (altText != getState().getAlternateText()
+ || (altText != null && !altText.equals(getState()
+ .getAlternateText()))) {
+ getState().setAlternateText(altText);
+ requestRepaint();
+ }
+ }
+
+ /**
+ * Gets this component's alternate text that can be presented instead of the
+ * component's normal content for accessibility purposes.
+ *
+ * @returns Alternate text
+ */
+ public String getAlternateText() {
+ return getState().getAlternateText();
+ }
+
+}
diff --git a/server/src/com/vaadin/ui/EmbeddedBrowser.java b/server/src/com/vaadin/ui/EmbeddedBrowser.java
new file mode 100644
index 0000000000..4e2ae18de8
--- /dev/null
+++ b/server/src/com/vaadin/ui/EmbeddedBrowser.java
@@ -0,0 +1,19 @@
+package com.vaadin.ui;
+
+import com.vaadin.shared.ui.embeddedbrowser.EmbeddedBrowserState;
+
+/**
+ * Component for embedding browser "iframe".
+ *
+ * @author Vaadin Ltd.
+ * @version
+ * @VERSION@
+ * @since 7.0
+ */
+public class EmbeddedBrowser extends AbstractEmbedded {
+
+ @Override
+ public EmbeddedBrowserState getState() {
+ return (EmbeddedBrowserState) super.getState();
+ }
+}
diff --git a/server/src/com/vaadin/ui/Flash.java b/server/src/com/vaadin/ui/Flash.java
new file mode 100644
index 0000000000..0e6cf63a91
--- /dev/null
+++ b/server/src/com/vaadin/ui/Flash.java
@@ -0,0 +1,136 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.ui;
+
+import java.util.HashMap;
+
+import com.vaadin.shared.ui.flash.FlashState;
+
+/**
+ * Component for embedding flash objects.
+ *
+ * @author Vaadin Ltd.
+ * @version
+ * @VERSION@
+ * @since 7.0
+ */
+@SuppressWarnings("serial")
+public class Flash extends AbstractEmbedded {
+
+ @Override
+ public FlashState getState() {
+ return (FlashState) super.getState();
+ }
+
+ /**
+ * This attribute specifies the base path used to resolve relative URIs
+ * specified by the classid, data, and archive attributes. When absent, its
+ * default value is the base URI of the current document.
+ *
+ * @param codebase
+ * The base path
+ */
+ public void setCodebase(String codebase) {
+ if (codebase != getState().getCodebase()
+ || (codebase != null && !codebase.equals(getState()
+ .getCodebase()))) {
+ getState().setCodebase(codebase);
+ requestRepaint();
+ }
+ }
+
+ /**
+ * This attribute specifies the content type of data expected when
+ * downloading the object specified by classid. This attribute is optional
+ * but recommended when classid is specified since it allows the user agent
+ * to avoid loading information for unsupported content types. When absent,
+ * it defaults to the value of the type attribute.
+ *
+ * @param codetype
+ * the codetype to set.
+ */
+ public void setCodetype(String codetype) {
+ if (codetype != getState().getCodetype()
+ || (codetype != null && !codetype.equals(getState()
+ .getCodetype()))) {
+ getState().setCodetype(codetype);
+ requestRepaint();
+ }
+ }
+
+ /**
+ * This attribute may be used to specify a space-separated list of URIs for
+ * archives containing resources relevant to the object, which may include
+ * the resources specified by the classid and data attributes. Preloading
+ * archives will generally result in reduced load times for objects.
+ * Archives specified as relative URIs should be interpreted relative to the
+ * codebase attribute.
+ *
+ * @param archive
+ * Space-separated list of URIs with resources relevant to the
+ * object
+ */
+ public void setArchive(String archive) {
+ if (archive != getState().getArchive()
+ || (archive != null && !archive.equals(getState().getArchive()))) {
+ getState().setArchive(archive);
+ requestRepaint();
+ }
+ }
+
+ public void setStandby(String standby) {
+ if (standby != getState().getStandby()
+ || (standby != null && !standby.equals(getState().getStandby()))) {
+ getState().setStandby(standby);
+ requestRepaint();
+ }
+ }
+
+ /**
+ * Sets an object parameter. Parameters are optional information, and they
+ * are passed to the instantiated object. Parameters are are stored as name
+ * value pairs. This overrides the previous value assigned to this
+ * parameter.
+ *
+ * @param name
+ * the name of the parameter.
+ * @param value
+ * the value of the parameter.
+ */
+ public void setParameter(String name, String value) {
+ if (getState().getEmbedParams() == null) {
+ getState().setEmbedParams(new HashMap<String, String>());
+ }
+ getState().getEmbedParams().put(name, value);
+ requestRepaint();
+ }
+
+ /**
+ * Gets the value of an object parameter. Parameters are optional
+ * information, and they are passed to the instantiated object. Parameters
+ * are are stored as name value pairs.
+ *
+ * @return the Value of parameter or null if not found.
+ */
+ public String getParameter(String name) {
+ return getState().getEmbedParams() != null ? getState()
+ .getEmbedParams().get(name) : null;
+ }
+
+ /**
+ * Removes an object parameter from the list.
+ *
+ * @param name
+ * the name of the parameter to remove.
+ */
+ public void removeParameter(String name) {
+ if (getState().getEmbedParams() == null) {
+ return;
+ }
+ getState().getEmbedParams().remove(name);
+ requestRepaint();
+ }
+
+}
diff --git a/server/src/com/vaadin/ui/Image.java b/server/src/com/vaadin/ui/Image.java
new file mode 100644
index 0000000000..b0dbc9e629
--- /dev/null
+++ b/server/src/com/vaadin/ui/Image.java
@@ -0,0 +1,94 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.ui;
+
+import com.vaadin.event.MouseEvents.ClickEvent;
+import com.vaadin.event.MouseEvents.ClickListener;
+import com.vaadin.shared.EventId;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.image.ImageServerRpc;
+import com.vaadin.shared.ui.image.ImageState;
+import com.vaadin.terminal.Resource;
+
+/**
+ * Component for embedding images.
+ *
+ * @author Vaadin Ltd.
+ * @version
+ * @VERSION@
+ * @since 7.0
+ */
+@SuppressWarnings("serial")
+public class Image extends AbstractEmbedded {
+
+ protected ImageServerRpc rpc = new ImageServerRpc() {
+ @Override
+ public void click(MouseEventDetails mouseDetails) {
+ fireEvent(new ClickEvent(Image.this, mouseDetails));
+ }
+ };
+
+ /**
+ * Creates a new empty Image.
+ */
+ public Image() {
+ registerRpc(rpc);
+ }
+
+ /**
+ * Creates a new empty Image with caption.
+ *
+ * @param caption
+ */
+ public Image(String caption) {
+ this();
+ setCaption(caption);
+ }
+
+ /**
+ * Creates a new Image whose contents is loaded from given resource. The
+ * dimensions are assumed if possible. The type is guessed from resource.
+ *
+ * @param caption
+ * @param source
+ * the Source of the embedded object.
+ */
+ public Image(String caption, Resource source) {
+ this(caption);
+ setSource(source);
+ }
+
+ @Override
+ public ImageState getState() {
+ return (ImageState) super.getState();
+ }
+
+ /**
+ * Add a click listener to the component. The listener is called whenever
+ * the user clicks inside the component. Depending on the content the event
+ * may be blocked and in that case no event is fired.
+ *
+ * Use {@link #removeListener(ClickListener)} to remove the listener.
+ *
+ * @param listener
+ * The listener to add
+ */
+ public void addListener(ClickListener listener) {
+ addListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class, listener,
+ ClickListener.clickMethod);
+ }
+
+ /**
+ * Remove a click listener from the component. The listener should earlier
+ * have been added using {@link #addListener(ClickListener)}.
+ *
+ * @param listener
+ * The listener to remove
+ */
+ public void removeListener(ClickListener listener) {
+ removeListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class,
+ listener);
+ }
+}
diff --git a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
new file mode 100644
index 0000000000..96b785edd0
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
@@ -0,0 +1,27 @@
+package com.vaadin.shared.ui;
+
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.communication.URLReference;
+
+public class AbstractEmbeddedState extends ComponentState {
+
+ protected URLReference source;
+ protected String alternateText;
+
+ public URLReference getSource() {
+ return source;
+ }
+
+ public void setSource(URLReference source) {
+ this.source = source;
+ }
+
+ public String getAlternateText() {
+ return alternateText;
+ }
+
+ public void setAlternateText(String alternateText) {
+ this.alternateText = alternateText;
+ }
+
+}
diff --git a/shared/src/com/vaadin/shared/ui/embeddedbrowser/EmbeddedBrowserState.java b/shared/src/com/vaadin/shared/ui/embeddedbrowser/EmbeddedBrowserState.java
new file mode 100644
index 0000000000..cca47176a3
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/embeddedbrowser/EmbeddedBrowserState.java
@@ -0,0 +1,7 @@
+package com.vaadin.shared.ui.embeddedbrowser;
+
+import com.vaadin.shared.ui.AbstractEmbeddedState;
+
+public class EmbeddedBrowserState extends AbstractEmbeddedState {
+
+}
diff --git a/shared/src/com/vaadin/shared/ui/flash/FlashState.java b/shared/src/com/vaadin/shared/ui/flash/FlashState.java
new file mode 100644
index 0000000000..2d33d1a711
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/flash/FlashState.java
@@ -0,0 +1,68 @@
+package com.vaadin.shared.ui.flash;
+
+import java.util.Map;
+
+import com.vaadin.shared.ui.AbstractEmbeddedState;
+
+public class FlashState extends AbstractEmbeddedState {
+
+ protected String classId;
+
+ protected String codebase;
+
+ protected String codetype;
+
+ protected String archive;
+
+ protected String standby;
+
+ protected Map<String, String> embedParams;
+
+ public String getClassId() {
+ return classId;
+ }
+
+ public void setClassId(String classId) {
+ this.classId = classId;
+ }
+
+ public String getCodebase() {
+ return codebase;
+ }
+
+ public void setCodebase(String codeBase) {
+ codebase = codebase;
+ }
+
+ public String getCodetype() {
+ return codetype;
+ }
+
+ public void setCodetype(String codetype) {
+ this.codetype = codetype;
+ }
+
+ public String getArchive() {
+ return archive;
+ }
+
+ public void setArchive(String archive) {
+ this.archive = archive;
+ }
+
+ public String getStandby() {
+ return standby;
+ }
+
+ public void setStandby(String standby) {
+ this.standby = standby;
+ }
+
+ public Map<String, String> getEmbedParams() {
+ return embedParams;
+ }
+
+ public void setEmbedParams(Map<String, String> embedParams) {
+ this.embedParams = embedParams;
+ }
+}
diff --git a/shared/src/com/vaadin/shared/ui/image/ImageServerRpc.java b/shared/src/com/vaadin/shared/ui/image/ImageServerRpc.java
new file mode 100644
index 0000000000..aa48f10e5b
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/image/ImageServerRpc.java
@@ -0,0 +1,8 @@
+package com.vaadin.shared.ui.image;
+
+import com.vaadin.shared.communication.ServerRpc;
+import com.vaadin.shared.ui.ClickRpc;
+
+public interface ImageServerRpc extends ClickRpc, ServerRpc {
+
+}
diff --git a/shared/src/com/vaadin/shared/ui/image/ImageState.java b/shared/src/com/vaadin/shared/ui/image/ImageState.java
new file mode 100644
index 0000000000..4296c76847
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/image/ImageState.java
@@ -0,0 +1,7 @@
+package com.vaadin.shared.ui.image;
+
+import com.vaadin.shared.ui.AbstractEmbeddedState;
+
+public class ImageState extends AbstractEmbeddedState {
+
+}