Example usage for org.springframework.web.bind ServletRequestDataBinder registerCustomEditor

List of usage examples for org.springframework.web.bind ServletRequestDataBinder registerCustomEditor

Introduction

In this page you can find the example usage for org.springframework.web.bind ServletRequestDataBinder registerCustomEditor.

Prototype

@Override
    public void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor) 

Source Link

Usage

From source file:teste.framework.Action.java

public void bind(HttpServletRequest request, Object entity) {
    ServletRequestDataBinder db = new ServletRequestDataBinder(entity);
    db.registerCustomEditor(Calendar.class, new CalendarPropertyEditor("yyyy-MM-dd"));
    db.bind(request);/*from  w ww  .  j  av  a  2  s .  c o  m*/
}

From source file:edu.byu.softwareDistribution.web.controller.shopper.ShoppingProductController.java

@InitBinder
public void addProductEditor(ServletRequestDataBinder binder) {
    binder.registerCustomEditor(Product.class, new PropertyEditorSupport() {
        @Override//from www.  ja v a2 s .  c om
        public void setAsText(String text) throws IllegalArgumentException {
            setValue(productDao.findById(Integer.parseInt(text)));
        }
    });
}

From source file:org.ng200.openolympus.controller.BinderAdvice.java

@InitBinder
protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder)
        throws Exception {
    binder.registerCustomEditor(LocalDate.class, BinderAdvice.dateEditor);
    binder.registerCustomEditor(Duration.class, new DurationEditor());
}

From source file:org.eclipse.virgo.samples.formtags.par.web.FormController.java

protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(Country.class, new CountryEditor(this.userManager));
    binder.registerCustomEditor(Colour.class, new PropertyEditorSupport() {
        public void setAsText(String string) throws IllegalArgumentException {
            Integer code = new Integer(string);
            setValue(Colour.getColour(code));
        }/*from www  .  j  a  v  a2 s. co m*/
    });
}

From source file:cz.PA165.vozovyPark.controller.ServiceIntervalController.java

@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
    binder.registerCustomEditor(VehicleDTO.class, new VehicleEditor(this.vehicleService));
}

From source file:org.tonguetied.web.BundleController.java

@Override
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

From source file:org.tonguetied.web.CountryController.java

@Override
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(CountryCode.class, new CountryCodeSupport());
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

From source file:org.ng200.openolympus.controller.admin.AdministrativeChangePasswordController.java

@InitBinder
protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder)
        throws Exception {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

From source file:org.tonguetied.web.LanguageController.java

@Override
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(LanguageCode.class, new LanguageCodeSupport());
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

From source file:no.dusken.aranea.admin.control.EditSectionController.java

protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    super.initBinder(request, binder);
    binder.registerCustomEditor(Section.class, sectionEditor);
    binder.registerCustomEditor(Boolean.class, "active", booleanEditor);
}