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
Element
Modifier and Type | Field and Description |
---|---|
protected ArrayList |
elements
The vector of elements in this Composite.
|
protected Composite |
nest |
Constructor and Description |
---|
Composite()
Default constructor.
|
Composite(String attributes)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected ArrayList elements
protected Composite nest
public Composite()
public Composite(String attributes)
public Composite add(Object o)
o
- The Object to add. If it is a String or Element, it is
added directly, otherwise toString() is called.public Composite nest(Composite c)
public Composite setNest(Composite c)
public Composite unnest()
public int size()
public void write(Writer out) throws IOException
write
in class Element
out
- Writer to write the element to.IOException
public String contents()
public Composite reset()
Copyright © 2013. All rights reserved.