|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.Completable
com.arsdigita.bebop.SimpleComponent
com.arsdigita.bebop.TextStylable
com.arsdigita.bebop.BlockStylable
com.arsdigita.bebop.SimpleContainer
com.arsdigita.cms.ui.DomainObjectRenderer
A Bebop component that takes a {@link DomainObject} and renders it
as XML. The XML can then be styled with XSL in order to insert the
object's properties into the page.
The XML generated by this component will follow the following pattern:
<cms:domainObjectRenderer oid="main_object_oid">
<attributeOne>foo</attributeOne>
<attributeTwo>bar</attributeTwo>
<roleReferenceOne oid="child_object_oid">
<otherAttribute>baz<otherAttribute>
...
</roleReferenceOne>
...
</cms:domainObjectRenderer>
The object which the DomainObjectRenderer
should render is
supplied by a {@link DomainObjectSelectionModel}. Thus, an
{@link com.arsdigita.kernel.ui.ACSObjectSelectionModel}, an {@link com.arsdigita.cms.ItemSelectionModel}, or any other
subclass of {@link DomainObjectSelectionModel} can be used. For example,
String type = "com.arsdigita.kenel.User";
ACSObjectSelectionModel model = new ACSObjectSelectionModel (
type, type, "item_id");
page.addGlobalStateParam(model.getStateParameter());
page.add(new DomainObjectRenderer(model));
Advanced notes:
The {@link #setDepth} method controls how detailed the XML will be.
At depth 1, only the attributes of the main object will be rendered.
At depth 2, the attributes of the main object as well as the children
of the main object will be rendered. At depth 3, the children as well as
the grandchildren will be rendered... and so on. The default depth is 2.
The XML-generating code is aware of loops. Any sub-object which has already
been rendered in XML will be rendered as a stub. For example:
...
<textAsset oid="[com.arsdigita.cms.TextAsset:42]"
<content>I am the text</content>
<parent oid="[com.arsdigita.cms.TextPage:13]" />
...
</textAsset>
...
Null values are not rendered at all in the XML.
Field Summary | |
static String |
CMS_XML_NS
Deprecated. |
static String |
versionId
Deprecated. |
Fields inherited from class com.arsdigita.bebop.BlockStylable |
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP |
Fields inherited from class com.arsdigita.bebop.SimpleComponent |
m_attr |
Fields inherited from interface com.arsdigita.bebop.Component |
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE |
Constructor Summary | |
DomainObjectRenderer(com.arsdigita.kernel.ui.DomainObjectSelectionModel model)
Deprecated. Construct a new DomainObjectRenderer . |
|
DomainObjectRenderer(com.arsdigita.kernel.ui.DomainObjectSelectionModel model,
int depth)
Deprecated. Construct a new DomainObjectRenderer . |
Method Summary | |
protected com.arsdigita.xml.Element |
generateXML(com.arsdigita.domain.DomainObject obj,
String elementName,
String elementNameSpace,
int depthRemaining,
Set visited)
Deprecated. Render the specified object. |
void |
generateXML(com.arsdigita.bebop.PageState state,
com.arsdigita.xml.Element parent)
Deprecated. Generate XML for the domain object supplied by the selection model. |
com.arsdigita.xml.Element |
generateXMLElement(com.arsdigita.domain.DomainObject obj)
Deprecated. Generate XML when you don't have a PageState, only the item |
com.arsdigita.xml.Element |
generateXMLElement(com.arsdigita.bebop.PageState state)
Deprecated. Generate XML for the domain object supplied by the selection model. |
int |
getDepth()
Deprecated. Return the current depth. |
com.arsdigita.domain.DomainObject |
getDomainObject(com.arsdigita.bebop.PageState state)
Deprecated. Return the current domain object |
com.arsdigita.kernel.ui.DomainObjectSelectionModel |
getSelectionModel()
Deprecated. Return the current selection model, which will supply the domain object |
void |
setDepth(int depth)
Deprecated. Set a new depth. |
void |
setDomainObject(com.arsdigita.bebop.PageState state,
com.arsdigita.domain.DomainObject obj)
Deprecated. Select a new domain object |
void |
setSelectionModel(com.arsdigita.kernel.ui.DomainObjectSelectionModel model)
Deprecated. Set the selection model which will supply the domain object |
Methods inherited from class com.arsdigita.bebop.SimpleContainer |
add, add, children, contains, generateChildrenXML, generateParent, get, getNamespace, getTag, indexOf, isEmpty, setNamespace, setTag, size |
Methods inherited from class com.arsdigita.bebop.BlockStylable |
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment |
Methods inherited from class com.arsdigita.bebop.TextStylable |
setBackgroundColor, setColor |
Methods inherited from class com.arsdigita.bebop.SimpleComponent |
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, lock, register, register, respond, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible |
Methods inherited from class com.arsdigita.bebop.Completable |
addCompletionListener, fireCompletionEvent |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.arsdigita.bebop.Component |
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, register, respond, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible |
Methods inherited from interface com.arsdigita.util.Lockable |
isLocked, lock |
Field Detail |
public static final String versionId
public static final String CMS_XML_NS
Constructor Detail |
public DomainObjectRenderer(com.arsdigita.kernel.ui.DomainObjectSelectionModel model)
DomainObjectRenderer
.
model
- Supplies the domain object to be renderedpublic DomainObjectRenderer(com.arsdigita.kernel.ui.DomainObjectSelectionModel model, int depth)
DomainObjectRenderer
.
model
- Supplies the domain object to be rendereddepth
- The object traversal will be limited to this depthMethod Detail |
public int getDepth()
public void setDepth(int depth)
public com.arsdigita.kernel.ui.DomainObjectSelectionModel getSelectionModel()
public void setSelectionModel(com.arsdigita.kernel.ui.DomainObjectSelectionModel model)
public com.arsdigita.domain.DomainObject getDomainObject(com.arsdigita.bebop.PageState state)
state
- the request-specific page statepublic void setDomainObject(com.arsdigita.bebop.PageState state, com.arsdigita.domain.DomainObject obj)
state
- the request-specific page stateobj
- the DomainObject
which will be selected into the
selection modelprotected com.arsdigita.xml.Element generateXML(com.arsdigita.domain.DomainObject obj, String elementName, String elementNameSpace, int depthRemaining, Set visited)
obj
- the DataObject to be renderedelementName
- the name for the current elementelementNameSpace
- the namespace for the current elementdepthRemaining
- if 0, render the object stub and return. Otherwise,
recursevisited
- a set of all previously visited objects. If the object is
already in the set, render the object stub and return.
public com.arsdigita.xml.Element generateXMLElement(com.arsdigita.bebop.PageState state)
public com.arsdigita.xml.Element generateXMLElement(com.arsdigita.domain.DomainObject obj)
obj
- the item to renderpublic void generateXML(com.arsdigita.bebop.PageState state, com.arsdigita.xml.Element parent)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |