final int parentNodeType = parent.getNodeType();
final boolean parentIsInlineContainer =
((parentNodeType & LayoutNodeTypes.MASK_BOX_INLINE) == LayoutNodeTypes.MASK_BOX_INLINE ||
(parentNodeType == LayoutNodeTypes.TYPE_BOX_PARAGRAPH));
final RenderBox box = produceBox(band, stateKey, parentIsInlineContainer);
ParagraphRenderBox paragraphBox = null;
if (((box.getNodeType() & LayoutNodeTypes.MASK_BOX_INLINE) == LayoutNodeTypes.MASK_BOX_INLINE) &&
parentIsInlineContainer == false)
{
// Normalize the rendering-model. Inline-Boxes must always be contained in Paragraph-Boxes ..
final ElementStyleSheet bandStyle = band.getStyle();
final SimpleStyleSheet styleSheet = bandCache.getStyleSheet(bandStyle);
final BoxDefinition boxDefinition = boxDefinitionFactory.getBoxDefinition(styleSheet);
paragraphBox = new ParagraphRenderBox
(styleSheet, band.getObjectID(), boxDefinition, box.getElementType(), box.getAttributes(), stateKey);
paragraphBox.setName(band.getName());
paragraphBox.getBoxDefinition().setPreferredWidth(RenderLength.AUTO);
paragraphBox.addChild(box);
parent.addChild(paragraphBox);
}
else
{
parent.addChild(box);
}
final boolean invConsSpace = box.getStyleSheet().getBooleanStyleProperty
(ElementStyleKeys.INVISIBLE_CONSUMES_SPACE, box.getNodeType() == LayoutNodeTypes.TYPE_BOX_ROWBOX);
final Element[] elementBuffer = band.unsafeGetElementArray();
final int elementCount = band.getElementCount();
for (int i = 0; i < elementCount; i++)
{
final Element element = elementBuffer[i];
if (element.isVisible() == false && invConsSpace == false)
{
continue;
}
if (element instanceof Band)
{
final Band childBand = (Band) element;
add(box, childBand, runtime, stateKey);
continue;
}
if (element instanceof SubReport)
{
performAddInlineSubReport(runtime, stateKey, box, (SubReport) element);
continue;
}
final Object value = computeValue(runtime, element);
if (value instanceof Element)
{
final Band b = RichTextConverterUtilities.convertToBand(definedStyleKeys, element, (Element) value);
add(box, b, runtime, stateKey);
}
else
{
performRenderValue(runtime, stateKey, box, element, value);
}
// if value instanceof element, then treat the element as band, and the value as sub-element to the band.
}
if (paragraphBox != null)
{
paragraphBox.close();
}
box.close();
}