@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { if (element.getComponent() == null) { return null; } try { HtmlPrintElement htmlPrintElement = HtmlPrintElementUtils.getHtmlPrintElement(); return htmlPrintElement.createImageFromComponentElement(element); } catch (Exception e) { return null; } }
/** * */ public DrawVisitor(ReportConverter reportConverter, Graphics2D grx) { this.convertVisitor = new ConvertVisitor(reportConverter); JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext(); JRReport report = reportConverter.getReport(); JRPropertiesUtil propUtil = JRPropertiesUtil.getInstance(jasperReportsContext); this.drawVisitor = new PrintDrawVisitor( jasperReportsContext, new RenderersCache(jasperReportsContext), propUtil.getBooleanProperty(report, Graphics2DReportConfiguration.MINIMIZE_PRINTER_JOB_SIZE, true), propUtil.getBooleanProperty(report, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false) ); setGraphics2D(grx); this.drawVisitor.setClip(true); }
protected Renderable evaluateBarcode(ReportConverter reportConverter, JRComponentElement element) { try { BarcodeDesignEvaluator evaluator = new BarcodeDesignEvaluator( reportConverter.getJasperReportsContext(), element, reportConverter.getDefaultStyleProvider() ); return evaluator.evaluateImage(); } catch (Exception e) { if (log.isWarnEnabled()) { log.warn("Failed to create barcode preview", e); } return null; } }
/** * */ public JRPrintElement convert(ReportConverter reportConverter, JRElement element) { JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider()); JRChart chart = (JRChart) element; copyElement(reportConverter, chart, printImage); printImage.copyBox(chart.getLineBox()); printImage.setAnchorName(JRExpressionUtil.getExpressionText(chart.getAnchorNameExpression())); printImage.setBookmarkLevel(chart.getBookmarkLevel()); printImage.setLinkType(chart.getLinkType()); printImage.setOnErrorType(OnErrorTypeEnum.ICON); printImage.setRenderable(getRenderer(reportConverter, chart)); printImage.setScaleImage(ScaleImageEnum.CLIP); return printImage; }
private JFreeChart getJFreeChart(ReportConverter reportConverter, JRChart chart) { JasperReportsContext jContext = reportConverter.getJasperReportsContext(); String themeName = chart.getTheme(); if (themeName == null) { themeName = JRPropertiesUtil.getInstance(jContext).getProperty(reportConverter.getReport(), JRChart.PROPERTY_CHART_THEME); } ChartTheme theme = ChartUtil.getInstance(jContext).getTheme(themeName); ChartContext chartContext = new ConvertChartContext(chart, jContext); JFreeChart jfreeChart = null; try { jfreeChart = theme.createChart(chartContext); } catch (JRException e) { throw new JRRuntimeException(e); } return jfreeChart; }
/** * */ public JRPrintElement convert(final ReportConverter reportConverter, final JRElement element) { JRImage image = (JRImage) element; JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider()); Renderable cacheRenderer = getRenderable(reportConverter, element, image, printImage); copyGraphicElement(reportConverter, image, printImage); printImage.copyBox(image.getLineBox()); printImage.setAnchorName(JRExpressionUtil.getExpressionText(image.getAnchorNameExpression())); printImage.setBookmarkLevel(image.getBookmarkLevel()); printImage.setHorizontalAlignment(image.getOwnHorizontalAlignmentValue()); printImage.setLazy(image.isLazy()); printImage.setLinkType(image.getLinkType()); printImage.setOnErrorType(OnErrorTypeEnum.ICON); printImage.setVerticalAlignment(image.getOwnVerticalAlignmentValue()); if (cacheRenderer == null) cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), image, printImage); printImage.setRenderable(cacheRenderer); printImage.setScaleImage(image.getOwnScaleImageValue()); return printImage; }
/** * */ public JRPrintElement convert(final ReportConverter reportConverter, final JRComponentElement element) { MapComponent map = (MapComponent) element.getComponent(); JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider()); Renderable cacheRenderer = getRenderable(reportConverter, element, map, printImage); printImage.setUUID(element.getUUID()); printImage.setX(element.getX()); printImage.setY(element.getY()); printImage.setWidth(element.getWidth()); printImage.setHeight(element.getHeight()); printImage.setStyle(element.getStyle()); printImage.setMode(element.getModeValue()); printImage.setBackcolor(element.getBackcolor()); printImage.setForecolor(element.getForecolor()); printImage.setLazy(false); // FIXMEMAP there are no scale image, alignment and onError attributes // defined for the map element printImage.setScaleImage(ScaleImageEnum.CLIP); printImage.setHorizontalAlignment(HorizontalAlignEnum.LEFT); printImage.setVerticalAlignment(VerticalAlignEnum.TOP); printImage.setRenderable(cacheRenderer); return printImage; }
/** * Return the content for an MImage element * * @param reportConverter the report converter * @param element a not null MImage element * @return An image pointed by the expression of the element if it can be found, the * standard not found image otherwise. it is never null */ public JRPrintElement convertImage(ReportConverter reportConverter, MGraphicElement element){ JRImage image = (JRImage) element.getValue(); JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider()); Renderable cacheRenderer = getRenderable(reportConverter, image, element); copyGraphicElement(reportConverter, image, printImage); printImage.copyBox(image.getLineBox()); printImage.setAnchorName(JRExpressionUtil.getExpressionText(image.getAnchorNameExpression())); printImage.setBookmarkLevel(image.getBookmarkLevel()); printImage.setHorizontalAlignment(image.getOwnHorizontalAlignmentValue()); printImage.setLazy(image.isLazy()); printImage.setLinkType(image.getLinkType()); printImage.setOnErrorType(OnErrorTypeEnum.ICON); printImage.setVerticalAlignment(image.getOwnVerticalAlignmentValue()); //If it is null load the no image found element if (cacheRenderer == null) cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), image, printImage); printImage.setRenderable(cacheRenderer); printImage.setScaleImage(image.getOwnScaleImageValue()); return printImage; }
/** * Extract the requested image from the cache if it is available. If it is available is returned (even if it is * expired). If it is expired is returned but a refresh job is started. Otherwise, if it is unavailable is returned * null but a refresh job to try to get the image is started * * @param reportConverter the report converter * @param image the image element * @param modelElement the model that encapsulate the image * @return the image to display if it is cached (expired or not), null otherwise */ private Renderable getRenderable(ReportConverter reportConverter, JRImage image, MGraphicElement modelElement) { JasperReportsContext jrContext = reportConverter.getJasperReportsContext(); JRExpression expr = image.getExpression(); KeyValue<JasperReportsContext, String> key = new KeyValue<JasperReportsContext, String>(jrContext, expr != null ? expr.getText() : ""); TimedCache imageInfo = imgCache.get(key); //Check if the image was cached if (imageInfo == null){ imageInfo = new TimedCache(); imgCache.put(key, imageInfo); } //If the image is expired (it is also expired when is empty, the refresh thread is started) if (imageInfo.isExpired()) refreshImageInfo(imageInfo, modelElement, expr, jrContext, key); return imageInfo.getImage(); }
/** * */ public JSSDrawVisitor(ReportConverter reportConverter, Graphics2D grx) { this.reportConverter = reportConverter; this.convertVisitor = new JSSConvertVisitor(reportConverter); final JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext(); this.drawVisitor = new PrintDrawVisitor(jasperReportsContext) { @Override public void setTextRenderer(JRReport report) { AwtTextRenderer textRenderer = new AwtTextRenderer(jasperReportsContext, JRPropertiesUtil.getInstance( jasperReportsContext).getBooleanProperty(report, JRGraphics2DExporter.MINIMIZE_PRINTER_JOB_SIZE, true), JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(report, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false)); setTextDrawer(new TextDrawer(jasperReportsContext, textRenderer)); setFrameDrawer(new FrameDrawer(jasperReportsContext, null, textRenderer)); } }; setTextRenderer(reportConverter.getReport()); this.grx = grx; setGraphics2D(grx); this.drawVisitor.setClip(true); }
/** * */ public JRDesignViewer( JasperReportsContext jasperReportsContext, JRReport report ) throws JRException { super(jasperReportsContext, new ReportConverter(jasperReportsContext, report, false).getJasperPrint(), null, null); //reconfigureReloadButton(); hideUnusedComponents(); }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { JRBasePrintImage printImage = new JRBasePrintImage( reportConverter.getDefaultStyleProvider()); reportConverter.copyBaseAttributes(element, printImage); printImage.setScaleImage(ScaleImageEnum.RETAIN_SHAPE); Renderable barcodeImage = evaluateBarcode(reportConverter, element); printImage.setRenderer(barcodeImage); return printImage; }
private void fillData() { ADSComponent c = null; if (eDataset != null) c = map.get(eDataset.getClass()); if (c != null) { dv = new JSSDrawVisitor( new ReportConverter(jrContext, jrDesign, true), c.getGraphics2D()); c.setData(dv, jrChart, eDataset, jrContext); stacklayout.topControl = c.getControl(); } else { // a label, with not implemented ... } sComposite.layout(true); }
/** * Create a buffered image of the same size of the text element and cache it */ private static void createBufferedImage(){ bi = new BufferedImage(textElement.getWidth(), textElement.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bi.createGraphics(); g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); visitor = new DrawVisitor(new ReportConverter(DefaultJasperReportsContext.getInstance(), jasperDesign, true), g2d); }
public JSSDrawVisitor getDrawVisitor(ANode model) { if (model == null) return null; JasperDesign tjd = model.getJasperDesign(); if (tjd != jDesign) { jDesign = tjd; drawVisitor = new JSSDrawVisitor(new ReportConverter(jrContext, jDesign, true), null); } if (drawVisitor == null) drawVisitor = new JSSDrawVisitor(new ReportConverter(jrContext, jDesign, true), null); drawVisitor.setClip(false); return drawVisitor; }
protected Renderable getRenderable(final ReportConverter reportConverter, final JRElement element, final JRImage image, final JRBasePrintImage printImage) { Renderable cacheRenderer = null; try { cacheRenderer = cache.get(element); if (image.getExpression() != null) { String expr = image.getExpression().getText(); KeyValue<String, Long> last = running.get(element); Renderable r = null; if (cacheRenderer == null) { cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), image, printImage); cache.put(element, cacheRenderer); if (last == null) r = doFindImage(reportConverter, element, image, printImage, expr, cacheRenderer); } if (last != null && (!last.key.equals(expr) || (last.value != null && System.currentTimeMillis() - last.value.longValue() > 2000))) { r = doFindImage(reportConverter, element, image, printImage, expr, cacheRenderer); } if (last == null) r = doFindImage(reportConverter, element, image, printImage, expr, cacheRenderer); if (r != null) cacheRenderer = r; } else { running.remove(element); cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), image, printImage); cache.put(element, cacheRenderer); } } catch (Throwable e) { return getRenderableNoImage(reportConverter.getJasperReportsContext(), image, printImage); } return cacheRenderer; }
public static void loadFileIntoViewer(final IFile file, final IReportViewer viewer, Display display) { display.asyncExec(new Runnable() { public void run() { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); try { ClassLoader projectClassLoader = createProjectClassLoader(file.getProject()); if (projectClassLoader != null) { Thread.currentThread().setContextClassLoader(projectClassLoader); } try { JRReport report = ReportLoader.loadReport(file); if (report == null) { viewer.setReport(null); } else { viewer.setReport(new ReportConverter(DefaultJasperReportsContext.getInstance(), report, false).getJasperPrint()); } } catch (Throwable t) { UIUtils.showError(t); } } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } } }); }
/** * */ public ConfigurableDrawVisitor(ReportConverter reportConverter, Graphics2D grx) { super( reportConverter, grx); //this.convertVisitor = new ConvertVisitor(reportConverter); this.grx = grx; this.reportConverter = reportConverter; }
public void modelChanged() { Mutex.EVENT.readAccess( new Runnable() { public void run() { if (getModel() == null) return; JRCTXExtensionsRegistryFactory.setChartThemeSettings(getModel().getTemplate()); try { viewerContext.loadReport( new ReportConverter( chartTypeReports[reportIndex], false).getJasperPrint() ); //viewerToolbar.init(); viewerContext.refreshPage(); updateUI(); } finally { JRCTXExtensionsRegistryFactory.setChartThemeSettings(null); } } } ); }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { return convert(reportConverter, (JRElement)element); }
private void setReport(JRReport report) throws JRException { this.jasperPrint = new ReportConverter(getJasperReportsContext(), report, false).getJasperPrint(); }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent(); if (chartComponent == null) { return null; } JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider()); ChartSettings chartSettings = chartComponent.getChartSettings(); reportConverter.copyBaseAttributes(element, printImage); //TODO: spiderchart box // printImage.copyBox(element.getLineBox()); printImage.setAnchorName(JRExpressionUtil.getExpressionText(chartSettings.getAnchorNameExpression())); printImage.setBookmarkLevel(chartSettings.getBookmarkLevel()); printImage.setLinkType(chartSettings.getLinkType()); printImage.setOnErrorType(OnErrorTypeEnum.ICON); printImage.setScaleImage(ScaleImageEnum.CLIP); SpiderChartSharedBean spiderchartBean = new SpiderChartSharedBean( chartSettings.getRenderType(), SpiderChartRendererEvaluator.SAMPLE_MAXVALUE, JRExpressionUtil.getExpressionText(chartSettings.getTitleExpression()), JRExpressionUtil.getExpressionText(chartSettings.getSubtitleExpression()), null, null ); printImage.setRenderer( SpiderChartRendererEvaluator.evaluateRenderable( reportConverter.getJasperReportsContext(), element, spiderchartBean, null, JRPropertiesUtil.getInstance(reportConverter.getJasperReportsContext()).getProperty(reportConverter.getReport(), JRChart.PROPERTY_CHART_RENDER_TYPE), SpiderChartRendererEvaluator.SAMPLE_DATASET) ); return printImage; }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { ListComponent list = (ListComponent) element.getComponent(); if (list == null || list.getContents() == null) { return null; } JRBasePrintFrame frame = new JRBasePrintFrame( reportConverter.getDefaultStyleProvider()); reportConverter.copyBaseAttributes(element, frame); ListContents contents = list.getContents(); if (contents.getHeight() > 0) { JRBasePrintFrame contentsFrame = new JRBasePrintFrame( reportConverter.getDefaultStyleProvider()); contentsFrame.setUUID(element.getUUID()); contentsFrame.setX(0); contentsFrame.setY(0); contentsFrame.setWidth(element.getWidth()); contentsFrame.setHeight(contents.getHeight()); contentsFrame.setMode(ModeEnum.TRANSPARENT); List<JRChild> children = contents.getChildren(); if (children != null) { ConvertVisitor contentsVisitor = new ConvertVisitor(reportConverter, contentsFrame); for (Iterator<JRChild> it = children.iterator(); it .hasNext();) { JRChild child = it.next(); child.visit(contentsVisitor); } } frame.addElement(contentsFrame); /* Integer width = contents.getWidth(); int contentsWidth = width == null ? element.getWidth() : width.intValue(); if (contents.getHeight() < element.getHeight() || contentsWidth < element.getWidth()) { // add a grey rectangle to highlight the contents height JRBasePrintImage image = new JRBasePrintImage( reportConverter.getDefaultStyleProvider()); image.setX(0); image.setWidth(element.getWidth()); image.setY(0); image.setHeight(element.getHeight()); image.setMode(ModeEnum.TRANSPARENT); // clip out the list contents area Area clip = new Area(new Rectangle( 0, 0, element.getWidth(), element.getHeight())); clip.subtract(new Area(new Rectangle( 0, 0, contentsWidth, contents.getHeight()))); image.setRenderer(new UnusedSpaceImageRenderer(clip)); frame.addElement(image); } */ } return frame; }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { BarbecueComponent component = (BarbecueComponent) element.getComponent(); if (component == null || component.getType() == null) { return null; } try { JRBasePrintImage image = new JRBasePrintImage( reportConverter.getDefaultStyleProvider()); reportConverter.copyBaseAttributes(element, image); image.setScaleImage(ScaleImageEnum.RETAIN_SHAPE); String code = null; if (component.getCodeExpression() != null) { code = JRExpressionUtil.getSimpleExpressionText( component.getCodeExpression()); } if (code == null) { //TODO custom default code code = DEFAULT_PREVIEW_CODE; } String applicationIdentifier = null; if (component.getApplicationIdentifierExpression() != null) { applicationIdentifier = JRExpressionUtil.getSimpleExpressionText( component.getApplicationIdentifierExpression()); } //TODO custom default app id BarcodeInfo barcodeInfo = new BarcodeInfo(); barcodeInfo.setType(component.getType()); barcodeInfo.setCode(code); barcodeInfo.setApplicationIdentifier(applicationIdentifier); barcodeInfo.setDrawText(component.isDrawText()); barcodeInfo.setRequiresChecksum(component.isChecksumRequired()); barcodeInfo.setBarWidth(component.getBarWidth()); barcodeInfo.setBarHeight(component.getBarHeight()); Barcode barcode = BarcodeProviders.createBarcode(barcodeInfo); BarbecueRendererImpl renderer = new BarbecueRendererImpl(barcode); renderer.setRotation(BarbecueStyleResolver.getRotationValue(element)); image.setRenderer(renderer); return image; } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Error while previewing barcode", e); } return null; } }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { TableComponent table = (TableComponent) element.getComponent(); if (table == null)// || list.getContents() == null) { return null; } JRBasePrintFrame frame = new JRBasePrintFrame( reportConverter.getDefaultStyleProvider()); reportConverter.copyBaseAttributes(element, frame); TableUtil tableManager = new TableUtil( table, reportConverter.getReport() ); Map<Cell, Rectangle> cellBounds = tableManager.getCellBounds(); for (Map.Entry<Cell, Rectangle> pair : cellBounds.entrySet()) { Cell cell = pair.getKey(); Rectangle rectangle = pair.getValue(); JRBasePrintFrame cellFrame = new JRBasePrintFrame( reportConverter.getDefaultStyleProvider() ); cellFrame.setX((int)rectangle.getX()); cellFrame.setY((int)rectangle.getY()); cellFrame.setWidth((int)rectangle.getWidth()); cellFrame.setHeight((int)rectangle.getHeight()); cellFrame.setStyle(reportConverter.resolveStyle(cell)); if (cell.getLineBox() != null) { cellFrame.copyBox(cell.getLineBox()); } List<JRChild> children = cell.getChildren(); if (children != null && children.size() > 0) { ConvertVisitor convertVisitor = new ConvertVisitor(reportConverter, cellFrame); for(int i = 0; i < children.size(); i++) { (children.get(i)).visit(convertVisitor); } } frame.addElement(cellFrame); } return frame; }
protected Renderable getRenderable(final ReportConverter reportConverter, final JRComponentElement element, MapComponent map, final JRBasePrintImage printImage) { Renderable cacheRenderer = null; try { cacheRenderer = cache.get(element); String expr = "" + element.getWidth() + element.getHeight(); if (map.getLongitudeExpression() != null) expr += map.getLongitudeExpression().getText(); if (map.getLatitudeExpression() != null) expr += map.getLatitudeExpression().getText(); if (map.getLanguageExpression() != null) expr += map.getLanguageExpression().getText(); if (map.getZoomExpression() != null) expr += map.getZoomExpression().getText(); if (map.getMapType() != null) expr += map.getMapType().getName(); if (map.getMapScale() != null) expr += map.getMapScale().getName(); if (!expr.isEmpty()) { KeyValue<String, Long> last = running.get(element); Renderable r = null; if (cacheRenderer == null) { cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), map, printImage); cache.put(element, cacheRenderer); if (last == null) r = doFindImage(reportConverter, element, map, expr, cacheRenderer); } if (last != null && (!last.key.equals(expr))) r = doFindImage(reportConverter, element, map, expr, cacheRenderer); if (last == null) r = doFindImage(reportConverter, element, map, expr, cacheRenderer); if (r != null) cacheRenderer = r; } else { running.remove(element); cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), map, printImage); cache.put(element, cacheRenderer); } } catch (Throwable e) { return getRenderableNoImage(reportConverter.getJasperReportsContext(), map, printImage); } return cacheRenderer; }
/** * The default convert does nothing in this class because this is think to work * with the model, instead that with the jrelement. */ @Override public JRPrintElement convert(ReportConverter reportConverter, JRElement element) { return null; }
public ReportConverter getReportConverter(){ return reportConverter; }
public JSSConvertVisitor(ReportConverter reportConverter) { super(reportConverter); }
public JSSConvertVisitor(ReportConverter reportConverter, JRBasePrintFrame parentFrame) { super(reportConverter, parentFrame); }
/** * Draw a cell painting just the border and the cell name. **/ private void paintCell(Graphics2D g, String title, int x, int y, JRCellContents contents) { if (contents == null) return; int width = contents.getWidth(); int height = contents.getHeight(); int txt_height = g.getFontMetrics().getHeight()/2; Paint oldPaint = g.getPaint(); Shape oldClip = g.getClip(); //Java2DUtils.resetClip(g); g.setPaint(CELL_LABEL_COLOR); g.drawRect(x, y, width, height); g.setPaint(oldPaint); g.setPaint(AbstractReportObjectScene.DESIGN_LINE_COLOR); AffineTransform af = g.getTransform(); AffineTransform new_af = (AffineTransform) af.clone(); AffineTransform translate = AffineTransform.getTranslateInstance( x, y); new_af.concatenate(translate); g.setTransform(new_af); JRFrame frame = getCrosstabCellFrame(new ReportConverter(getJasperDesign(),true), contents, x,y, x==0 && crosstab.getRunDirectionValue() == RunDirectionEnum.LTR, x==0 && crosstab.getRunDirectionValue() == RunDirectionEnum.RTL, false); if (frame != null && ((CrosstabObjectScene)this.getScene()).getDrawVisitor() != null) { ((CrosstabObjectScene)this.getScene()).getDrawVisitor().setGraphics2D(g); ((CrosstabObjectScene)this.getScene()).getDrawVisitor().visitFrame(frame); } g.setTransform(af); g.clipRect(x, y, width-2, height-2); // TODO: add to the visitore the code to draw a void cell.... Color cc = contents.getBackcolor() != null ? contents.getBackcolor() : Color.WHITE; cc = cc.darker(); //new Color( cc.getRed(), cc.getGreen(), cc.getBlue(), 200); g.setPaint(cc); if (IReportManager.getPreferences().getBoolean( IReportManager.PROPERTY_SHOW_CELL_NAMES, false)) { g.drawString( title, x+3, y + txt_height + 3); } g.setClip(oldClip); g.setPaint(oldPaint); }
private JRFrame getCrosstabCellFrame( ReportConverter reportConverter, JRCellContents cell, int x, int y, boolean left, boolean right, boolean top ) { JRDesignFrame frame = new JRDesignFrame(cell.getDefaultStyleProvider()); frame.setX(x); frame.setY(y); frame.setWidth(cell.getWidth()); frame.setHeight(cell.getHeight()); frame.setMode(cell.getModeValue()); frame.setBackcolor(cell.getBackcolor()); //frame.setStyle(reportConverter.resolveStyle(cell)); JRLineBox box = cell.getLineBox(); if (box != null) { frame.copyBox(box); boolean copyLeft = left && box.getLeftPen().getLineWidth().floatValue() <= 0f && box.getRightPen().getLineWidth().floatValue() > 0f; boolean copyRight = right && box.getRightPen().getLineWidth().floatValue() <= 0f && box.getLeftPen().getLineWidth().floatValue() > 0f; boolean copyTop = top && box.getTopPen().getLineWidth().floatValue() <= 0f && box.getBottomPen().getLineWidth().floatValue() > 0f; if (copyLeft) { ((JRBaseLineBox)frame.getLineBox()).copyLeftPen(box.getRightPen()); } if (copyRight) { ((JRBaseLineBox)frame.getLineBox()).copyRightPen(box.getLeftPen()); } if (copyTop) { ((JRBaseLineBox)frame.getLineBox()).copyTopPen(box.getBottomPen()); } } return frame; }
/** * */ public ConfigurableDrawVisitor(JRReport report, Graphics2D grx) { this(new ReportConverter(IRLocalJasperReportsContext.getInstance(), report, true), grx); }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element) { return convert(reportConverter, (JRElement) element); }
/** * Converts a component element into a print element that represents a preview * of the component. * * @param reportConverter the report converter instance * @param element the component element * @return a print element that represents a preview of the component */ JRPrintElement convert(ReportConverter reportConverter, JRComponentElement element);