aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/ui/AbstractDateField.java
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2016-09-26 13:46:54 +0300
committerDenis Anisimov <denis@vaadin.com>2016-09-26 13:46:54 +0300
commit0052d59a318075a3ce8202b2eab84e9d643fc544 (patch)
treeae9dce8e660a1759fba44becc4c6deba20b908d4 /server/src/main/java/com/vaadin/ui/AbstractDateField.java
parent0b5e2f34690a2a0f090a93ea1a63475a22ac3d13 (diff)
downloadvaadin-framework-0052d59a318075a3ce8202b2eab84e9d643fc544.tar.gz
vaadin-framework-0052d59a318075a3ce8202b2eab84e9d643fc544.zip
Update DateRangeValidator to be LocalDate based (#320).
Change-Id: I46500d5dd740b806bfa8c3849c54253c6ae92187
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/AbstractDateField.java')
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractDateField.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractDateField.java b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
index f8cda4f355..ac945256f7 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractDateField.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
@@ -17,6 +17,7 @@ package com.vaadin.ui;
import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.Comparator;
import java.util.Date;
import java.util.EventObject;
import java.util.HashMap;
@@ -28,7 +29,7 @@ import java.util.logging.Logger;
import org.jsoup.nodes.Element;
import com.vaadin.data.Result;
-import com.vaadin.data.validator.DateRangeValidator;
+import com.vaadin.data.validator.RangeValidator;
import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusEvent;
@@ -792,9 +793,10 @@ public abstract class AbstractDateField extends AbstractField<Date>
uiHasValidDateString = true;
setComponentError(new UserError(currentParseErrorMessage));
} else {
- DateRangeValidator validator = new DateRangeValidator(
- getDateOutOfRangeMessage(), getRangeStart(getResolution()),
- getRangeEnd(getResolution()), getResolution());
+ RangeValidator<Date> validator = new RangeValidator<>(
+ getDateOutOfRangeMessage(), Comparator.naturalOrder(),
+ getRangeStart(getResolution()),
+ getRangeEnd(getResolution()));
Result<Date> result = validator.apply(value);
if (result.isError()) {
setComponentError(new UserError(getDateOutOfRangeMessage()));