summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Flash.java
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-08-23 18:58:00 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-08-24 16:09:47 +0300
commitf2cb4a9d9b3d5e89e38446906e7b556946f0a82a (patch)
tree227ae56d856e0744da2abe63671dfc0d4ef11424 /server/src/com/vaadin/ui/Flash.java
parente362dec1811c9872419c5ea627c9e157a7abf8a0 (diff)
downloadvaadin-framework-f2cb4a9d9b3d5e89e38446906e7b556946f0a82a.tar.gz
vaadin-framework-f2cb4a9d9b3d5e89e38446906e7b556946f0a82a.zip
Split Embedded into several components, migrate them to Vaadin 7 (#9087)
Diffstat (limited to 'server/src/com/vaadin/ui/Flash.java')
-rw-r--r--server/src/com/vaadin/ui/Flash.java136
1 files changed, 136 insertions, 0 deletions
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();
+ }
+
+}