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 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); }
private static boolean isEmptyElement( final ReportElement band, final StyleSheet style, final OutputProcessorMetaData metaData) { if (isControlBand(style)) { return false; } if (metaData.isFeatureSupported(OutputProcessorFeature.STRICT_COMPATIBILITY)) { if (band instanceof Band) { final Band b = (Band) band; if (b.getElementCount() > 0) { return false; } } } if (BandStyleKeys.LAYOUT_AUTO.equals(style.getStyleProperty(BandStyleKeys.LAYOUT))) { // A auto-band is considered empty. return true; } // A band is not empty, if it has a defined minimum or preferred height if (isLengthDefined(ElementStyleKeys.HEIGHT, style)) { return false; } if (isLengthDefined(ElementStyleKeys.WIDTH, style)) { return false; } if (isLengthDefined(ElementStyleKeys.POS_Y, style)) { return false; } if (isLengthDefined(ElementStyleKeys.POS_X, style)) { return false; } if (isLengthDefined(ElementStyleKeys.MIN_HEIGHT, style)) { return false; } if (isLengthDefined(ElementStyleKeys.MIN_WIDTH, style)) { return false; } if (isLengthDefined(ElementStyleKeys.PADDING_TOP, style)) { return false; } if (isLengthDefined(ElementStyleKeys.PADDING_LEFT, style)) { return false; } if (isLengthDefined(ElementStyleKeys.PADDING_BOTTOM, style)) { return false; } if (isLengthDefined(ElementStyleKeys.PADDING_RIGHT, style)) { return false; } if (BorderStyle.NONE.equals( style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_STYLE, BorderStyle.NONE)) == false) { return false; } if (BorderStyle.NONE.equals( style.getStyleProperty(ElementStyleKeys.BORDER_TOP_STYLE, BorderStyle.NONE)) == false) { return false; } if (BorderStyle.NONE.equals( style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_STYLE, BorderStyle.NONE)) == false) { return false; } if (BorderStyle.NONE.equals( style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_STYLE, BorderStyle.NONE)) == false) { return false; } if (style.getStyleProperty(ElementStyleKeys.BACKGROUND_COLOR) != null) { return false; } if (metaData.isExtraContentElement(band.getStyle(), band.getAttributes())) { return false; } return true; }