diff options
author | Artur Signell <artur@vaadin.com> | 2015-05-15 22:02:17 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-05-18 06:41:32 +0000 |
commit | b9a6402e45d50b0bb265e4b138dc5677c9463af4 (patch) | |
tree | 8dabd08d9d67f4d8112866e7a830f727ecfcfbf9 /server/src/com | |
parent | c7392301d0c6afde429d7c6e66d3175f36ab5360 (diff) | |
download | vaadin-framework-b9a6402e45d50b0bb265e4b138dc5677c9463af4.tar.gz vaadin-framework-b9a6402e45d50b0bb265e4b138dc5677c9463af4.zip |
Fix clear/isEmpty in TextArea/PasswordField/RichTextArea/ProgressBar (#17089)
Change-Id: Ic793cbb7eb36408c765a01cc987ba7fe8800b80c
Diffstat (limited to 'server/src/com')
-rw-r--r-- | server/src/com/vaadin/ui/PasswordField.java | 6 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/ProgressBar.java | 15 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/RichTextArea.java | 5 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/TextArea.java | 6 |
4 files changed, 31 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/PasswordField.java b/server/src/com/vaadin/ui/PasswordField.java index 1894804775..ff3b1fea1f 100644 --- a/server/src/com/vaadin/ui/PasswordField.java +++ b/server/src/com/vaadin/ui/PasswordField.java @@ -113,4 +113,10 @@ public class PasswordField extends AbstractTextField { DesignAttributeHandler.writeAttribute("value", attr, getValue(), def.getValue(), String.class); } + + @Override + public void clear() { + setValue(""); + } + } diff --git a/server/src/com/vaadin/ui/ProgressBar.java b/server/src/com/vaadin/ui/ProgressBar.java index c288695ae1..89baac1e64 100644 --- a/server/src/com/vaadin/ui/ProgressBar.java +++ b/server/src/com/vaadin/ui/ProgressBar.java @@ -37,11 +37,13 @@ import com.vaadin.ui.declarative.DesignContext; public class ProgressBar extends AbstractField<Float> implements Property.Viewer, Property.ValueChangeListener { + private static final float DEFAULT_VALUE = 0f; + /** * Creates a new progress bar initially set to 0% progress. */ public ProgressBar() { - this(0); + this(DEFAULT_VALUE); } /** @@ -170,4 +172,15 @@ public class ProgressBar extends AbstractField<Float> implements DesignAttributeHandler.writeAttribute("value", design.attributes(), getValue(), defaultValue, Float.class); } + + @Override + public void clear() { + setValue(DEFAULT_VALUE); + } + + @Override + public boolean isEmpty() { + return super.isEmpty() || getValue() == DEFAULT_VALUE; + + } } diff --git a/server/src/com/vaadin/ui/RichTextArea.java b/server/src/com/vaadin/ui/RichTextArea.java index 763e42ad8b..7c23cce5cb 100644 --- a/server/src/com/vaadin/ui/RichTextArea.java +++ b/server/src/com/vaadin/ui/RichTextArea.java @@ -293,6 +293,11 @@ public class RichTextArea extends AbstractField<String> implements } @Override + public void clear() { + setValue(""); + } + + @Override public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); setValue(design.html()); diff --git a/server/src/com/vaadin/ui/TextArea.java b/server/src/com/vaadin/ui/TextArea.java index c8103f9c5b..b4dfb209e8 100644 --- a/server/src/com/vaadin/ui/TextArea.java +++ b/server/src/com/vaadin/ui/TextArea.java @@ -159,4 +159,10 @@ public class TextArea extends AbstractTextField { super.writeDesign(design, designContext); design.html(getValue()); } + + @Override + public void clear() { + setValue(""); + } + } |