summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorIlia Motornyi <elmot@vaadin.com>2018-06-18 13:28:07 +0200
committerGitHub <noreply@github.com>2018-06-18 13:28:07 +0200
commit4608a53c7acaeb46f4f6c89c3f81b2b7e6248164 (patch)
treef03efecb18be7eaf10f89ef587dfa024f422f7cd /server/src
parentb8ed19d5e5597ebb82a4cdd53a941ca4dd06065f (diff)
downloadvaadin-framework-4608a53c7acaeb46f4f6c89c3f81b2b7e6248164.tar.gz
vaadin-framework-4608a53c7acaeb46f4f6c89c3f81b2b7e6248164.zip
Add ACCEPT attribute to Upload (#10906)
Fixes #2410
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main/java/com/vaadin/ui/Upload.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Upload.java b/server/src/main/java/com/vaadin/ui/Upload.java
index 7f5727f078..0e64654d38 100644
--- a/server/src/main/java/com/vaadin/ui/Upload.java
+++ b/server/src/main/java/com/vaadin/ui/Upload.java
@@ -1198,4 +1198,35 @@ public class Upload extends AbstractComponent
protected UploadState getState(boolean markAsDirty) {
return (UploadState) super.getState(markAsDirty);
}
+
+ /**
+ * Returns the component's list of accepted content-types. According to RFC
+ * 1867, the attributeis present, the browser might constrain the file
+ * patterns prompted for to match those with the corresponding appropriate
+ * file extensions for the platform.
+ *
+ * @return comma-separated list of desired mime types to be uploaded
+ * @see #setAcceptMimeTypes
+ * @since
+ */
+ public String getAcceptMimeTypes() {
+ return getState(false).acceptMimeTypes;
+ }
+
+ /**
+ * Sets the component's list of accepted content-types. According to RFC
+ * 1867, the attributeis present, the browser might constrain the file
+ * patterns prompted for to match those with the corresponding appropriate
+ * file extensions for the platform. Good examples are: {@code image/*} or
+ * {@code image/png,text/plain}
+ *
+ * @param acceptMimeTypes
+ * comma-separated list of desired mime types to be uploaded
+ * @see #getAcceptMimeTypes
+ * @since
+ */
+ public void setAcceptMimeTypes(String acceptMimeTypes) {
+ getState().acceptMimeTypes = acceptMimeTypes;
+ }
+
}