MarkupElement elem = associatedMarkupStream.get();
while (elem != null)
{
if (elem instanceof WicketTag)
{
WicketTag tag = (WicketTag)elem;
if (tag.isOpen() && tag.isHeadTag())
{
if (noMoreWicketHeadTagsAllowed == true)
{
throw new MarkupException(
"<wicket:head> tags are only allowed before <body>, </head>, <wicket:panel> etc. tag");
}
return associatedMarkupStream.getCurrentIndex();
}
// wicket:head must be before border, panel or extend
// @TODO why is that? Why can't it be anywhere? (except insight wicket:fragment
else if (tag.isOpen() &&
(tag.isPanelTag() || tag.isBorderTag() || tag.isExtendTag()))
{
noMoreWicketHeadTagsAllowed = true;
}
}
else if (elem instanceof ComponentTag)
{
ComponentTag tag = (ComponentTag)elem;
// wicket:head must be before </head>
// @TODO why??
if (tag.isClose() && TagUtils.isHeadTag(tag))
{
noMoreWicketHeadTagsAllowed = true;
}
// wicket:head must be before <body>
// @TODO why??
else if (tag.isOpen() && TagUtils.isBodyTag(tag))
{
noMoreWicketHeadTagsAllowed = true;
}
}
elem = associatedMarkupStream.next();