+ "' attribute not found on '" + COMPONENT_ELEMENT
+ "' Element!");
}
// Create new LayoutComponent
LayoutComponent component = new LayoutComponent(parent, id,
getComponentType(parent, type));
// Check for overwrite flag
String overwrite = attributes.get(OVERWRITE_ATTRIBUTE);
if ((overwrite != null) && (overwrite.length() > 0)) {
component.setOverwrite(Boolean.valueOf(overwrite).booleanValue());
}
// Set flag to indicate if this LayoutComponent is nested in another
// LayoutComponent. This is significant b/c during rendering, events
// will need to be fired differently (the TemplateRenderer /
// LayoutElements will not have any control). The strategy used will
// rely on "instance" handlers, this flag indicates that "instance"
// handlers should be used.
// NOTE: While this could be implemented on the LayoutComponent
// itself, I decided not to for performance reasons and to
// allow this value to be overruled if desired.
component.setNested(
LayoutElementUtil.isNestedLayoutComponent(component));
// Figure out if this should be stored as a facet, if so under what id
if (!LayoutElementUtil.isLayoutComponentChild(component)) {
// Need to add this so that it has the correct facet name
// Check to see if this LayoutComponent is inside a LayoutFacet
while (parent != null) {
if (parent instanceof LayoutFacet) {
// Inside a LayoutFacet, use its id... only if this facet
// is a child of a LayoutComponent (otherwise, it is a
// layout facet used for layout, not for defining a facet
// of a UIComponent)
if (LayoutElementUtil.isLayoutComponentChild(parent)) {
id = parent.getUnevaluatedId();
}
break;
}
parent = parent.getParent();
}
// Set the facet name
component.addOption(LayoutComponent.FACET_NAME, id);
}
// Add children... (different for component LayoutElements)
addChildLayoutComponentChildren(component, node);