use of org.apache.wicket.markup.html.HeaderPartContainer in project wicket by apache.
the class AssociatedMarkupSourcingStrategy method renderHeadFromAssociatedMarkupFile.
/**
* Called by components like Panel and Border which have associated Markup and which may have a
* <wicket:head> tag.
* <p>
* Whereas 'this' might be a Panel or Border, the HtmlHeaderContainer parameter has been added
* to the Page as a container for all headers any of its components might wish to contribute to.
* <p>
* The headers contributed are rendered in the standard way.
*
* @param container
* @param htmlContainer
* The HtmlHeaderContainer added to the Page
*/
public final void renderHeadFromAssociatedMarkupFile(final WebMarkupContainer container, final HtmlHeaderContainer htmlContainer) {
// reset for each render in case the strategy is re-used
noMoreWicketHeadTagsAllowed = false;
// Gracefully getAssociateMarkupStream. Throws no exception in case
// markup is not found
final MarkupStream markupStream = container.getAssociatedMarkupStream(false);
if (markupStream == null) {
return;
}
// Position pointer at current (first) header
noMoreWicketHeadTagsAllowed = false;
while (nextHeaderMarkup(markupStream) != -1) {
// found <wicket:head>
String headerId = getHeaderId(container, markupStream);
// Create a HeaderPartContainer and associate the markup
HeaderPartContainer headerPart = getHeaderPart(container, headerId, markupStream.getMarkupFragment());
if (headerPart != null) {
// to the page or any other container in the hierarchy.
if (htmlContainer.okToRenderComponent(headerPart.getScope(), headerPart.getId())) {
// make sure the Page is accessible
headerPart.setParent(htmlContainer);
headerPart.render();
}
}
// Position the stream after <wicket:head>
markupStream.skipComponent();
}
}
Aggregations