Class HtmlHeaderContainer

  • All Implemented Interfaces:
    Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IMetadataContext<Serializable,​Component>, IHeaderContributor, IComponentResolver, IRequestableComponent, IHierarchical<Component>, IClusterable
    Direct Known Subclasses:

    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 WebMarkupContainers also created by HtmlHeaderResolver.

    • <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
    Juergen Donnerstag
    See Also:
    Serialized Form
    • 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.
        onComponentTagBody in class MarkupContainer
        markupStream - The markup stream
        openTag - 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 to IHeaderResponse.
        headerStreamState -
      • renderOpenAndCloseTags

        protected boolean renderOpenAndCloseTags()
        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.
        scope - The scope of the header component
        id - The component's id
        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.
        onAfterRender in class Component
      • 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.

        getMarkup in class Component
        The markup fragment
        See Also: