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-24 08:36:48 +0000 |
commit | 09485d529d085a380b347a118b54df9ae30fefd0 (patch) | |
tree | 6549d3b5fe2df51481b6fe26af78b07ae8a27b8a /server/src/main/java/com/vaadin/ui/AbstractTextField.java | |
parent | 2cdb3b39329232dcefee2ae61ded92f2c3fe54b0 (diff) | |
download | vaadin-framework-09485d529d085a380b347a118b54df9ae30fefd0.tar.gz vaadin-framework-09485d529d085a380b347a118b54df9ae30fefd0.zip |
Initial support for null representations in Binder
Change-Id: If40bfa28764d1399b5ed4d5928988560e9989dce
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 ""; + } } |