Package org.springframework.beans

Examples of org.springframework.beans.PropertyEditorRegistry


   * This implementation delegates to the
   * {@link #getPropertyEditorRegistry() PropertyEditorRegistry}'s
   * editor lookup facility, if available.
   */
  public PropertyEditor findEditor(String field, Class valueType) {
    PropertyEditorRegistry editorRegistry = getPropertyEditorRegistry();
    if (editorRegistry != null) {
      Class valueTypeToUse = valueType;
      if (valueTypeToUse == null) {
        valueTypeToUse = getFieldType(field);
      }
      return editorRegistry.findCustomEditor(valueTypeToUse, fixedField(field));
    }
    else {
      return null;
    }
  }
View Full Code Here


   * This implementation delegates to the
   * {@link #getPropertyEditorRegistry() PropertyEditorRegistry}'s
   * editor lookup facility, if available.
   */
  public PropertyEditor findEditor(String field, Class<?> valueType) {
    PropertyEditorRegistry editorRegistry = getPropertyEditorRegistry();
    if (editorRegistry != null) {
      Class<?> valueTypeToUse = valueType;
      if (valueTypeToUse == null) {
        valueTypeToUse = getFieldType(field);
      }
      return editorRegistry.findCustomEditor(valueTypeToUse, fixedField(field));
    }
    else {
      return null;
    }
  }
View Full Code Here

   * This implementation delegates to the
   * {@link #getPropertyEditorRegistry() PropertyEditorRegistry}'s
   * editor lookup facility, if available.
   */
  public PropertyEditor findEditor(String field, Class<?> valueType) {
    PropertyEditorRegistry editorRegistry = getPropertyEditorRegistry();
    if (editorRegistry != null) {
      Class<?> valueTypeToUse = valueType;
      if (valueTypeToUse == null) {
        valueTypeToUse = getFieldType(field);
      }
      return editorRegistry.findCustomEditor(valueTypeToUse, fixedField(field));
    }
    else {
      return null;
    }
  }
View Full Code Here

   */
  protected void renderFromValue(Object resolvedValue, TagWriter tagWriter) throws JspException {
    BindStatus bindStatus = getBindStatus();
    PropertyEditor editor = null;
    if (resolvedValue != null && bindStatus.getErrors() instanceof BindingResult) {
      PropertyEditorRegistry editorRegistry = ((BindingResult) bindStatus.getErrors()).getPropertyEditorRegistry();
      if (editorRegistry != null) {
        editor = editorRegistry.findCustomEditor(resolvedValue.getClass(), bindStatus.getPath());
      }
    }
    tagWriter.writeAttribute("value", getDisplayString(resolvedValue, editor));
    if (SelectedValueComparator.isSelected(bindStatus, resolvedValue)) {
      tagWriter.writeAttribute("checked", "checked");
View Full Code Here

  }

  private static boolean exhaustiveCollectionCompare(
      Collection collection, Object candidateValue, BindStatus bindStatus) {

    PropertyEditorRegistry editorRegistry = null;
    if (bindStatus.getErrors() instanceof BindingResult) {
      editorRegistry = ((BindingResult) bindStatus.getErrors()).getPropertyEditorRegistry();
    }
    Map convertedValueCache = new HashMap(1);
    PropertyEditor editor = null;
    boolean candidateIsString = (candidateValue instanceof String);
    if (editorRegistry != null && !candidateIsString) {
      editor = editorRegistry.findCustomEditor(candidateValue.getClass(), bindStatus.getPath());
    }
    for (Iterator it = collection.iterator(); it.hasNext();) {
      Object element = it.next();
      if (editor == null && editorRegistry != null && element != null && candidateIsString) {
        editor = editorRegistry.findCustomEditor(element.getClass(), bindStatus.getPath());
      }
      if (exhaustiveCompare(element, candidateValue, editor, convertedValueCache)) {
        return true;
      }
    }
View Full Code Here

  }

  private static boolean exhaustiveCollectionCompare(
      Collection collection, Object candidateValue, BindStatus bindStatus) {

    PropertyEditorRegistry editorRegistry = null;
    if (bindStatus.getErrors() instanceof BindingResult) {
      editorRegistry = ((BindingResult) bindStatus.getErrors()).getPropertyEditorRegistry();
    }
    Map convertedValueCache = new HashMap(1);
    for (Iterator it = collection.iterator(); it.hasNext();) {
      Object element = it.next();
      PropertyEditor propertyEditor = null;
      if (element != null && editorRegistry != null) {
        propertyEditor = editorRegistry.findCustomEditor(element.getClass(), bindStatus.getPath());
      }
      if (exhaustiveCompare(element, candidateValue, propertyEditor, convertedValueCache)) {
        return true;
      }
    }
View Full Code Here

     * Obtains the PropertyEditorRegistry instance.
     * @return The PropertyEditorRegistry
     */
    public PropertyEditorRegistry getPropertyEditorRegistry() {
        final HttpServletRequest servletRequest = getCurrentRequest();
        PropertyEditorRegistry registry = (PropertyEditorRegistry) servletRequest.getAttribute(GrailsApplicationAttributes.PROPERTY_REGISTRY);
        if (registry == null) {
            registry = new PropertyEditorRegistrySupport();
            PropertyEditorRegistryUtils.registerCustomEditors(this, registry, RequestContextUtils.getLocale(servletRequest));
            servletRequest.setAttribute(GrailsApplicationAttributes.PROPERTY_REGISTRY, registry);
        }
View Full Code Here

   * {@link #getPropertyEditorRegistry() PropertyEditorRegistry}'s
   * editor lookup facility, if available.
   */
  @Override
  public PropertyEditor findEditor(String field, Class<?> valueType) {
    PropertyEditorRegistry editorRegistry = getPropertyEditorRegistry();
    if (editorRegistry != null) {
      Class<?> valueTypeToUse = valueType;
      if (valueTypeToUse == null) {
        valueTypeToUse = getFieldType(field);
      }
      return editorRegistry.findCustomEditor(valueTypeToUse, fixedField(field));
    }
    else {
      return null;
    }
  }
View Full Code Here

   * This implementation delegates to the
   * {@link #getPropertyEditorRegistry() PropertyEditorRegistry}'s
   * editor lookup facility, if available.
   */
  public PropertyEditor findEditor(String field, Class valueType) {
    PropertyEditorRegistry editorRegistry = getPropertyEditorRegistry();
    if (editorRegistry != null) {
      Class valueTypeToUse = valueType;
      if (valueTypeToUse == null) {
        valueTypeToUse = getFieldType(field);
      }
      return editorRegistry.findCustomEditor(valueTypeToUse, fixedField(field));
    }
    else {
      return null;
    }
  }
View Full Code Here

  /**
   * This implementation returns <code>null</code>.
   */
  public PropertyEditor findEditor(String field, Class valueType) {
    PropertyEditorRegistry editorRegistry = getPropertyEditorRegistry();
    if (editorRegistry != null) {
      Class valueTypeToUse = valueType;
      if (valueTypeToUse == null) {
        valueTypeToUse = getFieldType(field);
      }
      return editorRegistry.findCustomEditor(valueTypeToUse, fixedField(field));
    }
    else {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.PropertyEditorRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.