summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java4
-rw-r--r--server/src/main/java/com/vaadin/ui/Upload.java31
2 files changed, 35 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java b/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java
index 73c672c370..5b5c4a60e4 100644
--- a/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java
@@ -78,6 +78,10 @@ public class UploadConnector extends AbstractComponentConnector
if (uidl.hasAttribute("buttoncaption")) {
getWidget().submitButton
.setText(uidl.getStringAttribute("buttoncaption"));
+ if (uidl.hasAttribute("buttonstylename")) {
+ getWidget().submitButton
+ .setStyleName(uidl.getStringAttribute("buttonstylename"));
+ }
getWidget().submitButton.setVisible(true);
} else {
getWidget().submitButton.setVisible(false);
diff --git a/server/src/main/java/com/vaadin/ui/Upload.java b/server/src/main/java/com/vaadin/ui/Upload.java
index cdc78bae35..4812c8ffd5 100644
--- a/server/src/main/java/com/vaadin/ui/Upload.java
+++ b/server/src/main/java/com/vaadin/ui/Upload.java
@@ -101,6 +101,8 @@ public class Upload extends AbstractComponent
private String buttonCaption = "Upload";
+ private String buttonStyleName;
+
/**
* ProgressListeners to which information about progress is sent during
* upload
@@ -185,6 +187,9 @@ public class Upload extends AbstractComponent
if (buttonCaption != null) {
target.addAttribute("buttoncaption", buttonCaption);
+ if (buttonStyleName != null) {
+ target.addAttribute("buttonstylename", buttonStyleName);
+ }
}
target.addAttribute("nextid", nextid);
@@ -975,6 +980,8 @@ public class Upload extends AbstractComponent
}
/**
+ * Returns the string rendered into button that fires uploading.
+ *
* @return String to be rendered into button that fires uploading
*/
public String getButtonCaption() {
@@ -982,6 +989,16 @@ public class Upload extends AbstractComponent
}
/**
+ * Returns the stylename rendered into button that fires uploading.
+ *
+ * @return Stylename to be rendered into button that fires uploading
+ * @since 8.2
+ */
+ public String getButtonStyleName() {
+ return buttonStyleName;
+ }
+
+ /**
* In addition to the actual file chooser, upload components have button
* that starts actual upload progress. This method is used to set text in
* that button.
@@ -1009,6 +1026,20 @@ public class Upload extends AbstractComponent
}
/**
+ * In addition to the actual file chooser, upload components have button
+ * that starts actual upload progress. This method is used to set a stylename
+ * to that button.
+ *
+ * @param buttonStyleName styleName for upload components button.
+ * @see #setButtonCaption(String) about when the button is shown / hidden.
+ * @since 8.2
+ */
+ public void setButtonStyleName(String buttonStyleName) {
+ this.buttonStyleName = buttonStyleName;
+ markAsDirty();
+ }
+
+ /**
* Forces the upload the send selected file to the server.
* <p>
* In case developer wants to use this feature, he/she will most probably