|
|||||||||||
| 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
A basic implementation of the Container interface.
By default,
renders all of its children directly, without wrapping them in any
kind of tag.
However, the SimpleContainer(String, String) constructor
and/or the setTag(String) method can be used to cause the container
to wrap the XML for its children in an arbitrary tag. This functionality
is useful for XSL templating.
For example, a template rule might be
written to arrange the children of this component in paragraphs:
// Java Code: m_container = new SimpleContainer("cms:foo", CMS_XML_NS); // XSL code: <xsl:template match="cms:foo"> <xsl:for-each select="*"> <p> <xsl:apply-templates select="."/> </p> </xsl:for-each> </xsl:template>
| Field Summary | |
static String |
versionId
|
| 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 | |
SimpleContainer()
Constructs a new, empty SimpleContainer. |
|
SimpleContainer(String tag,
String ns)
Constructs a new, empty SimpleContainer that will
wrap its children in the specified tag. |
|
| Method Summary | |
void |
add(Component pc)
Adds a component to this container. |
void |
add(Component c,
int constraints)
Adds a component to this container. |
Iterator |
children()
Returns all the components of this container. |
boolean |
contains(Object o)
Determines membership. |
void |
generateChildrenXML(PageState state,
Element p)
Generates the XML for this container. |
protected Element |
generateParent(Element p)
Generates the containing element. |
void |
generateXML(PageState state,
Element p)
Generates the XML for this container. |
Component |
get(int index)
Gets the component at the specified position. |
String |
getNamespace()
Retrieves the name of the XML namespace for the tag that will be used to wrap the child components. |
String |
getTag()
Retrieves the name of the XML tag that will be used to wrap the child components. |
int |
indexOf(Component pc)
|
boolean |
isEmpty()
Determines whether the container is empty. |
protected void |
setNamespace(String ns)
Sets the XML namespace for the tag that will be used to wrap the children of this container. |
protected void |
setTag(String tag)
Sets the XML tag that will be used to wrap the children of this container. |
int |
size()
Returns the number of children inside this container. |
| 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
| Constructor Detail |
public SimpleContainer()
SimpleContainer.
public SimpleContainer(String tag,
String ns)
SimpleContainer that will
wrap its children in the specified tag.
tag - the name of the XML element that will be used to wrap the
children of this containerns - the namespace for the tag| Method Detail |
public void add(Component pc)
add in interface Containerpc - the component to be added
public void add(Component c,
int constraints)
add in interface Containerconstraints - this parameter is ignored. Child classes should
override the add method if they wish to provide special handling
of constraints.public boolean contains(Object o)
contains in interface Containero - the object type, typically a component. Type
Object allows slicker code when o comes from any kind of collection.
true if the specified object is in this container;
false otherwise.public boolean isEmpty()
isEmpty in interface Containerfalse if the container has any children;
true otherwise.public int indexOf(Component pc)
indexOf in interface Containerpc - component to search for
public int size()
size in interface Containerpublic Component get(int index)
Container
get in interface Containerindex - the index of the item to be retrieved from this
container
public Iterator children()
children in interface Componentchildren in class SimpleComponentprotected final void setTag(String tag)
tag - the XML tag, or null if children will not be wrapped
in any manner.protected final void setNamespace(String ns)
ns - the XML namespacepublic final String getTag()
public final String getNamespace()
protected Element generateParent(Element p)
p - the parent XML element
public void generateChildrenXML(PageState state,
Element p)
state - represents the current requestp - the parent XML elementsetTag(String),
setNamespace(String)
public void generateXML(PageState state,
Element p)
generateXML in interface ComponentgenerateXML in class SimpleComponentstate - represents the current requestp - the parent XML elementsetTag(String),
setNamespace(String)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||