
package de.ivu.elect.jee.presentation.dynamicform;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Locale;

import javax.faces.validator.Validator;

import de.ivu.elect.jee.faces.JahrKleiner10000Validator;

public abstract class AbstractDateProperty extends AbstractTemporalProperty {

  public AbstractDateProperty() {
    super();
  }

  @Override
  public PropertyType getDefaultType() {
    return PropertyType.INPUT_CALENDAR;
  }

  @Override
  protected DateFormat createDateFormat(Locale locale) {
    return DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
  }

  @Override
  public Collection<Validator> getValidators() {
    Collection<Validator> result = new ArrayList<>(super.getValidators());
    result.add(JahrKleiner10000Validator.INSTANCE); // ELECT-3352

    return result;
  }
}
