org.mortbay.html
public class Composite extends Element
This class is can be used a either an abstract or concrete holder of other HTML elements. Used directly, it allow multiple HTML Elements to be added which are produced sequentially. Derived used of Composite may wrap each contain Element in special purpose HTML tags (e.g. list).
Notes
Elements are added to the Composite either as HTML Elements or as
Strings. Other objects added to the Composite are converted to Strings
Version: $Id: Composite.java,v 1.6 2004/05/09 20:31:28 gregwilkins Exp $
See Also: Element
Field Summary | |
---|---|
protected ArrayList | elements The vector of elements in this Composite. |
protected Composite | nest |
Constructor Summary | |
---|---|
Composite() Default constructor. | |
Composite(String attributes) Default constructor. |
Method Summary | |
---|---|
Composite | add(Object o) Add an Object to the Composite by converting it to a Element or.
|
String | contents() Contents of the composite. |
Composite | nest(Composite c) Nest a Composite within a Composite.
|
boolean | replace(Object oldObj, Object newObj) Replace an object within the composite. |
Composite | reset() Empty the contents of this Composite . |
Composite | setNest(Composite c) Explicit set of the Nested component.
|
int | size() The number of Elements in this Composite. |
Composite | unnest() Recursively unnest the composites. |
void | write(Writer out) Write the composite.
|
Parameters: o The Object to add. If it is a String or Element, it is added directly, otherwise toString() is called.
Returns: This Composite (for chained commands)
Returns: The Composite to unest on to return to the original state.
Returns: The number of elements in this Composite
Parameters: out Writer to write the element to.