You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DateRangeValidator.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.data.validator;
  5. import java.util.Date;
  6. import com.vaadin.ui.DateField.Resolution;
  7. /**
  8. * Validator for validating that a Date is inside a given range.
  9. *
  10. * <p>
  11. * Note that the comparison is done directly on the Date object so take care
  12. * that the hours/minutes/seconds/milliseconds of the min/max values are
  13. * properly set.
  14. * </p>
  15. *
  16. * @author Vaadin Ltd.
  17. * @since 7.0
  18. */
  19. public class DateRangeValidator extends RangeValidator<Date> {
  20. /**
  21. * Creates a validator for checking that an Date is within a given range.
  22. * <p>
  23. * By default the range is inclusive i.e. both minValue and maxValue are
  24. * valid values. Use {@link #setMinValueIncluded(boolean)} or
  25. * {@link #setMaxValueIncluded(boolean)} to change it.
  26. * </p>
  27. * <p>
  28. * Note that the comparison is done directly on the Date object so take care
  29. * that the hours/minutes/seconds/milliseconds of the min/max values are
  30. * properly set.
  31. * </p>
  32. *
  33. * @param errorMessage
  34. * the message to display in case the value does not validate.
  35. * @param minValue
  36. * The minimum value to accept or null for no limit
  37. * @param maxValue
  38. * The maximum value to accept or null for no limit
  39. */
  40. public DateRangeValidator(String errorMessage, Date minValue,
  41. Date maxValue, Resolution resolution) {
  42. super(errorMessage, Date.class, minValue, maxValue);
  43. }
  44. }