List of usage examples for org.springframework.beans PropertyEditorRegistry registerCustomEditor
void registerCustomEditor(@Nullable Class<?> requiredType, @Nullable String propertyPath,
PropertyEditor propertyEditor);
From source file:net.solarnetwork.util.CloningPropertyEditorRegistrar.java
private void registerValue(PropertyEditorRegistry registry, PropertyEditor copy, Object key) { if (key instanceof Class<?>) { registry.registerCustomEditor((Class<?>) key, null, copy); } else {// ww w . j a v a2s .c o m // assume key is String registry.registerCustomEditor(null, (String) key, copy); } }
From source file:it.cilea.osd.jdyna.web.flow.GestionePropertiesDefinition.java
@Override protected void registerPropertyEditors(PropertyEditorRegistry registry) { super.registerPropertyEditors(registry); ModelPropertyEditor propertyEditor = new ModelPropertyEditor(PropertiesDefinition.class); propertyEditor.setApplicationService(applicationService); registry.registerCustomEditor(PropertiesDefinition.class, "rendering.sottoTipologie", propertyEditor); log.debug("Registrato customEditor per le liste di sotto tipologie proprieta della combo"); }
From source file:it.cilea.osd.jdyna.web.flow.RealAnagraficaDTOEditingAction.java
@Override protected void registerPropertyEditors(RequestContext context, PropertyEditorRegistry registry) { AnagraficaObjectAreaDTO commandDTO = null; try {//from w w w . j ava2 s . c o m commandDTO = (AnagraficaObjectAreaDTO) getFormObject(context); } catch (Exception e) { logger.error("Non e' stato possibile estrarre il Command Object dal flusoo", e); } Set<String> shortNames = (commandDTO == null || commandDTO.getAnagraficaProperties() == null) ? null : commandDTO.getAnagraficaProperties().keySet(); for (String shortName : shortNames) { TP tipologiaProprieta = applicationService.findTipologiaProprietaByShortName(clazzTipologiaProprieta, shortName); PropertyEditor propertyEditor = tipologiaProprieta.getRendering().getPropertyEditor(applicationService); if (tipologiaProprieta.getRendering() instanceof WidgetCombo) { WidgetCombo<P, TP> combo = (WidgetCombo<P, TP>) tipologiaProprieta.getRendering(); for (int idx = 0; idx < 100; idx++) { for (TP subtp : combo.getSottoTipologie()) { PropertyEditor subPropertyEditor = subtp.getRendering() .getPropertyEditor(applicationService); String path = "anagraficaProperties[" + shortName + "][" + idx + "].object.anagraficaProperties[" + subtp.getShortName() + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(subPropertyEditor)); registry.registerCustomEditor(Object.class, path + ".object", subPropertyEditor); logger.debug("Registrato Wrapper del property editor: " + propertyEditor + " per il path (combo): " + path); logger.debug("Registrato property editor: " + propertyEditor + " per il path (combo): " + path + ".object"); } } } else { String path = "anagraficaProperties[" + shortName + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(propertyEditor)); // per le checkbox registry.registerCustomEditor(Object.class, path + ".object", propertyEditor); logger.debug("Registrato Wrapper del property editor: " + propertyEditor + " per il path: " + path); logger.debug("Registrato property editor: " + propertyEditor + " per il path: " + path + ".object"); } } }
From source file:it.cilea.osd.jdyna.web.flow.AnagraficaDTOCreationAction.java
@Override protected void registerPropertyEditors(RequestContext context, PropertyEditorRegistry registry) { super.registerPropertyEditors(registry); IAnagraficaObjectDTO commandDTO = null; try {/*from w w w . j av a 2 s . c o m*/ commandDTO = (IAnagraficaObjectDTO) getFormObject(context); } catch (Exception e) { logger.error("Non e' stato possibile estrarre il Command Object dal flusoo", e); } Set<String> shortNames = (commandDTO == null || commandDTO.getAnagraficaProperties() == null) ? null : commandDTO.getAnagraficaProperties().keySet(); if (shortNames != null) { for (String shortName : shortNames) { TP tipologiaProprieta = applicationService .findTipologiaProprietaByShortName(clazzTipologiaProprieta, shortName); PropertyEditor propertyEditor = tipologiaProprieta.getRendering() .getPropertyEditor(applicationService); if (tipologiaProprieta.getRendering() instanceof WidgetCombo) { WidgetCombo<P, TP> combo = (WidgetCombo<P, TP>) tipologiaProprieta.getRendering(); for (int idx = 0; idx < 100; idx++) { for (TP subtp : combo.getSottoTipologie()) { PropertyEditor subPropertyEditor = subtp.getRendering() .getPropertyEditor(applicationService); String path = "anagraficaProperties[" + shortName + "][" + idx + "].object.anagraficaProperties[" + subtp.getShortName() + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(subPropertyEditor)); registry.registerCustomEditor(Object.class, path + ".object", subPropertyEditor); logger.debug("Registrato Wrapper del property editor: " + propertyEditor + " per il path (combo): " + path); logger.debug("Registrato property editor: " + propertyEditor + " per il path (combo): " + path + ".object"); } } } else { String path = "anagraficaProperties[" + shortName + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(propertyEditor)); // per le checkbox registry.registerCustomEditor(Object.class, path + ".object", propertyEditor); logger.debug( "Registrato Wrapper del property editor: " + propertyEditor + " per il path: " + path); logger.debug( "Registrato property editor: " + propertyEditor + " per il path: " + path + ".object"); } } } }
From source file:it.cilea.osd.jdyna.web.flow.AnagraficaDTOWithTypeCreationAction.java
@Override protected void registerPropertyEditors(RequestContext context, PropertyEditorRegistry registry) { IAnagraficaObjectWithTypeDTO commandDTO = null; try {//from w w w .j av a 2s . c om commandDTO = (IAnagraficaObjectWithTypeDTO) getFormObject(context); } catch (Exception e) { logger.error("Non e' stato possibile estrarre il Command Object dal flusoo", e); } Set<String> shortNames = (commandDTO == null || commandDTO.getAnagraficaProperties() == null) ? null : commandDTO.getAnagraficaProperties().keySet(); if (shortNames != null) { for (String shortName : shortNames) { TP tipologiaProprieta = applicationService .findTipologiaProprietaByShortName(clazzTipologiaProprieta, shortName); PropertyEditor propertyEditor = tipologiaProprieta.getRendering() .getPropertyEditor(applicationService); if (tipologiaProprieta.getRendering() instanceof WidgetCombo) { WidgetCombo<P, TP> combo = (WidgetCombo<P, TP>) tipologiaProprieta.getRendering(); for (int idx = 0; idx < 100; idx++) { for (TP subtp : combo.getSottoTipologie()) { PropertyEditor subPropertyEditor = subtp.getRendering() .getPropertyEditor(applicationService); String path = "anagraficaProperties[" + shortName + "][" + idx + "].object.anagraficaProperties[" + subtp.getShortName() + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(subPropertyEditor)); registry.registerCustomEditor(Object.class, path + ".object", subPropertyEditor); logger.debug("Registrato Wrapper del property editor: " + propertyEditor + " per il path (combo): " + path); logger.debug("Registrato property editor: " + propertyEditor + " per il path (combo): " + path + ".object"); } } } else { String path = "anagraficaProperties[" + shortName + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(propertyEditor)); // per le checkbox registry.registerCustomEditor(Object.class, path + ".object", propertyEditor); logger.debug( "Registrato Wrapper del property editor: " + propertyEditor + " per il path: " + path); logger.debug( "Registrato property editor: " + propertyEditor + " per il path: " + path + ".object"); } } } }
From source file:it.cilea.osd.jdyna.web.flow.AnagraficaDTOWithMultiTypeCreationAction.java
@Override protected void registerPropertyEditors(RequestContext context, PropertyEditorRegistry registry) { IAnagraficaObjectWithMultiTypeDTO commandDTO = null; try {//from w ww .jav a 2s . co m commandDTO = (IAnagraficaObjectWithMultiTypeDTO) getFormObject(context); } catch (Exception e) { logger.error("Non e' stato possibile estrarre il Command Object dal flusoo", e); } Set<String> shortNames = (commandDTO == null || commandDTO.getAnagraficaProperties() == null) ? null : commandDTO.getAnagraficaProperties().keySet(); if (shortNames != null) { for (String shortName : shortNames) { TP tipologiaProprieta = applicationService .findTipologiaProprietaByShortName(clazzTipologiaProprieta, shortName); PropertyEditor propertyEditor = tipologiaProprieta.getRendering() .getPropertyEditor(applicationService); if (tipologiaProprieta.getRendering() instanceof WidgetCombo) { WidgetCombo<P, TP> combo = (WidgetCombo<P, TP>) tipologiaProprieta.getRendering(); for (int idx = 0; idx < 100; idx++) { for (TP subtp : combo.getSottoTipologie()) { PropertyEditor subPropertyEditor = subtp.getRendering() .getPropertyEditor(applicationService); String path = "anagraficaProperties[" + shortName + "][" + idx + "].object.anagraficaProperties[" + subtp.getShortName() + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(subPropertyEditor)); registry.registerCustomEditor(Object.class, path + ".object", subPropertyEditor); logger.debug("Registrato Wrapper del property editor: " + propertyEditor + " per il path (combo): " + path); logger.debug("Registrato property editor: " + propertyEditor + " per il path (combo): " + path + ".object"); } } } else { String path = "anagraficaProperties[" + shortName + "]"; registry.registerCustomEditor(ValoreDTO.class, path, new ValoreDTOPropertyEditor(propertyEditor)); // per le checkbox registry.registerCustomEditor(Object.class, path + ".object", propertyEditor); logger.debug( "Registrato Wrapper del property editor: " + propertyEditor + " per il path: " + path); logger.debug( "Registrato property editor: " + propertyEditor + " per il path: " + path + ".object"); } } } }
From source file:no.abmu.questionnaire.propertyeditors.MuseumStatisticPropertyEditorRegistrar.java
@Override public void registerCustomEditors(PropertyEditorRegistry registry) { super.registerCustomEditors(registry); if (logger.isDebugEnabled()) { logger.debug("Executing custom registerCustomEditors"); }//from ww w. ja v a2 s . c o m // MuseumHovedomraade registry.registerCustomEditor(MuseumHovedOmraade.class, "fields[037].value", new MuseumHovedOmraadeEditor("037")); // YesNoPartly registry.registerCustomEditor(YesNoPartly.class, "fields[107].value", new YesNoPartlyEditor("107")); registry.registerCustomEditor(YesNoPartly.class, "fields[142].value", new YesNoPartlyEditor("142")); // MuseumOrganisationForm registry.registerCustomEditor(MuseumOrganizationForm.class, "fields[302].value", new MuseumOrganizationFormEditor("302")); // Date registry.registerCustomEditor(Date.class, "fields[106].value", new DateEditor("106")); registry.registerCustomEditor(Date.class, "fields[227].value", new DateEditor("227")); }
From source file:org.kuali.rice.krad.uif.util.ObjectPropertyUtils.java
/** * Gets a property editor given a specific bean and property path. * //from ww w . ja v a2 s. c o m * @param bean The bean instance. * @param path The property path. * @return property editor */ public static PropertyEditor getPropertyEditor(Object bean, String path) { Class<?> propertyType = getPrimitiveType(getPropertyType(bean, path)); PropertyEditor editor = null; PropertyEditorRegistry registry = getPropertyEditorRegistry(); if (registry != null) { editor = registry.findCustomEditor(propertyType, path); if (editor != null && editor != registry.findCustomEditor(propertyType, null)) { return editor; } if (registry instanceof BeanWrapper && bean == ((BeanWrapper) registry).getWrappedInstance() && (bean instanceof ViewModel)) { ViewModel viewModel = (ViewModel) bean; ViewPostMetadata viewPostMetadata = viewModel.getViewPostMetadata(); PropertyEditor editorFromView = viewPostMetadata == null ? null : viewPostMetadata.getFieldEditor(path); if (editorFromView != null) { registry.registerCustomEditor(propertyType, path, editorFromView); editor = registry.findCustomEditor(propertyType, path); } } } if (editor != null) { return editor; } return getPropertyEditor(propertyType); }