A MarkupContainer holds a map of child components.
Children - Children can be added by calling the add() method, and
they can be looked up using a dotted path. For example, if a container called
"a" held a nested container "b" which held a nested component "c", then
a.get("b.c") would return the Component with id "c". The number of children
in a MarkupContainer can be determined by calling size(), and the whole
hierarchy of children held by a MarkupContainer can be traversed by calling
visitChildren(), passing in an implementation of Component.IVisitor.
Markup Rendering - A MarkupContainer also holds/references
associated markup which is used to render the container. As the markup stream
for a container is rendered, component references in the markup are resolved
by using the container to look up Components in the container's component map
by id. Each component referenced by the markup stream is given an opportunity
to render itself using the markup stream.
Components may alter their referring tag, replace the tag's body or insert
markup after the tag. But components cannot remove tags from the markup
stream. This is an important guarantee because graphic designers may be
setting attributes on component tags that affect visual presentation.
The type of markup held in a given container subclass can be determined by
calling getMarkupType(). Markup is accessed via a MarkupStream object which
allows a component to traverse ComponentTag and RawMarkup MarkupElements
while rendering a response. Markup in the stream may be HTML or some other
kind of markup, such as VXML, as determined by the specific container
subclass.
A markup stream may be directly associated with a container via
setMarkupStream. However, a container which does not have a markup stream
(its getMarkupStream() returns null) may inherit a markup stream from a
container above it in the component hierarchy. The findMarkupStream() method
will locate the first container at or above this container which has a markup
stream.
All Page containers set a markup stream before rendering by calling the
method getAssociatedMarkupStream() to load the markup associated with the
page. Since Page is at the top of the container hierarchy, it is guaranteed
that findMarkupStream will always return a valid markup stream.
Components may alter their referring tag, replace the tag's body or insert markup after the tag. But components cannot remove tags from the markup stream. This is an important guarantee because graphic designers may be setting attributes on component tags that affect visual presentation.
The type of markup held in a given container subclass can be determined by calling getMarkupType(). Markup is accessed via a MarkupStream object which allows a component to traverse ComponentTag and RawMarkup MarkupElements while rendering a response. Markup in the stream may be HTML or some other kind of markup, such as VXML, as determined by the specific container subclass.
A markup stream may be directly associated with a container via setMarkupStream. However, a container which does not have a markup stream (its getMarkupStream() returns null) may inherit a markup stream from a container above it in the component hierarchy. The findMarkupStream() method will locate the first container at or above this container which has a markup stream.
All Page containers set a markup stream before rendering by calling the method getAssociatedMarkupStream() to load the markup associated with the page. Since Page is at the top of the container hierarchy, it is guaranteed that findMarkupStream will always return a valid markup stream.