List of usage examples for org.springframework.beans.propertyeditors CustomCollectionEditor CustomCollectionEditor
@SuppressWarnings("rawtypes") public CustomCollectionEditor(Class<? extends Collection> collectionType)
From source file:org.uimafit.propertyeditors.PropertyEditorUtil.java
public static void registerUimaFITEditors(PropertyEditorRegistry aRegistry) { aRegistry.registerCustomEditor(Locale.class, new LocaleEditor()); aRegistry.registerCustomEditor(String.class, new GetAsTextStringEditor(aRegistry)); aRegistry.registerCustomEditor(LinkedList.class, new CustomCollectionEditor(LinkedList.class)); }
From source file:org.hydroponics.web.controller.EditSchedule.java
@InitBinder() public void initBinder(WebDataBinder binder) throws Exception { binder.registerCustomEditor(ArrayList.class, Constants.PAGE_EDIT_SCHEDULES, new CustomCollectionEditor(ArrayList.class) { protected Object convertElement(Object element) { return super.convertElement(element); }//from ww w . j a v a2 s . com }); }
From source file:org.openmrs.module.radiology.web.controller.template.EditTemplateController.java
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(RadiologyDepartment.class, new RadiologyTemplatePropertyEditor()); binder.registerCustomEditor(Set.class, "tests", new CustomCollectionEditor(Set.class) { protected Object convertElement(Object element) { String conceptName = null; if (element instanceof String) conceptName = (String) element; return conceptName != null ? RadiologyUtil.searchConcept(conceptName) : null; }/*from w ww . ja v a 2 s. c om*/ }); }
From source file:org.openmrs.module.laboratory.web.controller.department.EditDepartmentController.java
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Lab.class, new LaboratoryLabPropertyEditor()); binder.registerCustomEditor(Role.class, new RolePropertyEditor()); binder.registerCustomEditor(Set.class, "investigationsToDisplay", new CustomCollectionEditor(Set.class) { ConceptService conceptService = Context.getConceptService(); protected Object convertElement(Object element) { String conceptName = null; if (element instanceof String) conceptName = (String) element; return conceptName != null ? conceptService.getConcept(conceptName) : null; }/*from w w w . j a v a2 s . co m*/ }); binder.registerCustomEditor(Set.class, "confidentialTestsToDisplay", new CustomCollectionEditor(Set.class) { ConceptService conceptService = Context.getConceptService(); protected Object convertElement(Object element) { String conceptName = null; if (element instanceof String) conceptName = (String) element; return conceptName != null ? conceptService.getConcept(conceptName) : null; } }); }
From source file:org.openmrs.module.radiology.web.controller.department.EditDepartmentController.java
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(RadiologyDepartment.class, new RadiologyDepartmentPropertyEditor()); binder.registerCustomEditor(Role.class, new RolePropertyEditor()); binder.registerCustomEditor(Set.class, "investigations", new CustomCollectionEditor(Set.class) { ConceptService conceptService = Context.getConceptService(); protected Object convertElement(Object element) { String conceptName = null; if (element instanceof String) conceptName = (String) element; return conceptName != null ? conceptService.getConcept(conceptName) : null; }/*ww w . ja v a2 s .com*/ }); }
From source file:org.remus.marketplace.controller.admin.NodeAdminController.java
@Override protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(Set.class, Node.PLATFORMS, new CustomCollectionEditor(Set.class) { @Override//from w w w. j ava 2 s . co m protected Object convertElement(Object element) { if (element instanceof String) { try { return platformCache.get().get(Integer.parseInt((String) element)); } catch (NumberFormatException e) { return null; } } return null; } // @Override // public void setAsText(String text) // throws IllegalArgumentException { // String[] split = text.split(","); // Set<Platform> platforms = new HashSet<Platform>(); // for (String string : split) { // Platform findById = platformDao.findById(Integer // .valueOf(string)); // platforms.add(findById); // } // setValue(platforms); // } }); }
From source file:de.appsolve.padelcampus.admin.controller.bookings.AdminBookingsSettingsController.java
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(LocalDate.class, new LocalDateEditor(DATE_HUMAN_READABLE_PATTERN, false)); binder.registerCustomEditor(SortedSet.class, "offers", new CustomCollectionEditor(SortedSet.class) { @Override/*from ww w . java 2 s .co m*/ protected Object convertElement(Object element) { Long id = Long.parseLong((String) element); return offerDAO.findById(id); } }); }
From source file:org.openmrs.module.patientflags.web.FindFlaggedPatientsController.java
@InitBinder public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(Set.class, "tags", new CustomCollectionEditor(Set.class) { @Override/* w ww . j ava2 s . c o m*/ public Object convertElement(Object element) { return Context.getService(FlagService.class).getTag(Integer.valueOf((String) element)); } }); }
From source file:org.openmrs.module.patientflags.web.EditTagController.java
@InitBinder public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { // map the role name to the actual role binder.registerCustomEditor(Set.class, "roles", new CustomCollectionEditor(Set.class) { @Override/*www . java2s.c o m*/ public Object convertElement(Object element) { return Context.getUserService().getRole((String) element); } }); // map the id to the actual tag binder.registerCustomEditor(Set.class, "displayPoints", new CustomCollectionEditor(Set.class) { @Override public Object convertElement(Object element) { return Context.getService(FlagService.class).getDisplayPoint(Integer.valueOf((String) element)); } }); }
From source file:de.appsolve.padelcampus.admin.controller.bookings.AdminBookingsVoucherController.java
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(LocalDate.class, new LocalDateEditor(DATE_HUMAN_READABLE_PATTERN, false)); binder.registerCustomEditor(SortedSet.class, "offers", new CustomCollectionEditor(SortedSet.class) { @Override//from w w w . j a v a2 s . c o m protected Object convertElement(Object element) { Long id = Long.parseLong((String) element); return offerDAO.findById(id); } }); }