Search in sources :

Example 1 with NonNullBooleanEditor

use of org.broadleafcommerce.openadmin.web.editor.NonNullBooleanEditor in project BroadleafCommerce by BroadleafCommerce.

the class AdminBasicEntityController method initBinder.

// *********************************
// ADDITIONAL SPRING-BOUND METHODS *
// *********************************
/**
 * Invoked on every request to provide the ability to register specific binders for Spring's binding process.
 * By default, we register a binder that treats empty Strings as null and a Boolean editor that supports either true
 * or false. If the value is passed in as null, it will treat it as false.
 *
 * @param binder
 */
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    binder.registerCustomEditor(Boolean.class, new NonNullBooleanEditor());
}
Also used : NonNullBooleanEditor(org.broadleafcommerce.openadmin.web.editor.NonNullBooleanEditor) StringTrimmerEditor(org.springframework.beans.propertyeditors.StringTrimmerEditor) InitBinder(org.springframework.web.bind.annotation.InitBinder)

Aggregations

NonNullBooleanEditor (org.broadleafcommerce.openadmin.web.editor.NonNullBooleanEditor)1 StringTrimmerEditor (org.springframework.beans.propertyeditors.StringTrimmerEditor)1 InitBinder (org.springframework.web.bind.annotation.InitBinder)1