aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/ui/AbstractTextField.java
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2016-10-20 08:27:11 +0000
committerVaadin Code Review <review@vaadin.com>2016-10-20 08:43:41 +0000
commit1c11016e7a5b3528001b9ddab513a9d2a94012bc (patch)
tree5a443a8295238289ce5459471c4879fd7dae3e09 /server/src/main/java/com/vaadin/ui/AbstractTextField.java
parent4e33a308d3fd24747e4c16094a0f60b75f60a2a8 (diff)
downloadvaadin-framework-1c11016e7a5b3528001b9ddab513a9d2a94012bc.tar.gz
vaadin-framework-1c11016e7a5b3528001b9ddab513a9d2a94012bc.zip
Revert "Initial support for null representations in Binder"
This reverts commit 9f672890c143098b266ede6397e89379a38cc098. Change-Id: I0952a7f9c7efc8a5d7de9987277b835d92d52b39
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/AbstractTextField.java')
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractTextField.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractTextField.java b/server/src/main/java/com/vaadin/ui/AbstractTextField.java
index 9c2720efd8..b5119ec92c 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractTextField.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractTextField.java
@@ -17,7 +17,6 @@
package com.vaadin.ui;
import java.util.Collection;
-import java.util.Objects;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
@@ -81,8 +80,11 @@ public abstract class AbstractTextField extends AbstractField<String>
@Override
public void setValue(String value) {
- Objects.requireNonNull(value, "Null value not supported");
- setValue(value, false);
+ if (value == null) {
+ setValue("", false);
+ } else {
+ setValue(value, false);
+ }
}
/**
@@ -268,6 +270,16 @@ 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);
@@ -287,9 +299,4 @@ public abstract class AbstractTextField extends AbstractField<String>
customAttributes.add("cursor-position");
return customAttributes;
}
-
- @Override
- public String getEmptyValue() {
- return "";
- }
}