List of usage examples for org.springframework.beans.propertyeditors CustomBooleanEditor CustomBooleanEditor
public CustomBooleanEditor(boolean allowEmpty)
From source file:org.jasig.cas.client.validation.Cas20ProxyTicketValidatorBeanInfo.java
public PropertyDescriptor[] getPropertyDescriptors() { try {// w w w .j a v a2 s .c om final PropertyDescriptor descriptor = new PropertyDescriptor("allowedProxyChains", Cas20ProxyTicketValidator.class, null, "setAllowedProxyChains") { public PropertyEditor createPropertyEditor(final Object bean) { return new ProxyListPropertyEditor(); } }; final PropertyDescriptor acceptAnyProxy = new PropertyDescriptor("acceptAnyProxy", Cas20ProxyTicketValidator.class, null, "setAcceptAnyProxy") { public PropertyEditor createPropertyEditor(final Object bean) { return new CustomBooleanEditor(true); } }; return new PropertyDescriptor[] { descriptor, acceptAnyProxy }; } catch (final IntrospectionException e) { throw new RuntimeException(e); } }
From source file:de.berlios.jhelpdesk.web.manager.ticketcategory.TicketCategoryEditController.java
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, NumberFormat.getNumberInstance(), true)); binder.registerCustomEditor(Boolean.class, null, new CustomBooleanEditor(true)); }
From source file:org.openmrs.module.radiology.web.RadiologyDashboardObsController.java
@InitBinder void initBinder(WebDataBinder binder) { binder.registerCustomEditor(java.lang.Integer.class, new CustomNumberEditor(java.lang.Integer.class, true)); binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(Context.getDateFormat(), true)); binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(java.lang.Boolean.class, new CustomBooleanEditor(true)); //allow for an empty boolean value binder.registerCustomEditor(Person.class, new PersonEditor()); binder.registerCustomEditor(Order.class, new OrderEditor()); binder.registerCustomEditor(Concept.class, new ConceptEditor()); binder.registerCustomEditor(Drug.class, new DrugEditor()); binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(Encounter.class, new EncounterEditor()); }
From source file:it.cilea.osd.jdyna.widget.WidgetBoolean.java
@Override public PropertyEditor getPropertyEditor(IPersistenceDynaService applicationService) { CustomBooleanEditor propertyEditor = new CustomBooleanEditor(true); return propertyEditor; }
From source file:de.berlios.jhelpdesk.web.manager.users.UserEditController.java
/** * Rejestruje edytory waciwoci niezbdne podczas edycji danych * uytkownika.// ww w .j av a 2s . com * * @param binder * * @see WebDataBinder */ @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Role.class, "userRole", roleEditor); binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, NumberFormat.getNumberInstance(), true)); binder.registerCustomEditor(Boolean.class, null, new CustomBooleanEditor(true)); }
From source file:com.google.ie.web.controller.AuditController.java
/** * Register custom binders for Spring. Needed to run on app engine * /* w w w.j ava 2 s.c om*/ * @param binder * @param request */ @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor(true)); binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); binder.registerCustomEditor(Date.class, new CustomDateEditor(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL), true)); }
From source file:org.openmrs.module.diabetesmanagement.web.controller.PatientObsFormController.java
/** * Allows for Integers, Dates and OpenMRS types to be used as values in input tags. Normally, * only strings and lists are expected./* w w w .j a v a 2 s. c o m*/ * * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest, * org.springframework.web.bind.ServletRequestDataBinder) * @param request Current HTTP request. * @param binder The new binder instance. * @throws Exception In case of errors. */ protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { super.initBinder(request, binder); String datePattern = OpenmrsUtil.getDateFormat().toPattern() + " HH:mm"; binder.registerCustomEditor(java.lang.Integer.class, new CustomNumberEditor(java.lang.Integer.class, true)); binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(new SimpleDateFormat(datePattern), true)); binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(java.lang.Boolean.class, new CustomBooleanEditor(true)); // allow // for // an // empty // boolean // value binder.registerCustomEditor(Person.class, new PersonEditor()); binder.registerCustomEditor(Order.class, new OrderEditor()); binder.registerCustomEditor(Concept.class, new ConceptEditor()); binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(Drug.class, new DrugEditor()); binder.registerCustomEditor(ConceptName.class, new ConceptNameEditor()); }
From source file:org.openmrs.web.controller.observation.ObsFormController.java
/** * Allows for Integers to be used as values in input tags. Normally, only strings and lists are * expected/* w w w . j av a2 s.co m*/ * * @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.util.Date.class, new CustomDateEditor(Context.getDateFormat(), true)); binder.registerCustomEditor(java.util.Date.class, "valueDatetime", new CustomDateEditor(Context.getDateTimeFormat(), true)); binder.registerCustomEditor(java.util.Date.class, "valueTime", new CustomDateEditor(Context.getTimeFormat(), true)); binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(java.lang.Boolean.class, new CustomBooleanEditor(true)); //allow for an empty boolean value binder.registerCustomEditor(Person.class, new PersonEditor()); binder.registerCustomEditor(Order.class, new OrderEditor()); binder.registerCustomEditor(Concept.class, new ConceptEditor()); binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(Encounter.class, new EncounterEditor()); binder.registerCustomEditor(Drug.class, new DrugEditor()); }
From source file:com.google.ie.web.controller.CommentController.java
/** * Register custom binders for Spring. Needed to run on app engine * /*from w w w.j a v a 2s . c o m*/ * @param binder * @param request */ @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor(true)); binder.registerCustomEditor(String.class, new StringEditor(true)); }
From source file:org.finra.dm.core.ArgumentParser.java
/** * Retrieves the argument value, if any, as a String object and converts it to a boolean value. * * @param option the option that we want to query for * @param defaultValue the default value to return if option is not set or missing an argument value * * @return the value of the argument converted to a boolean value or default value when the option is not set or missing an argument value * @throws ParseException if the value of the argument is an invalid boolean value * *//*from ww w . ja va 2 s. c om*/ @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "This is a false positive. A null check is present.") public Boolean getStringValueAsBoolean(Option option, Boolean defaultValue) throws ParseException { Boolean result; ensureCommandLineNotNull(); String stringValue = getStringValue(option); if (StringUtils.isNotBlank(stringValue)) { // Use custom boolean editor without allowed empty strings to convert the value of the argument to a boolean value. CustomBooleanEditor customBooleanEditor = new CustomBooleanEditor(false); try { customBooleanEditor.setAsText(stringValue); } catch (IllegalArgumentException e) { ParseException parseException = new ParseException(e.getMessage()); parseException.initCause(e); throw parseException; } result = (Boolean) customBooleanEditor.getValue(); } else { result = defaultValue; } return result; }