*/
@Override
public IMarkupFragment getMarkup(final Component child)
{
// 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
if (child == null)
{
return borderMarkup;
}
// Is child == BorderBody?
if (child == body)
{
// Get the <wicket:body> markup
return body.getMarkup();
}
// Find the markup for the child component
IMarkupFragment childMarkup = borderMarkup.find(child.getId());
if (childMarkup != null)
{
return childMarkup;
}