// the child attribute of the open tag if required
else if (tag.isClose())
{
if (stack == null)
{
throw new WicketParseException("Missing open tag for Enclosure:", tag);
}
// Remove the open tag from the stack
ComponentTag lastEnclosure = stack.pop();
// If the child attribute has not been given by the user,
// then ...
if (childId != null)
{
lastEnclosure.put(CHILD_ATTRIBUTE, childId);
lastEnclosure.setModified(true);
childId = null;
}
if (stack.size() == 0)
{
stack = null;
}
}
else
{
throw new WicketParseException("Open-close tag not allowed for Enclosure:", tag);
}
}
// Are we inside a wicket:enclosure tag?
else if ((tag.getId() != null) && (isWicketTag == false) && (stack != null) &&
(!tag.isAutoComponentTag()))
{
ComponentTag lastEnclosure = stack.lastElement();
// If the enclosure tag has NO child attribute, then ...
if (lastEnclosure.getAttribute(CHILD_ATTRIBUTE) == null)
{
// We encountered more than one child component inside
// the enclosure and are not able to automatically
// determine the child component to delegate the
// isVisible() to => Exception
if (childId != null)
{
throw new WicketParseException(
"Use <wicket:enclosure child='xxx'> to name the child component:", tag);
}
// Remember the child id. The open tag will be updated
// once the close tag is found. See above.
childId = tag.getId();