org.riotfamily.forms
Class AbstractEditorBinder

java.lang.Object
  extended by org.springframework.beans.PropertyEditorRegistrySupport
      extended by org.riotfamily.forms.AbstractEditorBinder
All Implemented Interfaces:
EditorBinder, PropertyEditorRegistry
Direct Known Subclasses:
BeanEditorBinder, ContentContainerEditorBinder, ContentEditorBinder, MapEditorBinder

public abstract class AbstractEditorBinder
extends PropertyEditorRegistrySupport
implements EditorBinder

This class is used to bind a form element to the property of a bean. The form element must implement the Editor interface.


Constructor Summary
AbstractEditorBinder()
           
 
Method Summary
 void bind(Editor editor, String property)
          Binds the given editor to the property with the specified name.
protected  Editor findEditorByProperty(String property)
           
 Map<String,EditorBinding> getBindings()
           
 String[] getBoundProperties()
          Returns the names of all properties an editor is bound to.
 Editor getEditor(String property)
          Returns the editor that is bound to the given property.
 PropertyEditor getPropertyEditor(Class<?> type, String propertyPath)
           
protected  String getPropertyPath(Editor editor, String property)
           
abstract  Class<?> getPropertyType(String path)
           
 void initEditors()
          Initializes each editor with the property value it is bound to or null if the backingObject is not set.
 Object populateBackingObject()
          Sets the properties of the backingObject to the values provided by the corresponding editor.
 void registerPropertyEditors(PropertyEditorRegistrar[] registrars)
           
 EditorBinder replace(EditorBinder previousBinder)
           
 void setBackingObject(Object backingObject)
           
protected  void setBackingObjectInternal(Object backingObject)
           
 
Methods inherited from class org.springframework.beans.PropertyEditorRegistrySupport
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, isSharedEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, registerSharedEditor, useConfigValueEditors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.riotfamily.forms.EditorBinder
getBackingObject, getBeanClass, getPropertyValue, isEditingExistingBean, setPropertyValue
 
Methods inherited from interface org.springframework.beans.PropertyEditorRegistry
findCustomEditor, registerCustomEditor, registerCustomEditor
 

Constructor Detail

AbstractEditorBinder

public AbstractEditorBinder()
Method Detail

getPropertyType

public abstract Class<?> getPropertyType(String path)
Specified by:
getPropertyType in interface EditorBinder
Overrides:
getPropertyType in class PropertyEditorRegistrySupport

getBindings

public Map<String,EditorBinding> getBindings()
Specified by:
getBindings in interface EditorBinder

replace

public EditorBinder replace(EditorBinder previousBinder)
Specified by:
replace in interface EditorBinder

bind

public void bind(Editor editor,
                 String property)
Description copied from interface: EditorBinder
Binds the given editor to the property with the specified name.

Specified by:
bind in interface EditorBinder
Parameters:
editor - the editor to bind
property - the name of the property the editor is to be bound to

getEditor

public Editor getEditor(String property)
Description copied from interface: EditorBinder
Returns the editor that is bound to the given property.

Specified by:
getEditor in interface EditorBinder

findEditorByProperty

protected Editor findEditorByProperty(String property)

getBoundProperties

public String[] getBoundProperties()
Description copied from interface: EditorBinder
Returns the names of all properties an editor is bound to.

Specified by:
getBoundProperties in interface EditorBinder

registerPropertyEditors

public void registerPropertyEditors(PropertyEditorRegistrar[] registrars)
Specified by:
registerPropertyEditors in interface EditorBinder

setBackingObject

public final void setBackingObject(Object backingObject)
Specified by:
setBackingObject in interface EditorBinder

setBackingObjectInternal

protected void setBackingObjectInternal(Object backingObject)

initEditors

public void initEditors()
Description copied from interface: EditorBinder
Initializes each editor with the property value it is bound to or null if the backingObject is not set.

Specified by:
initEditors in interface EditorBinder
See Also:
Editor.setValue(Object)

populateBackingObject

public Object populateBackingObject()
Description copied from interface: EditorBinder
Sets the properties of the backingObject to the values provided by the corresponding editor. If the backingObject is null a new instance is created.

Specified by:
populateBackingObject in interface EditorBinder
Returns:
the populated backingObject

getPropertyEditor

public PropertyEditor getPropertyEditor(Class<?> type,
                                        String propertyPath)
Specified by:
getPropertyEditor in interface EditorBinder

getPropertyPath

protected String getPropertyPath(Editor editor,
                                 String property)