* The markup stream
*/
protected final void renderNext(final MarkupStream markupStream)
{
// Get the current markup element
final MarkupElement element = markupStream.get();
// If it's a tag like <wicket..> or <span wicket:id="..." >
if ((element instanceof ComponentTag) && !markupStream.atCloseTag())
{
// Get element as tag
final ComponentTag tag = (ComponentTag)element;
// Get component id
final String id = tag.getId();
// Get the component for the id from the given container
Component component = get(id);
if (component == null)
{
component = ComponentResolvers.resolve(this, markupStream, tag, null);
if ((component != null) && (component.getParent() == null))
{
autoAdd(component, markupStream);
}
}
// Failed to find it?
if (component != null)
{
component.render();
}
else
{
if (tag instanceof WicketTag)
{
if (((WicketTag)tag).isChildTag())
{
markupStream.throwMarkupException("Found " + tag.toString() +
" but no <wicket:extend>");
}
else
{
markupStream.throwMarkupException("Failed to handle: " +
tag.toString() +
". It might be that no resolver has been registered to handle this special tag. " +
" But it also be that you declared wicket:id=" + id +
" in your markup, but that you either did not add the " +
"component to your page at all, or that the hierarchy does not match.");
}
}
// No one was able to handle the component id
markupStream.throwMarkupException("Unable to find component with id '" + id +
"' in " + this + ". This means that you declared wicket:id=" + id +
" in your markup, but that you either did not add the " +
"component to your page at all, or that the hierarchy does not match.");
}
}
else
{
// Render as raw markup
if (log.isDebugEnabled())
{
log.debug("Rendering raw markup");
}
getResponse().write(element.toCharSequence());
}
}