List of usage examples for com.vaadin.v7.data.validator DateRangeValidator DateRangeValidator
public DateRangeValidator(String errorMessage, Date minValue, Date maxValue, Resolution resolution)
From source file:de.symeda.sormas.ui.contact.ContactCreateForm.java
License:Open Source License
protected void updateLastContactDateValidator() { Field<?> dateField = getField(ContactDto.LAST_CONTACT_DATE); for (Validator validator : dateField.getValidators()) { if (validator instanceof DateRangeValidator) { dateField.removeValidator(validator); }//from www. java 2 s.co m } if (getValue() != null) { dateField.addValidator(new DateRangeValidator( I18nProperties.getValidationError(Validations.beforeDate, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, ContactDto.LAST_CONTACT_DATE), I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, ContactDto.REPORT_DATE_TIME)), null, new LocalDate(getValue().getReportDateTime()).toDate(), Resolution.SECOND)); } }
From source file:de.symeda.sormas.ui.contact.ContactDataForm.java
License:Open Source License
protected void updateLastContactDateValidator() { Field<?> dateField = getField(ContactDto.LAST_CONTACT_DATE); for (Validator validator : dateField.getValidators()) { if (validator instanceof DateRangeValidator) { dateField.removeValidator(validator); }//from w w w . j a va2 s.c o m } if (getValue() != null) { dateField.addValidator(new DateRangeValidator( I18nProperties.getValidationError(Validations.beforeDate, dateField.getCaption(), getField(ContactDto.REPORT_DATE_TIME).getCaption()), null, new LocalDate(getValue().getReportDateTime()).plusDays(1).toDate(), Resolution.SECOND)); } }