protected void processText( final ReportElement element, String computedValue, final Object rawValue) { final SimpleStyleSheet resolverStyleSheet = element.getComputedStyle(); if (computedValue != null && resolverStyleSheet.getBooleanStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT)) { computedValue = computedValue.trim(); } if (this.context.getRenderBox().isAcceptInlineBoxes() == false) { final StyleSheet elementStyle; final int parentNodeType = this.context.getRenderBox().getLayoutNodeType(); if (strictLegacyMode && (parentNodeType & LayoutNodeTypes.MASK_BOX_CANVAS) == LayoutNodeTypes.MASK_BOX_CANVAS) { // A table always claims all elements as dynamic. Use the max-height to limit the expansion // of elements. if (isTableContext(this.context.getRenderBox()) == false && resolverStyleSheet.getBooleanStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT) == false) { elementStyle = new NonDynamicHeightWrapperStyleSheet(resolverStyleSheet); } else { elementStyle = new DynamicHeightWrapperStyleSheet(resolverStyleSheet); } } else { elementStyle = resolverStyleSheet; } this.textProducer.startText(); final RenderBox renderBox = renderNodeFactory.createAutoParagraph(element, elementStyle, stateKey); final RenderNode[] renderNodes = textProducer.getRenderNodes(element, elementStyle, computedValue); renderBox.addChilds(renderNodes); renderBox.setRawValue(rawValue); this.context = new DefaultLayoutModelBuilderContext(this.context, renderBox); this.context.setEmpty( renderNodes.length == 0 && isEmptyElement(element, resolverStyleSheet, metaData)); this.context = this.context.close(); } else { final StyleSheet safeElementStyle = renderNodeFactory.createStyle(resolverStyleSheet); final RenderBox renderBox = renderNodeFactory.produceRenderBox( element, resolverStyleSheet, BandStyleKeys.LAYOUT_INLINE, stateKey); final RenderNode[] renderNodes = textProducer.getRenderNodes(element, safeElementStyle, computedValue); renderBox.addChilds(renderNodes); renderBox.setRawValue(rawValue); this.context = new DefaultLayoutModelBuilderContext(this.context, renderBox); this.context.setEmpty( renderNodes.length == 0 && isEmptyElement(element, resolverStyleSheet, metaData)); this.context = this.context.close(); } }
private InstanceID startBox( final ReportElement element, final StyleSheet styleSheet, final String layout, final boolean auto) { closeAutoGeneratedPostfixBoxes(); if (BandStyleKeys.LAYOUT_AUTO.equals(layout)) { this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox(element, styleSheet, layout, stateKey)); } else if (BandStyleKeys.LAYOUT_INLINE.equals(layout)) { if (this.context.getRenderBox().isAcceptInlineBoxes() == false) { // parent context is not a inline-inside context. // So we need to create a auto-paragraph wrapper to open a inline-context this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.createAutoParagraph(element, styleSheet, stateKey)); // PRD-3750 - A empty inline-band that creates a auto-paragraph reserves space on the // vertical axis. if (metaData.isFeatureSupported(OutputProcessorFeature.STRICT_COMPATIBILITY) || metaData.isFeatureSupported(OutputProcessorFeature.PRD_3750)) { this.context.setAutoGeneratedWrapperBox(true); this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox( element, styleSheet, DefaultRenderNodeFactory.LAYOUT_PARAGRAPH_LINEBOX, stateKey)); } } else { this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox(element, styleSheet, layout, stateKey)); } } else if (this.context.getRenderBox().isAcceptInlineBoxes()) { // inline elements only accept inline element childs this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox( element, styleSheet, BandStyleKeys.LAYOUT_INLINE, stateKey)); } else if (BandStyleKeys.LAYOUT_TABLE_CELL.equals(layout)) { // a table body always needs a table parent .. if (LayoutNodeTypes.TYPE_BOX_TABLE_ROW != this.context.getRenderBox().getLayoutNodeType()) { startBox( element, renderNodeFactory.createAutoGeneratedSectionStyleSheet(styleSheet), BandStyleKeys.LAYOUT_TABLE_ROW, true); } this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox(element, styleSheet, layout, stateKey)); } else if (BandStyleKeys.LAYOUT_TABLE_ROW.equals(layout)) { // a table body always needs a table parent .. if (LayoutNodeTypes.TYPE_BOX_TABLE_SECTION != this.context.getRenderBox().getLayoutNodeType()) { startBox( element, renderNodeFactory.createAutoGeneratedSectionStyleSheet(styleSheet), BandStyleKeys.LAYOUT_TABLE_BODY, true); } this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox(element, styleSheet, layout, stateKey)); } else if (BandStyleKeys.LAYOUT_TABLE_BODY.equals(layout) || BandStyleKeys.LAYOUT_TABLE_FOOTER.equals(layout) || BandStyleKeys.LAYOUT_TABLE_HEADER.equals(layout)) { // a table body always needs a table parent .. if (LayoutNodeTypes.TYPE_BOX_TABLE != this.context.getRenderBox().getLayoutNodeType()) { startBox( element, renderNodeFactory.createAutoGeneratedSectionStyleSheet(styleSheet), BandStyleKeys.LAYOUT_TABLE, true); } this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox(element, styleSheet, layout, stateKey)); } else { // handle ordinary elements, block, canvas, row .. this.context = new DefaultLayoutModelBuilderContext( this.context, renderNodeFactory.produceRenderBox(element, styleSheet, layout, stateKey)); } this.context.setAutoGeneratedWrapperBox(auto); this.context.setEmpty(isEmptyElement(element, styleSheet, metaData)); if (!auto) { if (isControlBand(styleSheet)) { this.context .getRenderBox() .getStaticBoxLayoutProperties() .setPlaceholderBox(StaticBoxLayoutProperties.PlaceholderType.SECTION); } else { this.context .getRenderBox() .getStaticBoxLayoutProperties() .setPlaceholderBox(StaticBoxLayoutProperties.PlaceholderType.NONE); } } this.textProducer.startText(); return this.context.getRenderBox().getInstanceId(); }