if (markup == null)
{
throw new MarkupException("Markup not found. Component: " + toString());
}
final MarkupStream markupStream = new MarkupStream(markup);
// Get mutable copy of next tag
final ComponentTag openTag = markupStream.getTag();
final ComponentTag tag = openTag.mutable();
// Call any tag handler
onComponentTag(tag);
// If we're an openclose tag
if (!tag.isOpenClose() && !tag.isOpen())
{
// We were something other than <tag> or <tag/>
markupStream.throwMarkupException("Method renderComponent called on bad markup element: " +
tag);
}
if (tag.isOpenClose() && openTag.isOpen())
{
markupStream.throwMarkupException("You can not modify a open tag to open-close: " + tag);
}
try
{
// Render open tag
if (getRenderBodyOnly())
{
if (getFlag(FLAG_OUTPUT_MARKUP_ID))
{
log.warn(String.format(
"Markup id set on a component that renders its body only. "
+ "Markup id: %s, component id: %s.", getMarkupId(), getId()));
}
if (getFlag(FLAG_PLACEHOLDER))
{
log.warn(String.format(
"Placeholder tag set on a component that renders its body only. "
+ "Component id: %s.", getId()));
}
}
else
{
renderComponentTag(tag);
}
markupStream.next();
// Render the body only if open-body-close. Do not render if open-close.
if (tag.isOpen())
{
// Render the body. The default strategy will simply call the component's