aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java35
1 files changed, 24 insertions, 11 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 87f726eb15..3986bf3a2a 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
@@ -19,6 +19,7 @@ package com.vaadin.client.ui.upload;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.Paintable;
import com.vaadin.client.UIDL;
+import com.vaadin.client.annotations.OnStateChange;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.VUpload;
@@ -52,17 +53,6 @@ public class UploadConnector extends AbstractComponentConnector
final String action = client
.translateVaadinUri(uidl.getStringVariable("action"));
upload.element.setAction(action);
- if (uidl.hasAttribute("buttoncaption")) {
- upload.submitButton
- .setText(uidl.getStringAttribute("buttoncaption"));
- if (uidl.hasAttribute("buttonstylename")) {
- upload.submitButton.setStyleName(
- uidl.getStringAttribute("buttonstylename"));
- }
- upload.submitButton.setVisible(true);
- } else {
- upload.submitButton.setVisible(false);
- }
upload.fu.setName(upload.paintableId + "_file");
if (!isEnabled()) {
@@ -81,6 +71,29 @@ public class UploadConnector extends AbstractComponentConnector
getWidget().disableTitle(hasTooltip());
}
+ /**
+ * Updates the caption, style name, display mode, and visibility of the
+ * submit button.
+ * <p>
+ * For internal use only. May be removed or replaced in the future.
+ */
+ @OnStateChange({ "buttonCaption", "buttonStyleName",
+ "buttonCaptionAsHtml" })
+ private void updateSubmitButton() {
+ VUpload upload = getWidget();
+ if (getState().buttonCaption != null) {
+ if (getState().buttonCaptionAsHtml) {
+ upload.submitButton.setHtml(getState().buttonCaption);
+ } else {
+ upload.submitButton.setText(getState().buttonCaption);
+ }
+ upload.submitButton.setStyleName(getState().buttonStyleName);
+ upload.submitButton.setVisible(true);
+ } else {
+ upload.submitButton.setVisible(false);
+ }
+ }
+
@Override
public VUpload getWidget() {
return (VUpload) super.getWidget();