diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-10-19 14:54:33 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-10-20 08:19:57 +0000 |
commit | 9f672890c143098b266ede6397e89379a38cc098 (patch) | |
tree | f081ed0c09d5aef76eed2c833b2e9c1229f32577 /server/src/main/java/com/vaadin/ui/AbstractTextField.java | |
parent | 5bc6d1802e2da2c600fb8559474e86ec1b3b4bf7 (diff) | |
download | vaadin-framework-9f672890c143098b266ede6397e89379a38cc098.tar.gz vaadin-framework-9f672890c143098b266ede6397e89379a38cc098.zip |
Initial support for null representations in Binder
Change-Id: I1325c629da220317506306fe8f6fff5c0494d9d9
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/AbstractTextField.java')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/AbstractTextField.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractTextField.java b/server/src/main/java/com/vaadin/ui/AbstractTextField.java index b5119ec92c..9c2720efd8 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractTextField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractTextField.java @@ -17,6 +17,7 @@ package com.vaadin.ui; import java.util.Collection; +import java.util.Objects; import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Element; @@ -80,11 +81,8 @@ public abstract class AbstractTextField extends AbstractField<String> @Override public void setValue(String value) { - if (value == null) { - setValue("", false); - } else { - setValue(value, false); - } + Objects.requireNonNull(value, "Null value not supported"); + setValue(value, false); } /** @@ -270,16 +268,6 @@ public abstract class AbstractTextField extends AbstractField<String> setValue(""); } - /** - * Checks if the field is empty. - * - * @return <code>true</code> if the field value is an empty string, - * <code>false</code> otherwise - */ - public boolean isEmpty() { - return "".equals(getValue()); - } - @Override public void writeDesign(Element design, DesignContext designContext) { super.writeDesign(design, designContext); @@ -299,4 +287,9 @@ public abstract class AbstractTextField extends AbstractField<String> customAttributes.add("cursor-position"); return customAttributes; } + + @Override + public String getEmptyValue() { + return ""; + } } |