@Override public Object createObject(Attributes atts) { JRPrintImage printImage = (JRPrintImage)digester.peek(); boolean isLazy = printImage.getRenderer() instanceof ResourceRenderer ? ((ResourceRenderer)printImage.getRenderer()).isLazy() : false; JRPrintImageSourceObject imageSource = new JRPrintImageSourceObject(isLazy); imageSource.setPrintImage(printImage); String isEmbedded = atts.getValue(JRXmlConstants.ATTRIBUTE_isEmbedded); if (isEmbedded != null && isEmbedded.length() > 0) { imageSource.setEmbedded(Boolean.valueOf(isEmbedded).booleanValue()); } return imageSource; }
protected InternalImageProcessor( JRPrintImage imageElement ) { this.imageElement = imageElement; this.imageRenderersCache = imageElement.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext()); topPadding = Math.max(imageElement.getLineBox().getTopPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getTopPen())); leftPadding = Math.max(imageElement.getLineBox().getLeftPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getLeftPen())); bottomPadding = Math.max(imageElement.getLineBox().getBottomPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getBottomPen())); rightPadding = Math.max(imageElement.getLineBox().getRightPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getRightPen())); int tmpAvailableImageWidth = imageElement.getWidth() - leftPadding - rightPadding; availableImageWidth = tmpAvailableImageWidth < 0 ? 0 : tmpAvailableImageWidth; int tmpAvailableImageHeight = imageElement.getHeight() - topPadding - bottomPadding; availableImageHeight = tmpAvailableImageHeight < 0 ? 0 : tmpAvailableImageHeight; }
public InternalImageProcessor( JRPrintImage imageElement, JRExporterGridCell cell, int availableImageWidth, int availableImageHeight, DocumentBuilder documentBuilder, JasperReportsContext jasperReportsContext ) { this.imageElement = imageElement; this.imageRenderersCache = imageElement.isUsingCache() ? documentBuilder.getRenderersCache() : new RenderersCache(jasperReportsContext); this.cell = cell; this.availableImageWidth = availableImageWidth; this.availableImageHeight = availableImageHeight; this.documentBuilder = documentBuilder; this.jasperReportsContext = jasperReportsContext; }
private InternalImageProcessor(JRPrintImage printImage) { this.printImage = printImage; this.imageRenderersCache = printImage.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext()); topPadding = printImage.getLineBox().getTopPadding().intValue(); leftPadding = printImage.getLineBox().getLeftPadding().intValue(); bottomPadding = printImage.getLineBox().getBottomPadding().intValue(); rightPadding = printImage.getLineBox().getRightPadding().intValue(); int tmpAvailableImageWidth = printImage.getWidth() - leftPadding - rightPadding; availableImageWidth = tmpAvailableImageWidth < 0 ? 0 : tmpAvailableImageWidth; int tmpAvailableImageHeight = printImage.getHeight() - topPadding - bottomPadding; availableImageHeight = tmpAvailableImageHeight < 0 ? 0 : tmpAvailableImageHeight; }
protected InternalImageProcessor( JRPrintImage imageElement, boolean isLazy, boolean needDimension, TableCell cell, int availableImageWidth, int availableImageHeight ) { this.imageElement = imageElement; this.imageRenderersCache = imageElement.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext()); this.isLazy = isLazy; this.embedImage = isEmbedImage(imageElement); this.needDimension = needDimension; this.cell = cell; this.availableImageWidth = availableImageWidth; this.availableImageHeight = availableImageHeight; }
protected String getImageHorizontalAlignmentStyle(JRPrintImage image) { String horizontalAlignment = CSS_TEXT_ALIGN_LEFT; switch (image.getHorizontalImageAlign()) { case RIGHT : { horizontalAlignment = CSS_TEXT_ALIGN_RIGHT; break; } case CENTER : { horizontalAlignment = CSS_TEXT_ALIGN_CENTER; break; } case LEFT : default : { horizontalAlignment = CSS_TEXT_ALIGN_LEFT; } } return horizontalAlignment; }
protected String getImageVerticalAlignmentStyle(JRPrintImage image) { String verticalAlignment = HTML_VERTICAL_ALIGN_TOP; switch (image.getVerticalImageAlign()) { case BOTTOM : { verticalAlignment = HTML_VERTICAL_ALIGN_BOTTOM; break; } case MIDDLE : { verticalAlignment = HTML_VERTICAL_ALIGN_MIDDLE; break; } case TOP : default : { verticalAlignment = HTML_VERTICAL_ALIGN_TOP; } } return verticalAlignment; }
@Override protected void exportFrame(JRPrintFrame frame) throws JRException { for (Object element : frame.getElements()) { if (element instanceof JRPrintLine) { exportLine((JRPrintLine)element); } else if (element instanceof JRPrintRectangle) { exportRectangle((JRPrintRectangle)element); } else if (element instanceof JRPrintEllipse) { exportRectangle((JRPrintEllipse)element); } else if (element instanceof JRPrintImage) { exportImage((JRPrintImage) element); } else if (element instanceof JRPrintText) { exportText((JRPrintText)element); } else if (element instanceof JRPrintFrame) { exportFrame((JRPrintFrame) element); } else if (element instanceof JRGenericPrintElement) { exportGenericElement((JRGenericPrintElement) element); } } }
/** * */ public static JRPrintImage getImage(List<JasperPrint> jasperPrintList, JRPrintElementIndex imageIndex) { JasperPrint report = jasperPrintList.get(imageIndex.getReportIndex()); JRPrintPage page = report.getPages().get(imageIndex.getPageIndex()); Integer[] elementIndexes = imageIndex.getAddressArray(); Object element = page.getElements().get(elementIndexes[0].intValue()); for (int i = 1; i < elementIndexes.length; ++i) { JRPrintFrame frame = (JRPrintFrame) element; element = frame.getElements().get(elementIndexes[i].intValue()); } return (JRPrintImage) element; }
protected InternalImageDrawer( JRPrintImage printImage, int offsetX, int offsetY ) { this.printImage = printImage; this.offsetX = offsetX; this.offsetY = offsetY; topPadding = printImage.getLineBox().getTopPadding().intValue(); leftPadding = printImage.getLineBox().getLeftPadding().intValue(); bottomPadding = printImage.getLineBox().getBottomPadding().intValue(); rightPadding = printImage.getLineBox().getRightPadding().intValue(); int tmpAvailableImageWidth = printImage.getWidth() - leftPadding - rightPadding; availableImageWidth = tmpAvailableImageWidth < 0 ? 0 : tmpAvailableImageWidth; int tmpAvailableImageHeight = printImage.getHeight() - topPadding - bottomPadding; availableImageHeight = tmpAvailableImageHeight < 0 ? 0 : tmpAvailableImageHeight; }
@Override public void visit(JRPrintImage image, Offset offset) { try { imageDrawer.draw( grx, image, offset.getX(), offset.getY() ); } catch (JRException e) { throw new JRRuntimeException(e); } }
/** * */ protected void copy(JRPrintImage printImage) { printImage.setRenderer(getRenderable()); printImage.setAnchorName(getAnchorName()); if (getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen)) { printImage.setHyperlinkReference(getHyperlinkReference()); printImage.setHyperlinkAnchor(getHyperlinkAnchor()); printImage.setHyperlinkPage(getHyperlinkPage()); printImage.setHyperlinkTooltip(getHyperlinkTooltip()); printImage.setHyperlinkParameters(hyperlinkParameters); } else { if (printImage instanceof JRTemplatePrintImage)//this is normally the case { ((JRTemplatePrintImage) printImage).setHyperlinkOmitted(true); } printImage.setHyperlinkReference(null); } transferProperties(printImage); }
protected void copy(JRPrintImage printImage) { printImage.setRenderer(getRenderable()); printImage.setAnchorName(getAnchorName()); if (getChartSettings().getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen)) { printImage.setHyperlinkReference(getHyperlinkReference()); printImage.setHyperlinkAnchor(getHyperlinkAnchor()); printImage.setHyperlinkPage(getHyperlinkPage()); printImage.setHyperlinkTooltip(getHyperlinkTooltip()); printImage.setHyperlinkParameters(hyperlinkParameters); } else { if (printImage instanceof JRTemplatePrintImage)//this is normally the case { ((JRTemplatePrintImage) printImage).setHyperlinkOmitted(true); } printImage.setHyperlinkReference(null); } // transferProperties(printImage); }
/** * */ private Renderable getRenderable(JasperReportsContext jasperReportsContext, JRImage imageElement, JRPrintImage printImage, KeyValue<JasperReportsContext, String> key) { // long ctime = System.currentTimeMillis(); Renderable r = null; String location = ExpressionUtil.eval(imageElement.getExpression(), (JasperReportsConfiguration) jasperReportsContext); // JRExpressionUtil.getSimpleExpressionText(imageElement.getExpression()); // long etime = System.currentTimeMillis(); if (location != null) { try { r = RenderableUtil.getInstance(jasperReportsContext).getRenderable(location, OnErrorTypeEnum.ERROR, false); imgCache.put(key, r); } catch (JRException e) { if (log.isDebugEnabled()) log.debug("Creating location renderer for converted image failed.", e); } } if (r == null) r = getRenderableNoImage(jasperReportsContext, imageElement, printImage); // long ftime = System.currentTimeMillis(); // System.out.println("GetRenderable: " + (ftime - ctime) + " : " + (ftime - etime) + " " + location); return r; }
private void initHypelinks() { links.clear(); if (page == null) return; List<JRPrintElement> elements = page.getElements(); if (elements == null) return; for (JRPrintElement element : elements) { if (element instanceof JRPrintImage) { Renderable r = ((JRPrintImage) element).getRenderable(); if (r instanceof ImageMapRenderable) { try { List<JRPrintImageAreaHyperlink> hyperlinks = ((ImageMapRenderable) r).getImageAreaHyperlinks(new java.awt.Rectangle(0, 0, element.getWidth(), element.getHeight())); if (hyperlinks != null) links.add(new ImageAreaHyperlink(element.getX(), element.getY(), hyperlinks)); } catch (JRException e) { throw new RuntimeException(e); } } } else if (element instanceof JRPrintHyperlink && !((JRPrintHyperlink) element).getHyperlinkTypeValue().equals(HyperlinkTypeEnum.NONE)) links.add(new PrintHyperlink(0, 0, element)); } }
@Override public void test() { super.test(); numberOfPagesTest(1); elementCountTest("detail.column_field11", 3); elementValueTest("detail.column_field11", "True", "False", ""); elementCountTest("detail.column_field12", 3); elementValueTest("detail.column_field12", "True", "False", "False"); testImage("detail.column_field13", 0); testImage("detail.column_field13", 1); Assert.assertNull((((JRPrintImage) getElementAt("detail.column_field13", 2)).getRenderable())); testImage("detail.column_field14", 0); testImage("detail.column_field14", 1); testImage("detail.column_field14", 2); }
@Override public void test() { super.test(); numberOfPagesTest(1); try { byte[] imageData = JRImageLoader.getInstance(DefaultJasperReportsContext.getInstance()).loadBytesFromAwtImage(image, ImageTypeEnum.JPEG); JRPrintImage jrImage = (JRPrintImage) getElementAt("title.image1", 0); Assert.assertTrue("image data", Arrays.equals(imageData, jrImage.getRenderable().getImageData(DefaultJasperReportsContext.getInstance()))); Assert.assertEquals("scale image", ScaleImageEnum.CLIP, jrImage.getScaleImageValue()); } catch (JRException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Override public void exportElement(JExcelApiExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout) { try { JExcelApiExporter exporter = (JExcelApiExporter) exporterContext .getExporter(); JasperReportsContext reportsContext = exporterContext .getJasperReportsContext(); JRPrintImage printImage = getImage(reportsContext, element); exporter.exportImage(printImage, gridCell, colIndex, rowIndex, emptyCols, yCutsRow, layout); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public JRPrintImage createImageFromElement(JRGenericPrintElement element) throws JRException { String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT); String scaleType = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_SCALE_TYPE); String horizontalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HORIZONTAL_ALIGN); String verticalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_VERTICAL_ALIGN); Boolean hasOverflowed = (Boolean) element.getParameterValue(HtmlPrintElement.BUILTIN_PARAMETER_HAS_OVERFLOWED); Boolean clipOnOverflow = (Boolean) element.getParameterValue(HtmlPrintElement.PARAMETER_CLIP_ON_OVERFLOW); JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider()); printImage.setStyle(element.getStyle()); printImage.setMode(element.getModeValue()); printImage.setBackcolor(element.getBackcolor()); printImage.setForecolor(element.getForecolor()); printImage.setX(element.getX()); printImage.setY(element.getY()); printImage.setWidth(element.getWidth()); printImage.setScaleImage(ScaleImageEnum.getByName(scaleType)); printImage.setHorizontalImageAlign(HorizontalImageAlignEnum.getByName(horizontalAlignment)); printImage.setVerticalImageAlign(VerticalImageAlignEnum.getByName(verticalAlignment)); FlyingSaucerXhtmlToImageRenderer renderer = new FlyingSaucerXhtmlToImageRenderer(getHtmlDocument(htmlContent), element.getWidth(), element.getHeight()); if (printImage.getScaleImageValue() == ScaleImageEnum.REAL_HEIGHT || printImage.getScaleImageValue() == ScaleImageEnum.REAL_SIZE) { boolean canClip = hasOverflowed != null ? hasOverflowed : false; if (canClip) { printImage.setHeight(element.getHeight()); if (clipOnOverflow) { printImage.setScaleImage(ScaleImageEnum.CLIP); } } else { printImage.setHeight(renderer.getComputedSize().height); } } else { printImage.setHeight(element.getHeight()); } printImage.setRenderer(renderer); return printImage; }
@Override public JRPrintImage createImageFromComponentElement(JRComponentElement componentElement) throws JRException { HtmlComponent html = (HtmlComponent) componentElement.getComponent(); String htmlContent = ""; if (html.getHtmlContentExpression() != null) { htmlContent = JRExpressionUtil.getExpressionText(html.getHtmlContentExpression()); } JRBasePrintImage printImage = new JRBasePrintImage(componentElement.getDefaultStyleProvider()); printImage.setStyle(componentElement.getStyle()); printImage.setMode(componentElement.getModeValue()); printImage.setBackcolor(componentElement.getBackcolor()); printImage.setForecolor(componentElement.getForecolor()); printImage.setX(componentElement.getX()); printImage.setY(componentElement.getY()); printImage.setWidth(componentElement.getWidth()); printImage.setHeight(componentElement.getHeight()); printImage.setScaleImage(html.getScaleType()); printImage.setHorizontalImageAlign(html.getHorizontalImageAlign()); printImage.setVerticalImageAlign(html.getVerticalImageAlign()); FlyingSaucerXhtmlToImageRenderer renderer = new FlyingSaucerXhtmlToImageRenderer(getHtmlDocument(htmlContent), componentElement.getWidth(), componentElement.getHeight()); printImage.setRenderer(renderer); return printImage; }
@Override public JRPrintImage createImageFromElement(JRGenericPrintElement element) { String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT); String scaleType = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_SCALE_TYPE); String horizontalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HORIZONTAL_ALIGN); String verticalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_VERTICAL_ALIGN); JEditorPane editorPane = new JEditorPane(); editorPane.setEditorKitForContentType("text/html", new SynchronousImageLoaderKit()); editorPane.setContentType("text/html"); editorPane.setText(htmlContent); editorPane.setBorder(null); editorPane.setSize(editorPane.getPreferredSize()); JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider()); printImage.setX(element.getX()); printImage.setY(element.getY()); printImage.setWidth(element.getWidth()); printImage.setHeight(element.getHeight()); printImage.setScaleImage(ScaleImageEnum.getByName(scaleType)); printImage.setHorizontalImageAlign(HorizontalImageAlignEnum.getByName(horizontalAlignment)); printImage.setVerticalImageAlign(VerticalImageAlignEnum.getByName(verticalAlignment)); printImage.setStyle(element.getStyle()); printImage.setMode(element.getModeValue()); printImage.setBackcolor(element.getBackcolor()); printImage.setForecolor(element.getForecolor()); printImage.setRenderer(new AwtComponentRendererImpl(editorPane)); return printImage; }
@Override public JRPrintImage createImageFromComponentElement(JRComponentElement componentElement) throws JRException { HtmlComponent html = (HtmlComponent) componentElement.getComponent(); JEditorPane editorPane = new JEditorPane(); editorPane.setEditorKitForContentType("text/html", new SynchronousImageLoaderKit()); editorPane.setContentType("text/html"); String htmlContent = ""; if (html.getHtmlContentExpression() != null) { htmlContent = JRExpressionUtil.getExpressionText(html.getHtmlContentExpression()); } editorPane.setText(htmlContent); editorPane.setBorder(null); editorPane.setSize(editorPane.getPreferredSize()); JRBasePrintImage printImage = new JRBasePrintImage(componentElement.getDefaultStyleProvider()); printImage.setX(componentElement.getX()); printImage.setY(componentElement.getY()); printImage.setWidth(componentElement.getWidth()); printImage.setHeight(componentElement.getHeight()); printImage.setScaleImage(html.getScaleType()); printImage.setHorizontalImageAlign(html.getHorizontalImageAlign()); printImage.setVerticalImageAlign(html.getVerticalImageAlign()); printImage.setStyle(componentElement.getStyle()); printImage.setMode(componentElement.getModeValue()); printImage.setBackcolor(componentElement.getBackcolor()); printImage.setForecolor(componentElement.getForecolor()); printImage.setRenderer(new AwtComponentRendererImpl(editorPane)); return printImage; }
@Override public void visit(JRPrintImage image, T arg) { for (PrintElementVisitor<T> visitor : visitors) { visitor.visit(image, arg); } }
protected void writeImageMap(String imageMapName, JRPrintImage image, List<JRPrintImageAreaHyperlink> imageMapAreas) throws IOException { writer.write("<map name=\"" + imageMapName + "\">\n"); for (ListIterator<JRPrintImageAreaHyperlink> it = imageMapAreas.listIterator(imageMapAreas.size()); it.hasPrevious();) { JRPrintImageAreaHyperlink areaHyperlink = it.previous(); JRPrintHyperlink link = areaHyperlink.getHyperlink(); JRPrintImageArea area = areaHyperlink.getArea(); writer.write(" <area shape=\"" + JRPrintImageArea.getHtmlShape(area.getShape()) + "\""); writeImageAreaCoordinates(area.getCoordinates()); writeImageAreaHyperlink(link); writer.write("/>\n"); } if (image.getHyperlinkTypeValue() != HyperlinkTypeEnum.NONE) { writer.write(" <area shape=\"default\""); writeImageAreaCoordinates(new int[]{0, 0, image.getWidth(), image.getHeight()});//for IE writeImageAreaHyperlink(image); writer.write("/>\n"); } writer.write("</map>\n"); }
protected InternalImageProcessor( JRPrintImage imageElement, boolean needDimension, int availableImageWidth, int availableImageHeight ) { this.imageElement = imageElement; this.imageRenderersCache = imageElement.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext()); this.needDimension = needDimension; this.availableImageWidth = availableImageWidth; this.availableImageHeight = availableImageHeight; }
protected void exportElements(Collection<JRPrintElement> elements) throws JRException, IOException { if (elements != null && elements.size() > 0) { for (Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();) { JRPrintElement element = it.next(); if (filter == null || filter.isToExport(element)) { if (element instanceof JRPrintLine) { exportLine((JRPrintLine)element); } else if (element instanceof JRPrintRectangle) { exportRectangle((JRPrintRectangle)element); } else if (element instanceof JRPrintEllipse) { exportEllipse((JRPrintEllipse)element); } else if (element instanceof JRPrintImage) { exportImage((JRPrintImage)element); } else if (element instanceof JRPrintText) { exportText((JRPrintText)element); } else if (element instanceof JRPrintFrame) { exportFrame((JRPrintFrame)element); } else if (element instanceof JRGenericPrintElement) { exportGenericElement((JRGenericPrintElement)element); } } } } }
protected void startImage(JRPrintImage printImage) { if (isTagged) { PdfStructureElement imageTag = new PdfStructureElement(allTag, PdfName.IMAGE); pdfContentByte.beginMarkedContentSequence(imageTag); if (printImage.getHyperlinkTooltip() != null) { imageTag.put(PdfName.ALT, new PdfString(printImage.getHyperlinkTooltip())); } } }
protected InternalImageProcessor( JRPrintImage imageElement, boolean needDimension, JRExporterGridCell cell, int availableImageWidth, int availableImageHeight ) { this.imageElement = imageElement; this.imageRenderersCache = imageElement.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext()); this.needDimension = needDimension; this.cell = cell; this.availableImageWidth = availableImageWidth; this.availableImageHeight = availableImageHeight; }
public JRPrintImage getImage(ExporterInput exporterInput, JRPrintElementIndex imageIndex) throws JRException//FIXMECONTEXT move these to an abstract up? { List<ExporterInputItem> items = exporterInput.getItems(); ExporterInputItem item = items.get(imageIndex.getReportIndex()); JasperPrint report = item.getJasperPrint(); JRPrintPage page = report.getPages().get(imageIndex.getPageIndex()); Integer[] elementIndexes = imageIndex.getAddressArray(); Object element = page.getElements().get(elementIndexes[0].intValue()); for (int i = 1; i < elementIndexes.length; ++i) { JRPrintFrame frame = (JRPrintFrame) element; element = frame.getElements().get(elementIndexes[i].intValue()); } if(element instanceof JRGenericPrintElement) { JRGenericPrintElement genericPrintElement = (JRGenericPrintElement)element; return ((GenericElementXlsxHandler)GenericElementHandlerEnviroment.getInstance(jasperReportsContext).getElementHandler( genericPrintElement.getGenericType(), XLSX_EXPORTER_KEY )).getImage(exporterContext, genericPrintElement); } return (JRPrintImage) element; }
/** * */ public void exportProps(JRPrintImage image) { JRStyle baseStyle = image.getDefaultStyleProvider().getStyleResolver().getBaseStyle(image); exportPropsHeader(baseStyle == null ? null : baseStyle.getName(), null); exportAlignment( getHorizontalImageAlign( image.getOwnHorizontalImageAlign() ) ); write(" <w:spacing w:lineRule=\"auto\" w:line=\"240\" w:after=\"0\" w:before=\"0\"/>\n"); exportPropsFooter(); }
public void exportElement(JRPrintElement element) throws IOException, JRException { if (filter == null || filter.isToExport(element)) { if (element instanceof JRPrintLine) { exportLine((JRPrintLine)element); } else if (element instanceof JRPrintRectangle) { exportRectangle((JRPrintRectangle)element); } else if (element instanceof JRPrintEllipse) { exportEllipse((JRPrintEllipse)element); } else if (element instanceof JRPrintImage) { exportImage((JRPrintImage)element); } else if (element instanceof JRPrintText) { exportText((JRPrintText)element); } else if (element instanceof JRPrintFrame) { exportFrame((JRPrintFrame) element); } else if (element instanceof JRGenericPrintElement) { exportGenericElement((JRGenericPrintElement) element); } } }
/** * */ protected void copy(JRPrintImage printImage) { printImage.setUUID(getUUID()); if (imageX != null) { printImage.setX(imageX.intValue()); } if (imageWidth != null) { printImage.setWidth(imageWidth.intValue()); } printImage.setRenderer(getRenderable()); printImage.setAnchorName(getAnchorName()); if (getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen)) { printImage.setHyperlinkReference(getHyperlinkReference()); printImage.setHyperlinkAnchor(getHyperlinkAnchor()); printImage.setHyperlinkPage(getHyperlinkPage()); printImage.setHyperlinkTooltip(getHyperlinkTooltip()); printImage.setHyperlinkParameters(hyperlinkParameters); } else { if (printImage instanceof JRTemplatePrintImage)//this is normally the case { ((JRTemplatePrintImage) printImage).setHyperlinkOmitted(true); } printImage.setHyperlinkReference(null); } transferProperties(printImage); }
@Override protected void resolveElement(JRPrintElement element, byte evaluation) throws JRException { evaluateRenderer(evaluation); copy((JRPrintImage) element); filler.updateBookmark(element); }
@Override public void evaluateDelayedElement(JRPrintElement element, byte evaluation) throws JRException { evaluateRenderer(evaluation); copy((JRPrintImage) element); fillContext.getFiller().updateBookmark(element); }
private Renderable getRenderableNoImage(JasperReportsContext jasperReportsContext, JRImage imageElement, JRPrintImage printImage) { try { printImage.setScaleImage(ScaleImageEnum.CLIP); if (noImage == null) noImage = RenderableUtil.getInstance(jasperReportsContext).getRenderable(JRImageLoader.NO_IMAGE_RESOURCE, imageElement.getOnErrorTypeValue(), false); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Creating icon renderer for converted image failed.", e); } return noImage; }
private Renderable getRenderableNoImage(JasperReportsContext jasperReportsContext, MapComponent map, JRPrintImage printImage) { try { printImage.setScaleImage(ScaleImageEnum.CLIP); if (noImage == null) noImage = RenderableUtil.getInstance(jasperReportsContext).getRenderable(JRImageLoader.NO_IMAGE_RESOURCE, map.getOnErrorType(), false); } catch (Exception e) { e.printStackTrace(); } return noImage; }
/** * Return the standard printable element when the image is not found * * @param jasperReportsContext the context * @param imageElement the actual element * @param printImage the print image * @return return the not printable element */ private Renderable getRenderableNoImage(JasperReportsContext jasperReportsContext, JRImage imageElement, JRPrintImage printImage) { try { printImage.setScaleImage(ScaleImageEnum.CLIP); if (noImage == null) noImage = RenderableUtil.getInstance(jasperReportsContext).getRenderable(JRImageLoader.NO_IMAGE_RESOURCE, imageElement.getOnErrorTypeValue(), false); } catch (Exception e) { e.printStackTrace(); } return noImage; }