diff options
author | Knoobie <Knoobie@gmx.de> | 2017-09-21 10:52:41 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-21 11:52:41 +0300 |
commit | a166d6f52bf99d7616959f8e16b3972ed6b074d0 (patch) | |
tree | 7433ab3b971fec5316761077d5542fcf0c6cad54 /server/src/main | |
parent | 867006d2f81aa813c36f614fc6f1b98a5937c5f3 (diff) | |
download | vaadin-framework-a166d6f52bf99d7616959f8e16b3972ed6b074d0.tar.gz vaadin-framework-a166d6f52bf99d7616959f8e16b3972ed6b074d0.zip |
Add Upload#setButtonStyleName (#10044)
Diffstat (limited to 'server/src/main')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Upload.java | 31 |
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 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 |