public void processContent( final ReportElement element, final Object computedValue, final Object rawValue) { if (computedValue == null) { final StyleSheet resolvedStyle = element.getComputedStyle(); final RenderBox parentRenderBox = this.context.getRenderBox(); if (parentRenderBox.isEmptyNodesHaveSignificance() || metaData.isExtraContentElement(resolvedStyle, element.getAttributes())) { ensureEmptyChildIsAdded(parentRenderBox, element); this.context.setEmpty(false); } return; } if (String.class.equals(computedValue.getClass())) { processText(element, (String) computedValue, rawValue); } else if (computedValue instanceof Shape) { final StyleSheet resolvedStyle = element.getComputedStyle(); final Shape shape = (Shape) computedValue; final ReportDrawable reportDrawable = new ShapeDrawable( shape, resolvedStyle.getBooleanStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO)); processReportDrawable(element, reportDrawable, rawValue); } else if (computedValue instanceof ReportDrawable) { processReportDrawable(element, (ReportDrawable) computedValue, rawValue); } else if (computedValue instanceof ImageContainer || computedValue instanceof DrawableWrapper) { processReplacedContent(element, computedValue, rawValue); } else if (DrawableWrapper.isDrawable(computedValue)) { processReplacedContent(element, new DrawableWrapper(computedValue), rawValue); } else { processText(element, String.valueOf(computedValue), rawValue); } }
public InstanceID createSubflowPlaceholder(final ReportElement element) { final StyleSheet resolverStyleSheet = element.getComputedStyle(); final RenderBox subReportBox = renderNodeFactory.produceSubReportPlaceholder(element, resolverStyleSheet, stateKey); this.context.addChild(subReportBox); this.context.setEmpty(false); return subReportBox.getInstanceId(); }
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(); } }
protected void processReportDrawable( final ReportElement element, final ReportDrawable reportDrawable, final Object rawValue) { final SimpleStyleSheet resolverStyleSheet = element.getComputedStyle(); reportDrawable.setStyleSheet(resolverStyleSheet); reportDrawable.setConfiguration(processingContext.getConfiguration()); reportDrawable.setResourceBundleFactory(processingContext.getResourceBundleFactory()); if (reportDrawable instanceof DrawableWrapper) { processReplacedContent(element, reportDrawable, rawValue); } else { processReplacedContent(element, new DrawableWrapper(reportDrawable), rawValue); } }
private void ensureEmptyChildIsAdded(final RenderBox parent, final ReportElement element) { final StyleSheet resolverStyleSheet = element.getComputedStyle(); final RenderBox box; if (parent.isAcceptInlineBoxes()) { box = renderNodeFactory.produceRenderBox( element, resolverStyleSheet, BandStyleKeys.LAYOUT_INLINE, getStateKey()); } else { box = renderNodeFactory.produceRenderBox( element, resolverStyleSheet, BandStyleKeys.LAYOUT_BLOCK, getStateKey()); } box.getStaticBoxLayoutProperties() .setPlaceholderBox(StaticBoxLayoutProperties.PlaceholderType.SECTION); box.close(); parent.addChild(box); }
public void startSection(final ReportElement element, final int sectionSize) { final StyleSheet resolverStyleSheet = element.getComputedStyle(); final String layoutMode; final boolean legacyMode = metaData.isFeatureSupported(OutputProcessorFeature.STRICT_COMPATIBILITY); if (legacyMode) { layoutMode = BandStyleKeys.LAYOUT_BLOCK; } else { String layout = (String) resolverStyleSheet.getStyleProperty(BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_AUTO); if (BandStyleKeys.LAYOUT_INLINE.equals(layout) && !this.context.getRenderBox().isAcceptInlineBoxes()) { layoutMode = BandStyleKeys.LAYOUT_BLOCK; } else { layoutMode = layout; } } final GroupSection groupSection = new GroupSection( renderNodeFactory.produceRenderBox(element, resolverStyleSheet, layoutMode, null), renderNodeFactory.createAutoGeneratedSectionStyleSheet(resolverStyleSheet), sectionSize, legacyMode); this.context = new SectionLayoutModelBuilderContext(this.context, groupSection, legacyMode); this.context.setEmpty(true); if (element instanceof GroupBody || element instanceof Group) { // PRD-3154 - do we need to set placeholder to true? // todo: PRD-3154: This is black magic, placeholder box true is evil. // Need to evaluate side-effects of this beast. Is it safe for keep-together boxes? this.context .getRenderBox() .getStaticBoxLayoutProperties() .setPlaceholderBox(StaticBoxLayoutProperties.PlaceholderType.SECTION); } this.textProducer.startText(); }
protected void processReplacedContent( final ReportElement element, final Object value, final Object rawValue) { final RenderBox box = this.context.getRenderBox(); final SimpleStyleSheet resolverStyleSheet = element.getComputedStyle(); final StyleSheet elementStyle; if (box.isAcceptInlineBoxes() == false) { if (isTableContext(box) == false && resolverStyleSheet.getBooleanStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT) == false) { elementStyle = new NonDynamicReplacedContentStyleSheet(resolverStyleSheet); } else { elementStyle = new DynamicReplacedContentStyleSheet(resolverStyleSheet); } } else { elementStyle = resolverStyleSheet; } final RenderableReplacedContentBox child = renderNodeFactory.createReplacedContent(element, elementStyle, value, rawValue, stateKey); child.setName(element.getName()); this.context.addChild(child); this.context.setEmpty(false); }
public void startSubFlow(final ReportElement element) { final StyleSheet resolverStyleSheet = element.getComputedStyle(); final RenderBox box; if (metaData.isFeatureSupported(OutputProcessorFeature.STRICT_COMPATIBILITY)) { final StyleSheet styleSheet = new SubReportStyleSheet( resolverStyleSheet.getBooleanStyleProperty(BandStyleKeys.PAGEBREAK_BEFORE), (resolverStyleSheet.getBooleanStyleProperty(BandStyleKeys.PAGEBREAK_AFTER))); final SimpleStyleSheet reportStyle = new SimpleStyleSheet(styleSheet); final BoxDefinition boxDefinition = renderNodeFactory.getBoxDefinition(reportStyle); box = new BlockRenderBox( reportStyle, element.getObjectID(), boxDefinition, SubReportType.INSTANCE, element.getAttributes(), null); } else { box = renderNodeFactory.produceRenderBox( element, resolverStyleSheet, BandStyleKeys.LAYOUT_BLOCK, stateKey); } box.getStaticBoxLayoutProperties() .setPlaceholderBox(StaticBoxLayoutProperties.PlaceholderType.SECTION); if (element.getName() != null) { box.setName("Banded-SubReport-Section" + ": name=" + element.getName()); } else { box.setName("Banded-SubReport-Section"); } pushBoxToContext(box, false); }
public InstanceID startBox(final ReportElement element) { final StyleSheet computedStyle = element.getComputedStyle(); final String layout = (String) computedStyle.getStyleProperty(BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_CANVAS); return startBox(element, computedStyle, layout, false); }