org.riotfamily.riot.editor
Class AbstractObjectEditorDefinition

java.lang.Object
  extended by org.riotfamily.riot.editor.AbstractEditorDefinition
      extended by org.riotfamily.riot.editor.AbstractObjectEditorDefinition
All Implemented Interfaces:
EditorDefinition, ObjectEditorDefinition
Direct Known Subclasses:
CustomEditorDefinition, FormDefinition, GroupDefinition, IntermediateDefinition, ViewDefinition

public abstract class AbstractObjectEditorDefinition
extends AbstractEditorDefinition
implements ObjectEditorDefinition

Abstract base class for editors that display a single object.

See Also:
FormDefinition, ViewDefinition

Constructor Summary
AbstractObjectEditorDefinition()
           
 
Method Summary
 void addChildEditorDefinition(EditorDefinition editorDef)
           
 EditorReference createEditorPath(Object bean, MessageResolver messageResolver)
          Returns a PathComponent for the given bean that represents the complete path to the form.
 EditorReference createEditorPath(String objectId, String parentId, String parentEditorId, MessageResolver messageResolver)
          Returns a PathComponent for the given objectId and parentId that represents the complete path to the form.
protected  EditorReference createPathComponent(Object bean, String parentId, String parentEditorId, MessageResolver messageResolver)
          Creates a PathComponent for the given bean (or parentId).
 EditorReference createReference(String objectId, MessageResolver messageResolver)
          Creates a reference to an editor.
 Class<?> getBeanClass()
           
 List<EditorDefinition> getChildEditorDefinitions()
           
 List<EditorReference> getChildEditorReferences(Object object, MessageResolver messageResolver)
           
 String getEditorUrl(String objectId, String parentId, String parentEditorId)
           
protected  String getEditorUrlWithinServlet(String objectId, String parentId)
           
protected abstract  String getEditorUrlWithinServlet(String objectId, String parentId, String parentEditorId)
           
 String getLabel(Object object, MessageResolver messageResolver)
           
protected  String getLabelProperty()
           
protected  Object loadBean(String objectId)
           
 void setBeanClass(Class<?> beanClass)
           
 void setLabelProperty(String labelProperty)
           
 
Methods inherited from class org.riotfamily.riot.editor.AbstractEditorDefinition
addReference, equals, getDefaultName, getEditorRepository, getIcon, getId, getLabel, getMessageKey, getName, getParentEditorDefinition, hashCode, isHidden, setEditorRepository, setHidden, setIcon, setId, setName, setParentEditorDefinition, show
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.riotfamily.riot.editor.EditorDefinition
addReference, getEditorType, getId, getParentEditorDefinition, isHidden, setParentEditorDefinition, show
 

Constructor Detail

AbstractObjectEditorDefinition

public AbstractObjectEditorDefinition()
Method Detail

getBeanClass

public Class<?> getBeanClass()
Specified by:
getBeanClass in interface EditorDefinition
Overrides:
getBeanClass in class AbstractEditorDefinition

setBeanClass

public void setBeanClass(Class<?> beanClass)

setLabelProperty

public void setLabelProperty(String labelProperty)

getLabelProperty

protected String getLabelProperty()

getLabel

public String getLabel(Object object,
                       MessageResolver messageResolver)
Specified by:
getLabel in interface EditorDefinition
Overrides:
getLabel in class AbstractEditorDefinition

getChildEditorDefinitions

public List<EditorDefinition> getChildEditorDefinitions()
Specified by:
getChildEditorDefinitions in interface ObjectEditorDefinition

getChildEditorReferences

public List<EditorReference> getChildEditorReferences(Object object,
                                                      MessageResolver messageResolver)
Specified by:
getChildEditorReferences in interface ObjectEditorDefinition

addChildEditorDefinition

public void addChildEditorDefinition(EditorDefinition editorDef)
Specified by:
addChildEditorDefinition in interface ObjectEditorDefinition

loadBean

protected Object loadBean(String objectId)

createEditorPath

public EditorReference createEditorPath(String objectId,
                                        String parentId,
                                        String parentEditorId,
                                        MessageResolver messageResolver)
Returns a PathComponent for the given objectId and parentId that represents the complete path to the form.

Specified by:
createEditorPath in interface EditorDefinition
Parameters:
objectId - Id of the object to be edited or null if a form for a new object is requested
parentId - Id of the the parent object or null if either an existing object is to be edited or the form belongs to a root list

createEditorPath

public EditorReference createEditorPath(Object bean,
                                        MessageResolver messageResolver)
Returns a PathComponent for the given bean that represents the complete path to the form.

Specified by:
createEditorPath in interface EditorDefinition

createPathComponent

protected EditorReference createPathComponent(Object bean,
                                              String parentId,
                                              String parentEditorId,
                                              MessageResolver messageResolver)
Creates a PathComponent for the given bean (or parentId). This method is not recursive and getParent() will always return null.

Parameters:
bean - The bean to be edited or null if a form for a new (unsaved) object is requested.
parentId - Id of the the parent object or null if either an existing object is to be edited or the form belongs to a root list
parentEditorId - Id of the parent editor or null if no parentId is specified

createReference

public EditorReference createReference(String objectId,
                                       MessageResolver messageResolver)
Description copied from interface: EditorDefinition
Creates a reference to an editor. The method is used by the EditorGroupController.

Specified by:
createReference in interface EditorDefinition

getEditorUrl

public String getEditorUrl(String objectId,
                           String parentId,
                           String parentEditorId)
Specified by:
getEditorUrl in interface EditorDefinition

getEditorUrlWithinServlet

protected final String getEditorUrlWithinServlet(String objectId,
                                                 String parentId)

getEditorUrlWithinServlet

protected abstract String getEditorUrlWithinServlet(String objectId,
                                                    String parentId,
                                                    String parentEditorId)