| java.lang.Object wicket.Component wicket.MarkupContainer
All known Subclasses: wicket.markup.html.WebMarkupContainer, wicket.Page, wicket.markup.transformer.AbstractOutputTransformerContainer,
MarkupContainer | abstract public class MarkupContainer extends Component (Code) | | 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.
See Also: MarkupStream author: Jonathan Locke |
Method Summary | |
final public MarkupContainer | add(Component child) Adds a child component to this container.
Be careful when overriding this method, if not implemented properly it
may lead to a java component hierarchy which no longer matches the
template hierarchy, which in turn will lead to an error.
Parameters: child - The child throws: IllegalArgumentException - Thrown if a child with the same id is replaced by the addoperation. | final public boolean | autoAdd(Component component) This method allows a component to be added by an auto-resolver such as
AutoComponentResolver or AutoLinkResolver. | final public boolean | contains(Component component, boolean recurse) | final protected MarkupStream | findMarkupStream() Get the markup stream for this component. | final public Component | get(String path) Get a child component by looking it up with the given path. | final public MarkupStream | getAssociatedMarkupStream(boolean throwException) Gets a fresh markup stream that contains the (immutable) markup resource
for this class. | final public MarkupStream | getMarkupStream() Get the markup stream set on this container. | public String | getMarkupType() Get the type of associated markup for this component.
The type of associated markup for this component (for example,"html", "wml" or "vxml"). | final boolean | hasAssociatedMarkup() | public void | internalAdd(Component child) THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. | public void | internalAttach() THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. | public void | internalDetach() THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. | public boolean | isTransparentResolver() Some MarkupContainers (e.g. | final public Iterator | iterator() | final public Iterator | iterator(Comparator comparator) | public IResourceStream | newMarkupResourceStream(Class containerClass) Create a new markup resource stream for the container. | protected void | onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) Handle the container's body. | protected void | onRender(MarkupStream markupStream) Renders this component. | public void | remove(Component component) | final public void | remove(String id) | final public 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. | final public void | renderAssociatedMarkup(String openTagName, String exceptionMessage) Renders the entire associated markup stream for a container such as a
Border or Panel. | final protected void | renderComponentTagBody(MarkupStream markupStream, ComponentTag openTag) Renders markup for the body of a ComponentTag from the current position
in the given markup stream. | final public MarkupContainer | replace(Component child) Replaces a child component of this container with another
Parameters: child - The child throws: IllegalArgumentException - Thrown if there was no child with the same id. | final protected void | setMarkupStream(MarkupStream markupStream) Set markup stream for this container. | public Component | setModel(IModel model) | final public int | size() Get the number of children in this container. | public String | toString() | public String | toString(boolean detailed) | final public Object | visitChildren(Class clazz, IVisitor visitor) Traverses all child components of the given class in this container,
calling the visitor's visit method at each one. | final public Object | visitChildren(IVisitor visitor) Traverses all child components in this container, calling the visitor's
visit method at each one. |
add | final public MarkupContainer add(Component child)(Code) | | Adds a child component to this container.
Be careful when overriding this method, if not implemented properly it
may lead to a java component hierarchy which no longer matches the
template hierarchy, which in turn will lead to an error.
Parameters: child - The child throws: IllegalArgumentException - Thrown if a child with the same id is replaced by the addoperation. This |
autoAdd | final public boolean autoAdd(Component component)(Code) | | This method allows a component to be added by an auto-resolver such as
AutoComponentResolver or AutoLinkResolver. While the component is being
added, the component's FLAG_AUTO boolean is set. The isAuto() method of
Component returns true if a component or any of its parents has this bit
set. When a component is added via autoAdd(), the logic in Page that
normally (a) checks for modifications during the rendering process, and
(b) versions components, is bypassed if Component.isAuto() returns true.
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.
Parameters: component - The component to add True, if component has been added |
contains | final public boolean contains(Component component, boolean recurse)(Code) | | Parameters: component - The component to check Parameters: recurse - True if all descendents should be considered True if the component is contained in this container |
findMarkupStream | final protected MarkupStream findMarkupStream()(Code) | | Get the markup stream for this component.
The markup stream for this component, or if it doesn't have one,the markup stream for the nearest parent which does have one |
get | final public Component get(String path)(Code) | | Get a child component by looking it up with the given path.
Parameters: path - Path to component The component at the path |
getAssociatedMarkupStream | final public MarkupStream getAssociatedMarkupStream(boolean throwException)(Code) | | Gets a fresh markup stream that contains the (immutable) markup resource
for this class.
Parameters: throwException - If true, throw an exception, if markup could not be found A stream of MarkupElement elements |
getMarkupStream | final public MarkupStream getMarkupStream()(Code) | | Get the markup stream set on this container.
Returns the markup stream set on this container. |
getMarkupType | public String getMarkupType()(Code) | | Get the type of associated markup for this component.
The type of associated markup for this component (for example,"html", "wml" or "vxml"). The markup type for a component isindependent of whether or not the component actually has anassociated markup resource file (which is determined at runtime).If there is no markup type for a component, null may be returned,but this means that no markup can be loaded for the class. |
hasAssociatedMarkup | final boolean hasAssociatedMarkup()(Code) | | True if this markup container has associated markup |
internalAdd | public void internalAdd(Component child)(Code) | | THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT.
Adds a child component to this container.
Parameters: child - The child throws: IllegalArgumentException - Thrown if a child with the same id is replaced by the addoperation. |
internalAttach | public void internalAttach()(Code) | | THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
OVERRIDE.
Called when a request begins.
|
internalDetach | public void internalDetach()(Code) | | THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
OVERRIDE.
Called when a request ends.
|
isTransparentResolver | public boolean isTransparentResolver()(Code) | | Some MarkupContainers (e.g. HtmlHeaderContainer, BodyOnLoadContainer)
have to be transparent with respect to there child components. A
transparent container gets its children from its parent container.
See Also: wicket.markup.resolver.ParentResolver false. By default a MarkupContainer is not transparent. |
iterator | final public Iterator iterator()(Code) | | Iterator that iterates through children in the order they wereadded |
iterator | final public Iterator iterator(Comparator comparator)(Code) | | Parameters: comparator - The comparator Iterator that iterates over children in the order specified bycomparator |
newMarkupResourceStream | public IResourceStream newMarkupResourceStream(Class containerClass)(Code) | | Create a new markup resource stream for the container.
Note: it will only called once, the IResourceStream will be cached by
MarkupCache.
Note: IResourceStreamLocators should be used in case the strategy to find
a markup resource should be extended for ALL components of your
application.
See Also: wicket.util.resource.locator.IResourceStreamLocator See Also: wicket.markup.MarkupCache Parameters: containerClass - The container the markup should be associated with A IResourceStream if the resource was found |
onComponentTagBody | protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)(Code) | | Handle the container's body. If your override of this method does not
advance the markup stream to the close tag for the openTag, a runtime
exception will be thrown by the framework.
Parameters: markupStream - The markup stream Parameters: openTag - The open tag for the body |
onRender | protected void onRender(MarkupStream markupStream)(Code) | | Renders this component. This implementation just calls renderComponent.
Parameters: markupStream - |
remove | public void remove(Component component)(Code) | | Parameters: component - Component to remove from this container |
remove | final public void remove(String id)(Code) | | Removes the given component
Parameters: id - The id of the component to remove |
renderAll | protected void renderAll(MarkupStream markupStream)(Code) | | Renders this component and all sub-components using the given markup
stream.
Parameters: markupStream - The markup stream |
renderAssociatedMarkup | final public void renderAssociatedMarkup(String openTagName, String exceptionMessage)(Code) | | Renders the entire associated markup stream for a container such as a
Border or Panel. Any leading or trailing raw markup in the associated
markup is skipped.
Parameters: openTagName - the tag to render the associated markup for Parameters: exceptionMessage - message that will be used for exceptions |
renderComponentTagBody | final protected void renderComponentTagBody(MarkupStream markupStream, ComponentTag openTag)(Code) | | Renders markup for the body of a ComponentTag from the current position
in the given markup stream. If the open tag passed in does not require a
close tag, nothing happens. Markup is rendered until the closing tag for
openTag is reached.
Parameters: markupStream - The markup stream Parameters: openTag - The open tag |
setMarkupStream | final protected void setMarkupStream(MarkupStream markupStream)(Code) | | Set markup stream for this container.
Parameters: markupStream - The markup stream |
size | final public int size()(Code) | | Get the number of children in this container.
Number of children in this container |
toString | public String toString(boolean detailed)(Code) | | Parameters: detailed - True if a detailed string is desired String representation of this container |
visitChildren | final public Object visitChildren(Class clazz, IVisitor visitor)(Code) | | Traverses all child components of the given class in this container,
calling the visitor's visit method at each one.
Parameters: clazz - The class of child to visit, or null to visit all children Parameters: visitor - The visitor to call back to The return value from a visitor which halted the traversal, ornull if the entire traversal occurred |
visitChildren | final public Object visitChildren(IVisitor visitor)(Code) | | Traverses all child components in this container, calling the visitor's
visit method at each one.
Parameters: visitor - The visitor to call back to The return value from a visitor which halted the traversal, ornull if the entire traversal occurred |
Methods inherited from wicket.Component | final public Component add(IBehavior behavior)(Code)(Java Doc) final protected void addStateChange(Change change)(Code)(Java Doc) final protected void checkComponentTag(ComponentTag tag, String name)(Code)(Java Doc) final protected void checkComponentTagAttribute(ComponentTag tag, String key, String value)(Code)(Java Doc) final public boolean continueToOriginalDestination()(Code)(Java Doc) final public void debug(String message)(Code)(Java Doc) final public void detachBehaviors()(Code)(Java Doc) protected void detachModel()(Code)(Java Doc) public void detachModels()(Code)(Java Doc) final public void error(String message)(Code)(Java Doc) final protected String exceptionMessage(String message)(Code)(Java Doc) final public void fatal(String message)(Code)(Java Doc) protected MarkupStream findMarkupStream()(Code)(Java Doc) final protected Page findPage()(Code)(Java Doc) final public MarkupContainer findParent(Class c)(Code)(Java Doc) final public MarkupContainer findParentWithAssociatedMarkup()(Code)(Java Doc) Component get(String path)(Code)(Java Doc) final public Application getApplication()(Code)(Java Doc) final public IApplicationSettings getApplicationPages()(Code)(Java Doc) final public Settings getApplicationSettings()(Code)(Java Doc) final public List getBehaviors()(Code)(Java Doc) final protected List getBehaviors(Class type)(Code)(Java Doc) final public String getClassRelativePath()(Code)(Java Doc) public IConverter getConverter()(Code)(Java Doc) final public boolean getEscapeModelStrings()(Code)(Java Doc) final public FeedbackMessage getFeedbackMessage()(Code)(Java Doc) final protected boolean getFlag(int flag)(Code)(Java Doc) final protected boolean getFlag(short flag)(Code)(Java Doc) public String getId()(Code)(Java Doc) public Locale getLocale()(Code)(Java Doc) final public Localizer getLocalizer()(Code)(Java Doc) final public ValueMap getMarkupAttributes()(Code)(Java Doc) public String getMarkupId()(Code)(Java Doc) final public Serializable getMetaData(MetaDataKey key)(Code)(Java Doc) public IModel getModel()(Code)(Java Doc) protected IModelComparator getModelComparator()(Code)(Java Doc) final public Object getModelObject()(Code)(Java Doc) final public String getModelObjectAsString()(Code)(Java Doc) final public boolean getOutputMarkupId()(Code)(Java Doc) final public Page getPage()(Code)(Java Doc) final public IPageFactory getPageFactory()(Code)(Java Doc) final public String getPageRelativePath()(Code)(Java Doc) final public MarkupContainer getParent()(Code)(Java Doc) final public String getPath()(Code)(Java Doc) final public boolean getRenderBodyOnly()(Code)(Java Doc) final public Request getRequest()(Code)(Java Doc) final public RequestCycle getRequestCycle()(Code)(Java Doc) final public Response getResponse()(Code)(Java Doc) final public Session getSession()(Code)(Java Doc) public long getSizeInBytes()(Code)(Java Doc) final public String getString(String key)(Code)(Java Doc) final public String getString(String key, IModel model)(Code)(Java Doc) final public String getString(String key, IModel model, String defaultValue)(Code)(Java Doc) final public String getStyle()(Code)(Java Doc) public String getVariation()(Code)(Java Doc) final public boolean hasErrorMessage()(Code)(Java Doc) final public boolean hasFeedbackMessage()(Code)(Java Doc) final public void info(String message)(Code)(Java Doc) protected IModel initModel()(Code)(Java Doc) protected void internalAttach()(Code)(Java Doc) protected void internalDetach()(Code)(Java Doc) protected void internalOnAttach()(Code)(Java Doc) protected void internalOnDetach()(Code)(Java Doc) protected void internalOnModelChanged()(Code)(Java Doc) final public boolean isActionAuthorized(Action action)(Code)(Java Doc) final public boolean isAncestorOf(Component component)(Code)(Java Doc) final boolean isAuto()(Code)(Java Doc) protected boolean isBehaviorAccepted(IBehavior behavior)(Code)(Java Doc) final public boolean isEnableAllowed()(Code)(Java Doc) public boolean isEnabled()(Code)(Java Doc) final protected boolean isHeadRendered()(Code)(Java Doc) final protected boolean isIgnoreAttributeModifier()(Code)(Java Doc) final protected boolean isRenderAllowed()(Code)(Java Doc) public boolean isVersioned()(Code)(Java Doc) public boolean isVisible()(Code)(Java Doc) final public boolean isVisibleInHierarchy()(Code)(Java Doc) final public void modelChanged()(Code)(Java Doc) final public void modelChanging()(Code)(Java Doc) final public Page newPage(Class c)(Code)(Java Doc) final public Page newPage(Class c, PageParameters parameters)(Code)(Java Doc) protected void onAfterRender()(Code)(Java Doc) protected void onAttach()(Code)(Java Doc) protected void onBeforeRender()(Code)(Java Doc) protected void onBeginRequest()(Code)(Java Doc) protected void onComponentTag(ComponentTag tag)(Code)(Java Doc) protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)(Code)(Java Doc) protected void onDetach()(Code)(Java Doc) protected void onEndRequest()(Code)(Java Doc) protected void onModelChanged()(Code)(Java Doc) protected void onModelChanging()(Code)(Java Doc) final protected void onRender()(Code)(Java Doc) abstract protected void onRender(MarkupStream markupStream)(Code)(Java Doc) final public void redirectToInterceptPage(Page page)(Code)(Java Doc) final public void remove()(Code)(Java Doc) final public void render()(Code)(Java Doc) final public void render(MarkupStream markupStream)(Code)(Java Doc) final void renderClosingComponentTag(MarkupStream markupStream, ComponentTag openTag, boolean renderTagOnly)(Code)(Java Doc) final public void renderComponent()(Code)(Java Doc) final public void renderComponent(MarkupStream markupStream)(Code)(Java Doc) final protected void renderComponentTag(ComponentTag tag)(Code)(Java Doc) public void renderHead(HtmlHeaderContainer container)(Code)(Java Doc) final public void rendered()(Code)(Java Doc) final public void renderedBehaviors()(Code)(Java Doc) final protected void replaceComponentTagBody(MarkupStream markupStream, ComponentTag tag, CharSequence body)(Code)(Java Doc) public void replaceWith(Component replacement)(Code)(Java Doc) final protected void resetHeadRendered()(Code)(Java Doc) final public boolean sameRootModel(Component component)(Code)(Java Doc) final public boolean sameRootModel(IModel model)(Code)(Java Doc) final protected void setAuto(boolean auto)(Code)(Java Doc) final public Component setEnabled(boolean enabled)(Code)(Java Doc) final public Component setEscapeModelStrings(boolean escapeMarkup)(Code)(Java Doc) final protected void setFlag(int flag, boolean set)(Code)(Java Doc) final protected void setFlag(short flag, boolean set)(Code)(Java Doc) final void setId(String id)(Code)(Java Doc) final protected Component setIgnoreAttributeModifier(boolean ignore)(Code)(Java Doc) protected void setMarkupStream(MarkupStream markupStream)(Code)(Java Doc) final public void setMetaData(MetaDataKey key, Serializable object)(Code)(Java Doc) public Component setModel(IModel model)(Code)(Java Doc) final public Component setModelObject(Object object)(Code)(Java Doc) final public Component setOutputMarkupId(boolean output)(Code)(Java Doc) final void setParent(MarkupContainer parent)(Code)(Java Doc) final public void setRedirect(boolean redirect)(Code)(Java Doc) final void setRenderAllowed(boolean renderAllowed)(Code)(Java Doc) final public Component setRenderBodyOnly(boolean renderTag)(Code)(Java Doc) final public void setResponsePage(Class cls)(Code)(Java Doc) final public void setResponsePage(Class cls, PageParameters parameters)(Code)(Java Doc) final public void setResponsePage(Page page)(Code)(Java Doc) public Component setVersioned(boolean versioned)(Code)(Java Doc) final public Component setVisible(boolean visible)(Code)(Java Doc) public String toString()(Code)(Java Doc) public String toString(boolean detailed)(Code)(Java Doc) final public CharSequence urlFor(Class pageClass, PageParameters parameters)(Code)(Java Doc) final public CharSequence urlFor(IRequestTarget requestTarget)(Code)(Java Doc) final public CharSequence urlFor(PageMap pageMap, Class pageClass, PageParameters parameters)(Code)(Java Doc) final public CharSequence urlFor(RequestListenerInterface listener)(Code)(Java Doc) final public CharSequence urlFor(ResourceReference resourceReference)(Code)(Java Doc) final public Object visitParents(Class c, IVisitor visitor)(Code)(Java Doc) final public void warn(String message)(Code)(Java Doc)
|
|
|