Example usage for org.springframework.beans.propertyeditors CustomBooleanEditor CustomBooleanEditor

List of usage examples for org.springframework.beans.propertyeditors CustomBooleanEditor CustomBooleanEditor

Introduction

In this page you can find the example usage for org.springframework.beans.propertyeditors CustomBooleanEditor CustomBooleanEditor.

Prototype

public CustomBooleanEditor(@Nullable String trueString, @Nullable String falseString, boolean allowEmpty) 

Source Link

Document

Create a new CustomBooleanEditor instance, with configurable String values for true and false.

Usage

From source file:org.openmrs.module.diseaseregistry.web.controller.program.ProgramController.java

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(java.lang.Boolean.class, new CustomBooleanEditor("true", "false", true));
    binder.registerCustomEditor(org.openmrs.Concept.class, new ConceptWordEditor());
}

From source file:org.openmrs.module.diseaseregistry.web.controller.workflow.WorkflowController.java

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(java.lang.Boolean.class, new CustomBooleanEditor("true", "false", true));
    binder.registerCustomEditor(org.openmrs.Concept.class, new ConceptWordEditor());
    binder.registerCustomEditor(org.openmrs.module.diseaseregistry.api.model.DRProgram.class,
            new DRProgramEditor());
}

From source file:org.openmrs.module.billing.web.controller.tender.TenderFormController.java

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(Context.getDateFormat(), true));
    binder.registerCustomEditor(java.lang.Boolean.class,
            new CustomBooleanEditor(BillingConstants.TRUE, BillingConstants.FALSE, true));
}

From source file:org.openmrs.module.billing.web.controller.miscellaneousservice.MiscellaneousServiceFormController.java

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(Context.getDateFormat(), true));
    binder.registerCustomEditor(java.lang.Boolean.class, new CustomBooleanEditor("true", "false", true));
}

From source file:org.tsm.concharto.web.login.LoginController.java

@Override
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor("true", "false", true));
    super.initBinder(request, binder);
}

From source file:org.openmrs.module.accounting.web.controller.account.AccountFormController.java

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(java.lang.Boolean.class, new CustomBooleanEditor("true", "false", true));
}

From source file:org.openmrs.module.restrictbyenctype.web.controller.EncTypeRestrictionFormController.java

/**
 * Allows for Integers to be used as values in input tags. Normally, only
 * strings and lists are expected/*from w w  w .  j  a v a  2  s. c om*/
 * 
 * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest,
 *      org.springframework.web.bind.ServletRequestDataBinder)
 */
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    super.initBinder(request, binder);

    binder.registerCustomEditor(java.lang.Integer.class, new CustomNumberEditor(java.lang.Integer.class, true));
    binder.registerCustomEditor(java.lang.Double.class, new CustomNumberEditor(java.lang.Double.class, true));
    binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(Context.getDateFormat(), true));
    binder.registerCustomEditor(Role.class, new RolePropertyEditor());
    binder.registerCustomEditor(java.lang.Boolean.class,
            new CustomBooleanEditor(EncTypeRestrictionConstants.TRUE, EncTypeRestrictionConstants.FALSE, true));
    binder.registerCustomEditor(Set.class, "encTypes", new CustomCollectionEditor(Set.class) {
        EncounterService encService = Context.getEncounterService();

        protected Object convertElement(Object element) {
            Integer encounterTypeId = null;
            if (element instanceof Integer)
                encounterTypeId = (Integer) element;
            else if (element instanceof String)
                encounterTypeId = Integer.valueOf((String) element);
            return encounterTypeId != null ? encService.getEncounterType(encounterTypeId) : null;
        }
    });
}

From source file:org.openmrs.web.controller.report.ReportObjectFormController.java

/**
 * Allows for Integers to be used as values in input tags. Normally, only strings and lists are
 * expected/*from   w  w w.  j a va2  s  . c  om*/
 * 
 * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest,
 *      org.springframework.web.bind.ServletRequestDataBinder)
 */

protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    super.initBinder(request, binder);

    binder.registerCustomEditor(Integer.class, new CustomNumberEditor(Integer.class, true));
    binder.registerCustomEditor(Long.class, new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, true));
    binder.registerCustomEditor(Double.class, new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor("t", "f", true));
    binder.registerCustomEditor(Character.class, new CharacterEditor(true));
    // TODO: check this for dates in both locales
    binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(Concept.class, new ConceptEditor());
    binder.registerCustomEditor(Location.class, new LocationEditor());
    binder.registerCustomEditor(User.class, new UserEditor());
}

From source file:org.openmrs.module.dominicamodule.web.controller.EditPatientDrugsPortletController.java

@InitBinder
void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(OrderType.class, new OrderTypeEditor());
    binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor("t", "f", true));
    binder.registerCustomEditor(Integer.class, new CustomNumberEditor(Integer.class, true));
    binder.registerCustomEditor(Concept.class, new ConceptEditor());
    binder.registerCustomEditor(Date.class, new CustomDateEditor(Context.getDateFormat(), true));
    binder.registerCustomEditor(Double.class, new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(User.class, new UserEditor());
    binder.registerCustomEditor(Patient.class, new PatientEditor());
    binder.registerCustomEditor(Encounter.class, new EncounterEditor());
    binder.registerCustomEditor(Drug.class, new DrugEditor());
}

From source file:org.tsm.concharto.web.eventsearch.SearchHelper.java

public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(TimeRange.class, new TimeRangePropertyEditor());
    binder.registerCustomEditor(Geometry.class, new GeometryPropertyEditor());
    binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor("true", "false", true));
}