{
// Border require an associated markup resource file
IMarkupFragment markup = getAssociatedMarkup();
if (markup == null)
{
throw new MarkupException("Unable to find associated markup file for Border: " +
this.toString());
}
// Find <wicket:border>
IMarkupFragment borderMarkup = null;
for (int i = 0; i < markup.size(); i++)
{
MarkupElement elem = markup.get(i);
if (TagUtils.isWicketBorderTag(elem))
{
borderMarkup = new MarkupFragment(markup, i);
break;
}
}
if (borderMarkup == null)
{
throw new MarkupException(markup.getMarkupResourceStream(),
"Unable to find <wicket:border> tag in associated markup file for Border: " +
this.toString());
}
// If child == null, return the markup fragment starting with the <wicket:border> tag