|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectwicket.Component
wicket.MarkupContainer
A MarkupContainer holds a map of child components.
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.
MarkupStream,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class wicket.Component |
Component.ComponentModelChange, Component.IVisitor, Component.VisibilityChange |
| Field Summary |
| Fields inherited from class wicket.Component |
FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4 |
| Constructor Summary | |
MarkupContainer(java.lang.String id)
|
|
MarkupContainer(java.lang.String id,
IModel model)
|
|
| Method Summary | |
MarkupContainer |
add(Component child)
Adds a child component to this container. |
boolean |
autoAdd(Component component)
This method allows a component to be added by an auto-resolver such as AutoComponentResolver or AutoLinkResolver. |
boolean |
contains(Component component,
boolean recurse)
|
protected MarkupStream |
findMarkupStream()
Get the markup stream for this component. |
Component |
get(java.lang.String path)
Get a child component by looking it up with the given path. |
protected MarkupStream |
getAssociatedMarkupStream()
Gets a fresh markup stream that contains the (immutable) markup resource for this class. |
protected MarkupStream |
getMarkupStream()
Get the markup stream set on this container. |
java.lang.String |
getMarkupType()
Get the type of associated markup for this component. |
(package private) boolean |
hasAssociatedMarkup()
|
void |
internalAdd(Component child)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
internalBeginRequest()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
internalEndRequest()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
java.util.Iterator |
iterator()
|
java.util.Iterator |
iterator(java.util.Comparator comparator)
|
protected void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Handle the container's body. |
protected void |
onRender()
Renders this component. |
void |
remove(Component component)
|
void |
remove(java.lang.String id)
Removes the given component |
void |
removeAll()
Removes all children from this container. |
protected void |
renderAll(MarkupStream markupStream)
Renders this component and all sub-components using the given markup stream. |
void |
renderAssociatedMarkup(java.lang.String openTagName,
java.lang.String exceptionMessage)
Renders the entire associated markup stream for a container such as a Border or Panel. |
protected void |
renderComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Renders markup for the body of a ComponentTag from the current position in the given markup stream. |
MarkupContainer |
replace(Component child)
Replaces a child component of this container with another |
protected void |
setMarkupStream(MarkupStream markupStream)
Set markup stream for this container. |
Component |
setModel(IModel model)
Sets the given model. |
int |
size()
Get the number of children in this container. |
java.lang.String |
toString()
Gets the string representation of this component. |
java.lang.String |
toString(boolean detailed)
|
java.lang.Object |
visitChildren(java.lang.Class c,
Component.IVisitor visitor)
Traverses all child components of the given class in this container, calling the visitor's visit method at each one. |
java.lang.Object |
visitChildren(Component.IVisitor visitor)
Traverses all child components in this container, calling the visitor's visit method at each one. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public MarkupContainer(java.lang.String id)
Component.Component(String)
public MarkupContainer(java.lang.String id,
IModel model)
Component.Component(String, IModel)| Method Detail |
public MarkupContainer add(Component child)
child - The child
java.lang.IllegalArgumentException - Thrown if a child with the same id is replaced by the add
operation.public boolean autoAdd(Component component)
The result of all this is that components added with autoAdd() are free from versioning and can add their own children without the usual exception that would normally be thrown when the component hierarchy is modified during rendering.
component - The component to add
public final boolean contains(Component component, boolean recurse)
component - The component to checkrecurse - True if all descendents should be considered
public final Component get(java.lang.String path)
path - Path to component
public java.lang.String getMarkupType()
public void internalAdd(Component child)
child - The child
java.lang.IllegalArgumentException - Thrown if a child with the same id is replaced by the add
operation.public void internalBeginRequest()
internalBeginRequest in class Componentpublic void internalEndRequest()
internalEndRequest in class Componentpublic final java.util.Iterator iterator()
public final java.util.Iterator iterator(java.util.Comparator comparator)
comparator - The comparator
public void remove(Component component)
component - Component to remove from this containerpublic void remove(java.lang.String id)
id - The id of the component to removepublic void removeAll()
public final void renderAssociatedMarkup(java.lang.String openTagName,
java.lang.String exceptionMessage)
openTagName - the tag to render the associated markup forexceptionMessage - message that will be used for exceptionspublic MarkupContainer replace(Component child)
child - The child
java.lang.IllegalArgumentException - Thrown if there was no child with the same id.public Component setModel(IModel model)
Component
model - the model
Component.setModel(wicket.model.IModel)public final int size()
public java.lang.String toString()
Component
Component.toString()public java.lang.String toString(boolean detailed)
detailed - True if a detailed string is desired
public final java.lang.Object visitChildren(java.lang.Class c,
Component.IVisitor visitor)
c - The class of child to visit, or null to visit all childrenvisitor - The visitor to call back to
public final java.lang.Object visitChildren(Component.IVisitor visitor)
visitor - The visitor to call back to
protected final MarkupStream findMarkupStream()
findMarkupStream in class Componentprotected final MarkupStream getAssociatedMarkupStream()
protected MarkupStream getMarkupStream()
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
onComponentTagBody in class ComponentmarkupStream - The markup streamopenTag - The open tag for the bodyprotected void onRender()
protected void renderAll(MarkupStream markupStream)
markupStream - The markup streamprotected final void renderComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
markupStream - The markup streamopenTag - The open tagprotected final void setMarkupStream(MarkupStream markupStream)
markupStream - The markup streamfinal boolean hasAssociatedMarkup()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||