public JRPrintElement convert(ReportConverter reportConverter, JRElement element) { JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider()); copyElement(reportConverter, element, printImage); printImage.setRenderer(getRenderer()); return printImage; }
public Object createObject(Attributes atts) { JasperPrint jasperPrint = (JasperPrint) digester.peek(digester.getCount() - 2); JRBasePrintImage image = new JRBasePrintImage(jasperPrint.getDefaultStyleProvider()); // get image attributes ScaleImageEnum scaleImage = ScaleImageEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_scaleImage)); if (scaleImage != null) { image.setScaleImage(scaleImage); } HorizontalAlignEnum horizontalAlignment = HorizontalAlignEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_hAlign)); if (horizontalAlignment != null) { image.setHorizontalAlignment(horizontalAlignment); } VerticalAlignEnum verticalAlignment = VerticalAlignEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_vAlign)); if (verticalAlignment != null) { image.setVerticalAlignment(verticalAlignment); } String isLazy = atts.getValue(JRXmlConstants.ATTRIBUTE_isLazy); if (isLazy != null && isLazy.length() > 0) { image.setLazy(Boolean.valueOf(isLazy).booleanValue()); } OnErrorTypeEnum onErrorType = OnErrorTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_onErrorType)); if (onErrorType != null) { image.setOnErrorType(onErrorType); } image.setLinkType(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkType)); image.setLinkTarget(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTarget)); image.setAnchorName(atts.getValue(JRXmlConstants.ATTRIBUTE_anchorName)); image.setHyperlinkReference(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkReference)); image.setHyperlinkAnchor(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkAnchor)); String hyperlinkPage = atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkPage); if (hyperlinkPage != null) { image.setHyperlinkPage(Integer.valueOf(hyperlinkPage)); } image.setHyperlinkTooltip(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTooltip)); String bookmarkLevelAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_bookmarkLevel); if (bookmarkLevelAttr != null) { image.setBookmarkLevel(Integer.parseInt(bookmarkLevelAttr)); } return image; }