Module org.apache.wicket.core
Class HtmlHeaderContainer
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.html.TransparentWebMarkupContainer
-
- org.apache.wicket.markup.html.internal.HtmlHeaderContainer
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IComponentResolver
,IRequestableComponent
,org.apache.wicket.util.IHierarchical<Component>
,org.apache.wicket.util.io.IClusterable
- Direct Known Subclasses:
HtmlHeaderItemsContainer
public class HtmlHeaderContainer extends TransparentWebMarkupContainer
The HtmlHeaderContainer is automatically created and added to the component hierarchy by a HtmlHeaderResolver instance. HtmlHeaderContainer tries to handle/render the <head> tag and its body. However depending on the parent component, the behavior must be different. E.g. if parent component is a Page all components of the page's hierarchy must be asked if they have something to contribute to the <head> section of the html response. If yes, it must immediately be rendered.<head> regions may contain additional wicket components, which can be added by means of add(Component) as usual.
<wicket:head> tags are handled by simple
WebMarkupContainer
s also created byHtmlHeaderResolver
.- <head> will be inserted in output automatically if required
- <head> is not a wicket specific tag and you must use add() to add components referenced in body of the head tag
- <head> is supported by panels, borders and inherited markup, but is not copied to the output. They are for previewability only (except on Pages)
- <wicket:head> does not make sense in page markup (but does in inherited page markup)
- <wicket:head> makes sense in Panels, Borders and inherited markup (of Panels, Borders and Pages)
- components within <wicket:head> must be added by means of add(), like always with Wicket. No difference.
- <wicket:head> and it's content is copied to the output. Components contained in <wicket:head> are rendered as usual
- Author:
- Juergen Donnerstag
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HtmlHeaderContainer.HeaderStreamState
Combines theMarkupStream
with the open tag, together representing the header section in the markup.
-
Field Summary
-
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING
-
-
Constructor Summary
Constructors Constructor Description HtmlHeaderContainer(String id)
Construct
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IHeaderResponse
getHeaderResponse()
Returns the header response.IMarkupFragment
getMarkup()
Get the Markup associated with the Component.protected IHeaderResponse
newHeaderResponse()
Factory method for creating header responseboolean
okToRenderComponent(String scope, String id)
Check if the header component is ok to render within the scope given.protected void
onAfterRender()
Called immediately after a component and all its children have been rendered, regardless of any exception.void
onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
First render the body of the component.void
renderHeaderTagBody(HtmlHeaderContainer.HeaderStreamState headerStreamState)
Renders the content of the <head> section of the page, including <wicket:head> sections in subclasses of the page.protected boolean
renderOpenAndCloseTags()
-
Methods inherited from class org.apache.wicket.markup.html.TransparentWebMarkupContainer
findChildComponent, internalRenderHead, resolve
-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onDetach, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onBeforeRender, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
HtmlHeaderContainer
public HtmlHeaderContainer(String id)
Construct- See Also:
Component(String)
-
-
Method Detail
-
onComponentTagBody
public final void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
First render the body of the component. And if it is the header component of a Page (compared to a Panel or Border), then get the header sections from all component in the hierarchy and render them as well.- Overrides:
onComponentTagBody
in classMarkupContainer
- Parameters:
markupStream
- The markup streamopenTag
- The open tag for the body
-
renderHeaderTagBody
public void renderHeaderTagBody(HtmlHeaderContainer.HeaderStreamState headerStreamState)
Renders the content of the <head> section of the page, including <wicket:head> sections in subclasses of the page. For every child-component, the content is rendered to a string and passed toIHeaderResponse
.- Parameters:
headerStreamState
-
-
renderOpenAndCloseTags
protected boolean renderOpenAndCloseTags()
- Returns:
- True if open and close tag are to be rendered.
-
okToRenderComponent
public boolean okToRenderComponent(String scope, String id)
Check if the header component is ok to render within the scope given.- Parameters:
scope
- The scope of the header componentid
- The component's id- Returns:
- true, if the component ok to render
-
onAfterRender
protected void onAfterRender()
Description copied from class:Component
Called immediately after a component and all its children have been rendered, regardless of any exception.- Overrides:
onAfterRender
in classComponent
-
newHeaderResponse
protected IHeaderResponse newHeaderResponse()
Factory method for creating header response- Returns:
- new header response
-
getHeaderResponse
public IHeaderResponse getHeaderResponse()
Returns the header response.- Returns:
- header response
-
getMarkup
public IMarkupFragment getMarkup()
Description copied from class:Component
Get the Markup associated with the Component. If not subclassed, the parent container is asked to return the markup of this child component. Components like Panel and Border should return the "calling" markup fragment, e.g.<span wicket:id="myPanel">body</span>
. You may use Panel/Border/Enclosure.getMarkup(null) to return the associated markup file. And Panel/Border/Enclosure.getMarkup(child) will search the child in the appropriate markup fragment.- Overrides:
getMarkup
in classComponent
- Returns:
- The markup fragment
- See Also:
MarkupContainer.getMarkup(Component)
-
-