{
// Markup must be available
IMarkupFragment markup = getMarkup();
if ((markup != null) && (markup.size() > 1))
{
MarkupStream stream = new MarkupStream(markup);
// Skip the first component tag which already belongs to 'this' container
if (stream.skipUntil(ComponentTag.class))
{
stream.next();
}
// Search for <wicket:xxx> in the remaining markup and try to resolve the component
while (stream.skipUntil(ComponentTag.class))
{
ComponentTag tag = stream.getTag();
if (tag.isOpen() || tag.isOpenClose())
{
if (tag instanceof WicketTag)
{
Component component = ComponentResolvers.resolve(this, stream, tag, null);
if ((component != null) && (component.getParent() == null))
{
if (component.getId().equals(tag.getId()) == false)
{
// make sure we are able to get() the component during rendering
tag.setId(component.getId());
tag.setModified(true);
}
add(component);
}
}
if (tag.isOpen())
{
stream.skipToMatchingCloseTag(tag);
}
}
stream.next();
}
}
}