Example usage for com.vaadin.v7.shared.ui.datefield Resolution SECOND

List of usage examples for com.vaadin.v7.shared.ui.datefield Resolution SECOND

Introduction

In this page you can find the example usage for com.vaadin.v7.shared.ui.datefield Resolution SECOND.

Prototype

Resolution SECOND

To view the source code for com.vaadin.v7.shared.ui.datefield Resolution SECOND.

Click Source Link

Usage

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);
        }//www .j  a v a  2  s  . c  o  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   ww  w  .j  ava 2  s.  com
    }
    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));
    }
}