@Override public boolean isToExport(JRPrintElement element) { // JRPrintFrame frame = element instanceof JRPrintFrame ? (JRPrintFrame)element : null; // if (frame != null) // { // List<JRPrintElement> elements = frame.getElements(); // return elements != null && elements.size() > 0; // } // return (element instanceof JRPrintText || element instanceof JRGenericPrintElement) // && (filter == null || filter.isToExport(element)); if (element instanceof JRGenericPrintElement) { JRGenericPrintElement genericElement = (JRGenericPrintElement) element; GenericElementHandler handler = handlerEnvironment.getElementHandler( genericElement.getGenericType(), JRAbstractCsvExporter.CSV_EXPORTER_KEY); if (handler == null || !handler.toExport(genericElement)) { return false; } } return (element instanceof JRPrintText || element instanceof JRPrintFrame || element instanceof JRGenericPrintElement) && (filter == null || filter.isToExport(element)); }
public void exportElement( JRXmlExporterContext exporterContext, JRGenericPrintElement element ) { JRXml4SwfExporter exporter = (JRXml4SwfExporter)exporterContext.getExporterRef(); JRPrintText text = getTextElementReplacement(exporterContext, element); try { exporter.exportText(text); } catch (IOException e) { throw new JRRuntimeException(e); } }
@Override public void exportElement( JRGraphics2DExporterContext exporterContext, JRGenericPrintElement element, Graphics2D grx, Offset offset) { try { JRGraphics2DExporter exporter = (JRGraphics2DExporter)exporterContext.getExporterRef(); ImageDrawer imageDrawer = exporter.getDrawVisitor().getImageDrawer(); imageDrawer.draw( grx, MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element), offset.getX(), offset.getY() ); } catch (Exception e) { throw new RuntimeException(e); } }
public JRPrintText getTextElementReplacement( JRExporterContext exporterContext, JRGenericPrintElement element ) { JRBasePrintText text = new JRBasePrintText(exporterContext.getExportedReport().getDefaultStyleProvider()); text.setX(element.getX()); text.setY(element.getY()); text.setWidth(element.getWidth()); text.setHeight(element.getHeight()); text.setText("[Open Flash Chart Component]"); text.setMode(ModeEnum.OPAQUE); text.setBackcolor(Color.lightGray); text.setHorizontalTextAlign(HorizontalTextAlignEnum.CENTER); text.setVerticalTextAlign(VerticalTextAlignEnum.MIDDLE); text.getLineBox().getPen().setLineWidth(1f); text.getLineBox().getPen().setLineColor(Color.black); text.getLineBox().getPen().setLineStyle(LineStyleEnum.DASHED); JRTextMeasurerUtil.getInstance(exporterContext.getJasperReportsContext()).measureTextElement(text); return text; }
@Override public void exportElement( JRDocxExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell ) { try { JRDocxExporter exporter = (JRDocxExporter)exporterContext.getExporterRef(); exporter.exportImage( exporterContext.getTableHelper(), MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element), gridCell ); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void exportElement( JROdsExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout ) { try { JROdsExporter exporter = (JROdsExporter)exporterContext.getExporterRef(); HtmlPrintElement htmlPrintElement = HtmlPrintElementUtils.getHtmlPrintElement(); exporter.exportImage(htmlPrintElement.createImageFromElement(element), gridCell, colIndex, rowIndex, emptyCols, yCutsRow, layout); } catch (JRException e) { throw new JRRuntimeException(e); } }
@Override public void exportElement( JRXlsxExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex ) { try { JRXlsxExporter exporter = (JRXlsxExporter)exporterContext.getExporterRef(); exporter.exportImage(getImage(exporterContext, element), gridCell, colIndex, rowIndex, 0, 0, null); } catch (Exception e) { throw new RuntimeException(e); } }
/** * */ protected void exportGenericElement(JRGenericPrintElement element) { GenericElementPptxHandler handler = (GenericElementPptxHandler) GenericElementHandlerEnviroment.getInstance(getJasperReportsContext()).getElementHandler( element.getGenericType(), PPTX_EXPORTER_KEY); if (handler != null) { handler.exportElement(exporterContext, element); } else { if (log.isDebugEnabled()) { log.debug("No PPTX generic element handler for " + element.getGenericType()); } } }
@Override public void exportElement( JRPdfExporterContext exporterContext, JRGenericPrintElement element ) { try { JRPdfExporter exporter = (JRPdfExporter)exporterContext.getExporterRef(); exporter.exportImage(MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element)); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void exportElement( JRXmlExporterContext exporterContext, JRGenericPrintElement element ) { try { JRXmlExporter exporter = (JRXmlExporter)exporterContext.getExporterRef(); HtmlPrintElement htmlPrintElement = HtmlPrintElementUtils.getHtmlPrintElement(); exporter.exportImage(htmlPrintElement.createImageFromElement(element)); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public String getHtmlFragment(JRHtmlExporterContext exporterContext, JRGenericPrintElement element) { StringBuilder script = new StringBuilder(128); String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT); script.append("<div style='width:" + (element.getWidth() - 0) + "px;height:" + (element.getHeight() - 0) + "px;"); if (element.getModeValue() == ModeEnum.OPAQUE) { script.append("background-color: #"); script.append(JRColorUtil.getColorHexa(element.getBackcolor())); script.append("; "); } script.append("overflow:hidden;'>"); script.append(htmlContent); script.append("</div>"); return script.toString(); }
@Override public void exportElement( JRXlsExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout ) { try { JRXlsExporter exporter = (JRXlsExporter)exporterContext.getExporterRef(); HtmlPrintElement htmlPrintElement = HtmlPrintElementUtils.getHtmlPrintElement(); exporter.exportImage(htmlPrintElement.createImageFromElement(element), gridCell, colIndex, rowIndex, emptyCols, yCutsRow, layout); } catch (Exception e) { throw new RuntimeException(e); } }
/** * */ protected void exportGenericElement(DocxTableHelper tableHelper, JRGenericPrintElement element, JRExporterGridCell gridCell) { GenericElementDocxHandler handler = (GenericElementDocxHandler) GenericElementHandlerEnviroment.getInstance(getJasperReportsContext()).getElementHandler( element.getGenericType(), DOCX_EXPORTER_KEY); if (handler != null) { JRDocxExporterContext exporterContext = new ExporterContext(tableHelper); handler.exportElement(exporterContext, element, gridCell); } else { if (log.isDebugEnabled()) { log.debug("No DOCX generic element handler for " + element.getGenericType()); } } }
@Override public void exportElement( JRXlsExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout ) { JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT); if (labelPrintText != null) { try { JRXlsExporter exporter = (JRXlsExporter)exporterContext.getExporterRef(); exporter.exportText(labelPrintText, gridCell, colIndex, rowIndex); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public void exportElement( JROdsExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout ) { JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT); if (labelPrintText != null) { try { JROdsExporter exporter = (JROdsExporter)exporterContext.getExporterRef(); exporter.exportText(labelPrintText, gridCell, colIndex, rowIndex); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override protected void exportGenericElement(JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout) throws JRException { GenericElementXlsHandler handler = (GenericElementXlsHandler) GenericElementHandlerEnviroment.getInstance(getJasperReportsContext()).getElementHandler( element.getGenericType(), XLS_EXPORTER_KEY); if (handler != null) { handler.exportElement(exporterContext, element, gridCell, colIndex, rowIndex, emptyCols, yCutsRow, layout); } else { if (log.isDebugEnabled()) { log.debug("No XLS generic element handler for " + element.getGenericType()); } } }
@Override public void exportElement( JRRtfExporterContext exporterContext, JRGenericPrintElement element ) { try { JRRtfExporter exporter = (JRRtfExporter)exporterContext.getExporterRef(); exporter.exportImage(MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element)); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public boolean isToExport(JRPrintElement element) { if (element instanceof JRGenericPrintElement) { JRGenericPrintElement genericElement = (JRGenericPrintElement) element; GenericElementHandler handler = handlerEnvironment.getElementHandler( genericElement.getGenericType(), JROdtExporter.ODT_EXPORTER_KEY); if (handler == null || !handler.toExport(genericElement)) { return false; } } return (filter == null || filter.isToExport(element)); }
protected void exportElements(Collection<JRPrintElement> elements) throws 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 JRPrintFrame) { exportFrame((JRPrintFrame)element); } else if (element instanceof JRGenericPrintElement) { exportGenericElement((JRGenericPrintElement) element); } } } } }
@Override public void exportElement( JRDocxExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell ) { JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT); if (labelPrintText != null) { try { JRDocxExporter exporter = (JRDocxExporter)exporterContext.getExporterRef(); exporter.exportText(exporterContext.getTableHelper(), labelPrintText, gridCell); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public void exportElement( JRXlsxExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex ) throws JRException { JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT); if (labelPrintText != null) { try { JRXlsxExporter exporter = (JRXlsxExporter)exporterContext.getExporterRef(); exporter.exportText(labelPrintText, gridCell, colIndex, rowIndex); } catch (Exception e) { throw new RuntimeException(e); } } }
@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); } } }
@Override public boolean isToExport(JRPrintElement element) { if (element instanceof JRGenericPrintElement) { JRGenericPrintElement genericElement = (JRGenericPrintElement) element; GenericElementHandler handler = handlerEnvironment.getElementHandler( genericElement.getGenericType(), exporterKey); if (handler == null || !handler.toExport(genericElement)) { return false; } } return filter == null || filter.isToExport(element); }
@Override public void exportElement( JRXlsExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout ) { try { JRXlsExporter exporter = (JRXlsExporter)exporterContext.getExporterRef(); exporter.exportImage(MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element), gridCell, colIndex, rowIndex, emptyCols, yCutsRow, layout); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void visit(JRGenericPrintElement printElement, Offset offset) { GenericElementGraphics2DHandler handler = (GenericElementGraphics2DHandler)GenericElementHandlerEnviroment.getInstance(jasperReportsContext).getElementHandler( printElement.getGenericType(), JRGraphics2DExporter.GRAPHICS2D_EXPORTER_KEY ); if (handler != null) { handler.exportElement(this.frameDrawer.getExporterContext(), printElement, grx, offset); } else { if (log.isDebugEnabled()) { log.debug("No Graphics2D generic element handler for " + printElement.getGenericType()); } } }
protected void exportGenericElement(JRGenericPrintElement element) { GenericElementRtfHandler handler = (GenericElementRtfHandler) GenericElementHandlerEnviroment.getInstance(getJasperReportsContext()).getElementHandler( element.getGenericType(), RTF_EXPORTER_KEY); if (handler != null) { handler.exportElement(exporterContext, element); } else { if (log.isDebugEnabled()) { log.debug("No RTF generic element handler for " + element.getGenericType()); } } }
@Override public void exportElement(JRPdfExporterContext exporterContext, JRGenericPrintElement element) { PdfWriter writer = exporterContext.getPdfWriter(); JasperPrint jasperPrint = exporterContext.getExportedReport(); JRPrintText printText = (JRPrintText)element.getParameterValue(TextInputElement.PARAMETER_PRINT_TEXT_ELEMENT); if (printText == null) //FIXMEINPUT deal with xml serialization { return; } Rectangle rectangle = new Rectangle( element.getX() + exporterContext.getOffsetX(), jasperPrint.getPageHeight() - element.getY() - exporterContext.getOffsetY(), element.getX() + exporterContext.getOffsetX() + element.getWidth(), jasperPrint.getPageHeight() - element.getY() - exporterContext.getOffsetY() - element.getHeight() ); TextField text = new TextField(writer, rectangle, getFieldName(element)); Color backColor = printText.getBackcolor(); if(backColor != null){ text.setBackgroundColor(backColor); } Color forecolor = printText.getForecolor(); if(forecolor != null){ text.setTextColor(forecolor); } text.setText(printText.getFullText()); text.setDefaultText("default:" + printText.getFullText()); // text.setBackgroundColor(element.getBackcolor()); // text.setTextColor(element.getForecolor()); // text.setText(getText(element)); // text.setDefaultText(getDefaultText(element)); //FIXME: dynamic settings below: // text.setAlignment(Element.ALIGN_LEFT); // text.setBorderColor(Color.BLACK); // text.setBorderWidth(TextField.BORDER_WIDTH_THIN); // text.setBorderStyle(PdfBorderDictionary.STYLE_INSET); // text.setChoiceExports(null); // text.setChoices(null); // text.setChoiceSelection(0); // text.setExtensionFont(null); // text.setExtraMargin(0, 0); // try{ // text.setFont(BaseFont.createFont(BaseFont.COURIER, BaseFont.CP1250, true)); // }catch(Exception e){ // throw new JRRuntimeException(e); // } text.setFontSize(printText.getFontsize()); if (Boolean.TRUE.equals(element.getParameterValue(TextInputElement.PARAMETER_MULTI_LINE))) { text.setOptions(TextField.MULTILINE); } // text.setRotation(90); text.setVisibility(TextField.VISIBLE); try{ PdfFormField field = text.getTextField(); writer.addAnnotation(field); }catch(Exception e){ throw new JRRuntimeException(e); } }
protected void copy(JRGenericPrintElement printElement) { printElement.setParameterValue(TextInputElement.PARAMETER_PRINT_TEXT_ELEMENT, printText);//FIXMEINPUT // printElement.setParameterValue(SortElement.PARAMETER_SORT_COLUMN_NAME, sortComponent.getSortFieldName()); // printElement.setParameterValue(SortElement.PARAMETER_SORT_COLUMN_TYPE, sortComponent.getSortFieldType().getName()); // printElement.setParameterValue(SortElement.PARAMETER_SORT_HANDLER_COLOR, sortComponent.getHandlerColor()); // printElement.setParameterValue(SortElement.PARAMETER_SORT_HANDLER_FONT, sortComponent.getSymbolFont()); // // if (sortComponent.getSymbolFont() != null ) { // printElement.setParameterValue(SortElement.PARAMETER_SORT_HANDLER_FONT_SIZE, String.valueOf(sortComponent.getSymbolFont().getFontSize())); // } // if (sortComponent.getHandlerHorizontalAlign() != null) // { // printElement.setParameterValue(SortElement.PARAMETER_SORT_HANDLER_HORIZONTAL_ALIGN, sortComponent.getHandlerHorizontalAlign().getName()); // } // if (sortComponent.getHandlerVerticalAlign() != null) // { // printElement.setParameterValue(SortElement.PARAMETER_SORT_HANDLER_VERTICAL_ALIGN, sortComponent.getHandlerVerticalAlign().getName()); // } // // FilterTypesEnum filterType = getFilterType(); // if (filterType != null) // { // printElement.getPropertiesMap().setProperty(SortElement.PROPERTY_FILTER_TYPE, filterType.getName()); // } // // String datasetName = JRAbstractCompiler.getUnitName( // fillContext.getFiller().getJasperReport(), fillContext.getFillDataset()); // printElement.getPropertiesMap().setProperty(SortElement.PROPERTY_DATASET_RUN, datasetName); }
@Override public void exportElement( JROdsExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout ) { try { JROdsExporter exporter = (JROdsExporter)exporterContext.getExporterRef(); exporter.exportImage( MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element), gridCell, colIndex, rowIndex, 0, 0, null ); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public String getJsonFragment(JsonExporterContext exporterContext, JRGenericPrintElement element) { ReportContext reportContext = exporterContext.getExporterRef().getReportContext(); String jsonFragment = null; if (reportContext != null) { Map<String, Object> elementInfo = new LinkedHashMap<String, Object>(); String crosstabId = (String) element.getParameterValue(ELEMENT_PARAMETER_CROSSTAB_ID); String crosstabFragmentId = (String) element.getParameterValue(ELEMENT_PARAMETER_CROSSTAB_FRAGMENT_ID); if (crosstabFragmentId == null) { // this can happen for JasperPrints generated by 5.5.0 crosstabFragmentId = crosstabId; } elementInfo.put("type", "crosstab"); elementInfo.put("module", "jive.crosstab"); elementInfo.put("uimodule", "jive.crosstab.interactive"); elementInfo.put("id", crosstabFragmentId); elementInfo.put("fragmentId", crosstabFragmentId); elementInfo.put("crosstabId", crosstabId); elementInfo.put("startColumnIndex", element.getParameterValue(ELEMENT_PARAMETER_START_COLUMN_INDEX)); elementInfo.put("hasFloatingHeaders", element.getParameterValue(ELEMENT_PARAMETER_FLOATING_HEADERS)); elementInfo.put("rowGroups", element.getParameterValue(ELEMENT_PARAMETER_ROW_GROUPS)); elementInfo.put("dataColumns", element.getParameterValue(ELEMENT_PARAMETER_DATA_COLUMNS)); String elementInfoJson = JacksonUtil.getInstance(exporterContext.getJasperReportsContext()).getJsonString(elementInfo); // assuming the Id doesn't need escaping jsonFragment = "\"" + crosstabFragmentId + "\":" + elementInfoJson; } return jsonFragment; }
protected void copy(JRGenericPrintElement printElement) { dataset.finishDataset(); String chartData = ChartDataGenerator.instance().generatePieChart(title, dataset); printElement.setParameterValue(ChartHtmlHandler.PARAMETER_CHART_DATA, chartData); }
public JRExporterGridCell getGridCellReplacement( JRExporterContext exporterContext, JRGenericPrintElement element, JRExporterGridCell gridCell ) { JRPrintText text = getTextElementReplacement(exporterContext, element); JRExporterGridCell newGridCell = new ElementReplacementGridCell((ElementGridCell) gridCell, text); newGridCell.setBox(text.getLineBox()); return newGridCell; }
public void exportElement( JRPptxExporterContext exporterContext, JRGenericPrintElement element ) { JRPptxExporter exporter = (JRPptxExporter)exporterContext.getExporterRef(); JRPrintText text = getTextElementReplacement(exporterContext, element); exporter.exportText(text); }
protected void copy(JRGenericPrintElement printElement) { dataset.finishDataset(); String chartData = ChartDataGenerator.instance().generateBarChart(title, dataset); printElement.setParameterValue(ChartHtmlHandler.PARAMETER_CHART_DATA, chartData); }
@Override public void evaluateDelayedElement(JRPrintElement element, byte evaluation) throws JRException { evaluateMap(evaluation); copy((JRGenericPrintElement) element); }
@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 Dimension getComputedSize(JRGenericPrintElement element) { String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT); FlyingSaucerXhtmlToImageRenderer renderer = new FlyingSaucerXhtmlToImageRenderer(getHtmlDocument(htmlContent), element.getWidth(), element.getHeight()); return renderer.getComputedSize(); }
@Override protected void resolveElement(JRPrintElement element, byte evaluation) throws JRException { JRGenericPrintElement genericElement = (JRGenericPrintElement) element; evaluateElement(evaluation); copy(genericElement); }
@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 void visit(JRGenericPrintElement printElement, T arg) { for (PrintElementVisitor<T> visitor : visitors) { visitor.visit(printElement, arg); } }