org.apache.wicket.markup.html.internal
Class HtmlHeaderContainer

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.TransparentWebMarkupContainer
                  extended by org.apache.wicket.markup.html.internal.HtmlHeaderContainer
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Component>, IEventSink, IEventSource, IClusterable, IConverterLocator, IHeaderContributor, IComponentResolver, IRequestableComponent, IHierarchical<Component>

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 a HtmlHeaderResolver.

Author:
Juergen Donnerstag
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
HtmlHeaderContainer(java.lang.String id)
          Construct
 
Method Summary
 IHeaderResponse getHeaderResponse()
          Returns the header response.
 IMarkupFragment getMarkup()
          Get the Markup associated with the Component.
protected  IHeaderResponse newHeaderResponse()
          Factory method for creating header response
 boolean okToRenderComponent(java.lang.String scope, java.lang.String id)
          Check if the header component is ok to render within the scope given.
 void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
          First render the body of the component.
protected  void onDetach()
          Called to allow a component to detach resources after use.
protected  boolean renderOpenAndCloseTags()
           
 
Methods inherited from class org.apache.wicket.markup.html.TransparentWebMarkupContainer
resolve
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, 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, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, 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, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlHeaderContainer

public HtmlHeaderContainer(java.lang.String id)
Construct

See Also:
Component.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), than get the header sections from all component in the hierarchy and render them as well.

Overrides:
onComponentTagBody in class MarkupContainer
Parameters:
markupStream - The markup stream
openTag - The open tag for the body

renderOpenAndCloseTags

protected boolean renderOpenAndCloseTags()
Returns:
True if open and close tag are to be rendered.

okToRenderComponent

public boolean okToRenderComponent(java.lang.String scope,
                                   java.lang.String id)
Check if the header component is ok to render within the scope given.

Parameters:
scope - The scope of the header component
id - The component's id
Returns:
true, if the component ok to render

onDetach

protected void onDetach()
Description copied from class: Component
Called to allow a component to detach resources after use. Overrides of this method MUST call the super implementation, the most logical place to do this is the last line of the override method.

Overrides:
onDetach in class Component

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 class Component
Returns:
The markup fragment
See Also:
MarkupContainer.getMarkup(Component)


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.