getSpecifiedLayout(layout, pageContext);
// If a layout was specified, then ensure it is allowed in this context.
RegionInstance containingRegion = null;
if (layoutContext != null) {
ContainerInstance containingInstance =
pageContext.getCurrentContainerInstance();
// Make sure that the containing instance is a region.
if (containingInstance instanceof RegionInstance) {
containingRegion = (RegionInstance) containingInstance;
} else {
throw new IllegalStateException("Container " +
containingInstance.getFormat().getName() +
" is not a region");
}
}
// If the parent of the element currently being processed is in an
// inactive group, then the current element must also be.
boolean suppressedLayout = false;
if (parentState != null) {
if (parentState.isInactiveGroup()) {
isInactiveGroup = true;
}
if (parentState.isSuppressing() && layoutContext != null ||
parentState.isInSuppressedLayout()) {
// if you push a new layout on while the parent is suppressing,
// all the elements should remain suppressed even if they
// target valid containers. This is because the layout itself
// wasn't correctly targetted at a valid container.
suppressedLayout = true;
}
}
// Get the specified container - may be null.
ContainerInstance containerInstance =
getSpecifiedContainer(container, pageContext, layoutContext);
// Determine the formatting result given the layout and container.
FormattingResult formattingResult =
determineFormattingResult(layoutContext, containerInstance,