org.riotfamily.riot.form.element
Class ObjectChooser

java.lang.Object
  extended by org.riotfamily.forms.AbstractElement
      extended by org.riotfamily.forms.AbstractEditorBase
          extended by org.riotfamily.forms.element.select.AbstractChooser
              extended by org.riotfamily.riot.form.element.ObjectChooser
All Implemented Interfaces:
ContentElement, DHTMLElement, Editor, Element, JavaScriptEventAdapter, ResourceElement, BeanFactoryAware

public class ObjectChooser
extends AbstractChooser
implements BeanFactoryAware


Field Summary
 
Fields inherited from class org.riotfamily.forms.AbstractElement
log
 
Constructor Summary
ObjectChooser()
           
 
Method Summary
protected  void afterFormSet()
           
protected  String getChooserUrl()
           
protected  String getPathUrl()
           
 RiotDao getRiotDao()
           
protected  Object loadBean(String objectId)
           
protected  Object mergeBean(Object bean)
           
protected  void renderLabel(Object object, PrintWriter writer)
           
 void setBeanFactory(BeanFactory beanFactory)
           
 void setDisplay(String display)
           
 void setRootEditorId(String rootEditorId)
          Sets the id of the list that that is initially displayed.
 void setRootIdAttribute(String rootIdAttribute)
          Sets the name of a form attribute that contains the String which should be used as parentId for the root list.
 void setRootProperty(String rootProperty)
          Sets the name of a property on the parent object that refers to the parent object of the root list.
 void setTargetEditorId(String targetEditorId)
          Sets the id of an editor that will be used to list the target objects.
 
Methods inherited from class org.riotfamily.forms.element.select.AbstractChooser
getEventTriggerId, getEventTypes, getInitScript, getResource, getValue, handleContentRequest, handleJavaScriptEvent, processRequest, renderInternal, setObjectId, setValue, validate
 
Methods inherited from class org.riotfamily.forms.AbstractEditorBase
addChangeListener, afterBindingSet, fireChangeEvent, getEditorBinding, getFieldName, getHint, getLabel, getParamName, hasListeners, setEditorBinding, setFieldName, setParamName
 
Methods inherited from class org.riotfamily.forms.AbstractElement
afterFormContextSet, focus, getForm, getFormContext, getFormListener, getId, getParent, getStyleClass, getSystemStyleClass, getWrapperStyleClass, isCompositeElement, isEnabled, isRequired, isVisible, render, render, setEnabled, setForm, setFormContext, setHint, setId, setInline, setLabel, setParent, setReadOnly, setRequired, setStyleClass, setVisible, setWrap
 
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.Editor
addChangeListener, getEditorBinding, getFieldName, getLabel, setEditorBinding, setFieldName
 
Methods inherited from interface org.riotfamily.forms.Element
focus, getForm, getFormContext, getId, getParent, getStyleClass, isCompositeElement, isEnabled, isRequired, isVisible, render, setEnabled, setForm, setFormContext, setId, setParent, setRequired
 
Methods inherited from interface org.riotfamily.forms.Element
focus, getForm, getFormContext, getId, getParent, getStyleClass, isCompositeElement, isEnabled, isRequired, isVisible, render, setEnabled, setForm, setFormContext, setId, setParent, setRequired
 
Methods inherited from interface org.riotfamily.forms.event.JavaScriptEventAdapter
getId
 
Methods inherited from interface org.riotfamily.forms.Element
focus, getForm, getFormContext, getId, getParent, getStyleClass, isCompositeElement, isEnabled, isRequired, isVisible, render, setEnabled, setForm, setFormContext, setId, setParent, setRequired
 

Constructor Detail

ObjectChooser

public ObjectChooser()
Method Detail

setTargetEditorId

public void setTargetEditorId(String targetEditorId)
Sets the id of an editor that will be used to list the target objects. If the specified editor is nested within another list, Riot will display the root list and let the user descend down to the target list.


setRootEditorId

public void setRootEditorId(String rootEditorId)
Sets the id of the list that that is initially displayed. When you specify a nested target editor, the choosing process will start with the root list.

This property allows you to select another list as starting point. Since any non-root list will require a parent id, you have to specify a root property or a root id attribute.


setRootProperty

public void setRootProperty(String rootProperty)
Sets the name of a property on the parent object that refers to the parent object of the root list.

Example: Lets say we had three classes (Foo, Bar, Baz) and the Riot navigation path looked like this:

 
 Foo: foo1 | Bar: bar1 | Baz: new
 
The Baz class has a property "otherBaz" and we want to configure a chooser that lets the user select another Baz object with the same parent (foo1). The configuration would look like this:
 <riot:chooser bind="otherBaz" rootEditorId="bars" rootProperty="foo" />
 
This instructs Riot to invoke the getFoo() method on the bar1 object and use the returned value (foo1) as parent for the "bars" list.


setRootIdAttribute

public void setRootIdAttribute(String rootIdAttribute)
Sets the name of a form attribute that contains the String which should be used as parentId for the root list.


setDisplay

public void setDisplay(String display)

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
                    throws BeansException
Specified by:
setBeanFactory in interface BeanFactoryAware
Throws:
BeansException

afterFormSet

protected void afterFormSet()
Overrides:
afterFormSet in class AbstractElement

getRiotDao

public RiotDao getRiotDao()

loadBean

protected Object loadBean(String objectId)
Specified by:
loadBean in class AbstractChooser

mergeBean

protected Object mergeBean(Object bean)
Specified by:
mergeBean in class AbstractChooser

renderLabel

protected void renderLabel(Object object,
                           PrintWriter writer)
Specified by:
renderLabel in class AbstractChooser

getChooserUrl

protected String getChooserUrl()
Specified by:
getChooserUrl in class AbstractChooser

getPathUrl

protected String getPathUrl()
Specified by:
getPathUrl in class AbstractChooser