diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2013-07-19 16:09:53 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-07-19 14:17:08 +0000 |
commit | 62c63a6a6dcf97c5a8f7b02e0115fdab096226db (patch) | |
tree | a86de1ced8173a82d0ea20a946a17df940891f6e /server/src/com/vaadin/ui/DateField.java | |
parent | 36aebc81ff63af333a36f7e72d11fe17d06dd97e (diff) | |
download | vaadin-framework-62c63a6a6dcf97c5a8f7b02e0115fdab096226db.tar.gz vaadin-framework-62c63a6a6dcf97c5a8f7b02e0115fdab096226db.zip |
Only add DateRangeValidator to DateField if start or end of range is set (#12193)
Change-Id: I9138a5607c1ff20f3aa7be49270f683e732ee195
Diffstat (limited to 'server/src/com/vaadin/ui/DateField.java')
-rw-r--r-- | server/src/com/vaadin/ui/DateField.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java index 5017fac993..17dda73b95 100644 --- a/server/src/com/vaadin/ui/DateField.java +++ b/server/src/com/vaadin/ui/DateField.java @@ -402,13 +402,14 @@ public class DateField extends AbstractField<Date> implements private void updateRangeValidator() { if (currentRangeValidator != null) { removeValidator(currentRangeValidator); + currentRangeValidator = null; + } + if (getRangeStart() != null || getRangeEnd() != null) { + currentRangeValidator = new DateRangeValidator( + dateOutOfRangeMessage, getRangeStart(resolution), + getRangeEnd(resolution), null); + addValidator(currentRangeValidator); } - - currentRangeValidator = new DateRangeValidator(dateOutOfRangeMessage, - getRangeStart(resolution), getRangeEnd(resolution), null); - - addValidator(currentRangeValidator); - } /** |