public void registerCustomEditors(PropertyEditorRegistry registry) {
   // string trim
   registry.registerCustomEditor(String.class, new StringTrimmerEditor(true));
   // date
   registry.registerCustomEditor(
       java.util.Date.class,
       new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
 }
 @Override
 public void registerCustomEditors(PropertyEditorRegistry binder) {
   binder.registerCustomEditor(
       Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
   // System.out.println("init binder =======================");
   binder.registerCustomEditor(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, false));
   binder.registerCustomEditor(
       Integer.class, null, new CustomNumberEditor(Integer.class, null, true));
   binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, null, true));
   binder.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, true));
   binder.registerCustomEditor(Double.class, new CustomNumberEditor(Double.class, true));
   binder.registerCustomEditor(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));
 }
 @Override
 public void registerCustomEditors(PropertyEditorRegistry registry) {
   registry.registerCustomEditor(DateTime.class, new DateTimeEditor(dateTimeFormatter));
 }
 @Override
 public void registerCustomEditors(final PropertyEditorRegistry registry) {
   registry.registerCustomEditor(Date.class, new DatePropertyEditor());
 }
示例#5
0
  /**
   * Registers all known
   *
   * @param registry
   * @param locale
   */
  public static void registerCustomEditors(PropertyEditorRegistry registry, Locale locale) {
    // Formatters for the different number types.
    NumberFormat floatFormat = NumberFormat.getInstance(locale);
    NumberFormat integerFormat = NumberFormat.getIntegerInstance(locale);

    DateFormat dateFormat = new SimpleDateFormat(DEFAULT_DATE_FORMAT, locale);

    registry.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
    registry.registerCustomEditor(
        BigDecimal.class, new CustomNumberEditor(BigDecimal.class, floatFormat, true));
    registry.registerCustomEditor(
        BigInteger.class, new CustomNumberEditor(BigInteger.class, floatFormat, true));
    registry.registerCustomEditor(
        Double.class, new CustomNumberEditor(Double.class, floatFormat, true));
    registry.registerCustomEditor(
        double.class, new CustomNumberEditor(Double.class, floatFormat, true));
    registry.registerCustomEditor(
        Float.class, new CustomNumberEditor(Float.class, floatFormat, true));
    registry.registerCustomEditor(
        float.class, new CustomNumberEditor(Float.class, floatFormat, true));
    registry.registerCustomEditor(
        Long.class, new CustomNumberEditor(Long.class, integerFormat, true));
    registry.registerCustomEditor(
        long.class, new CustomNumberEditor(Long.class, integerFormat, true));
    registry.registerCustomEditor(
        Integer.class, new CustomNumberEditor(Integer.class, integerFormat, true));
    registry.registerCustomEditor(
        int.class, new CustomNumberEditor(Integer.class, integerFormat, true));
    registry.registerCustomEditor(
        Short.class, new CustomNumberEditor(Short.class, integerFormat, true));
    registry.registerCustomEditor(
        short.class, new CustomNumberEditor(Short.class, integerFormat, true));
    registry.registerCustomEditor(Date.class, new StructuredDateEditor(dateFormat, true));
    registry.registerCustomEditor(Calendar.class, new StructuredDateEditor(dateFormat, true));

    registerCustomEditors(registry);
  }
 @Override
 public void registerCustomEditors(PropertyEditorRegistry registry) {
   registry.registerCustomEditor(
       Date.class, new CustomDateEditor(new SimpleDateFormat("dd-MM-yyyy"), false));
 }
示例#7
0
 public void registerCustomEditors(PropertyEditorRegistry registry) {
   registry.registerCustomEditor(Date.class, new DateEditor());
 }