net.sf.jasperreports.engine.DefaultJasperReportsContext Java Examples
The following examples show how to use
net.sf.jasperreports.engine.DefaultJasperReportsContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JRVirtualizationContext.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
private void setThreadJasperReportsContext() { JasperReportsContext threadJasperReportsContext = JRVirtualizationHelper.getThreadJasperReportsContext(); if (threadJasperReportsContext != null) { jasperReportsContext = threadJasperReportsContext; } else if (jasperReportsContext == null) { if (log.isDebugEnabled()) { log.debug("no thread JRContext, using default"); } jasperReportsContext = DefaultJasperReportsContext.getInstance(); } }
Example #2
Source File: JRBasePart.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
public JRBasePart(JRPart part, JRBaseObjectFactory factory) { factory.put(part, this); this.uuid = part.getUUID(); this.propertiesMap = JRPropertiesMap.getPropertiesClone(part); this.printWhenExpression = factory.getExpression(part.getPrintWhenExpression()); this.partNameExpression = factory.getExpression(part.getPartNameExpression()); this.evaluationTime = part.getEvaluationTime(); componentKey = part.getComponentKey(); PartComponentManager manager = PartComponentsEnvironment.getInstance(DefaultJasperReportsContext.getInstance()).getManager(componentKey); component = manager.getComponentCompiler(DefaultJasperReportsContext.getInstance()).toCompiledComponent( part.getComponent(), factory); if (component instanceof JRVisitable) { ((JRVisitable) component).visit(factory); } }
Example #3
Source File: JasperViewer.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * @see #viewReport(JasperReportsContext, InputStream, boolean, boolean, Locale, ResourceBundle) */ public static void viewReport( InputStream is, boolean isXMLFile, boolean isExitOnClose, Locale locale ) throws JRException { viewReport( DefaultJasperReportsContext.getInstance(), is, isXMLFile, isExitOnClose, locale, null ); }
Example #4
Source File: JRFillDataset.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * Creates a fill dataset object. * @param filler the filler * @param dataset the template dataset * @param factory the fill object factory */ public JRFillDataset(BaseReportFiller filler, JRDataset dataset, JRFillObjectFactory factory) { factory.put(dataset, this); this.filler = filler; this.propertiesUtil = filler == null ? JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()) : filler.getPropertiesUtil(); this.parent = dataset; this.isMain = dataset.isMainDataset(); scriptletClassName = dataset.getScriptletClass(); resourceBundleBaseName = dataset.getResourceBundle(); whenResourceMissingType = dataset.getWhenResourceMissingTypeValue(); query = dataset.getQuery(); setParameters(dataset, factory); setFields(dataset, factory); setVariables(dataset, factory); setGroups(dataset, factory); staticProperties = dataset.hasProperties() ? dataset.getPropertiesMap().cloneProperties() : null; mergedProperties = staticProperties; DatasetPropertyExpression[] datasetPropertyExpressions = dataset.getPropertyExpressions(); propertyExpressions = datasetPropertyExpressions == null ? new ArrayList<DatasetPropertyExpression>(0) : new ArrayList<DatasetPropertyExpression>(Arrays.asList(datasetPropertyExpressions)); }
Example #5
Source File: JasperReportsUtils.java From JuniperBot with GNU General Public License v3.0 | 5 votes |
public static BufferedImage printToImage(JasperPrint jasperPrint, int pageIndex, float zoom) throws JRException { JRGraphEnvInitializer.initializeGraphEnv(); PrintPageFormat pageFormat = jasperPrint.getPageFormat(pageIndex); int rasterWidth = (int) Math.ceil(pageFormat.getPageWidth() * zoom); int rasterHeight = (int) Math.ceil(pageFormat.getPageHeight() * zoom); BufferedImage pageImage = new BufferedImage( rasterWidth, rasterHeight, BufferedImage.TYPE_INT_ARGB ); Graphics2D graphics = (Graphics2D) pageImage.getGraphics(); SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput(); output.setGraphics2D(graphics); SimpleGraphics2DReportConfiguration configuration = new SimpleGraphics2DReportConfiguration(); configuration.setPageIndex(pageIndex); configuration.setZoomRatio(zoom); configuration.setWhitePageBackground(false); JRGraphics2DExporter exporter = new JRGraphics2DExporter(DefaultJasperReportsContext.getInstance()); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(output); exporter.setConfiguration(configuration); exporter.exportReport(); graphics.dispose(); return pageImage; }
Example #6
Source File: JRViewer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see #JRViewer(InputStream, boolean, Locale, ResourceBundle) */ public JRViewer(InputStream is, boolean isXML, Locale locale, ResourceBundle resBundle) throws JRException { this( DefaultJasperReportsContext.getInstance(), is, isXML, locale, resBundle ); }
Example #7
Source File: HtmlPrintElementUtils.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * Return an {@link HtmlPrintElementFactory factory} instance. * * @return a HtmlPrintElementFactory instance * @throws JRException if the {@link #PROPERTY_HTML_PRINTELEMENT_FACTORY factory property} is not defined * or the factory cannot be instantiated. */ public static HtmlPrintElementFactory getHtmlPrintElementFactory() throws JRException { String factoryClassName = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperty(PROPERTY_HTML_PRINTELEMENT_FACTORY); if (factoryClassName == null) { factoryClassName = DefaultHtmlPrintElementFactory.class.getName(); } return cache.getCachedInstance(factoryClassName); }
Example #8
Source File: AsynchronousFillHandle.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see #createHandle(JasperReportsContext, JasperReport, Map) */ public static AsynchronousFillHandle createHandle( JasperReport jasperReport, Map<String,Object> parameters ) throws JRException { return createHandle(DefaultJasperReportsContext.getInstance(), jasperReport, parameters); }
Example #9
Source File: ExtensionsEnvironment.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
private static ExtensionsRegistry createDefaultRegistry() { String registryClass = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperty(PROPERTY_EXTENSIONS_REGISTRY_CLASS); if (log.isDebugEnabled()) { log.debug("Instantiating extensions registry class " + registryClass); } ExtensionsRegistry registry = (ExtensionsRegistry) ClassUtils. instantiateClass(registryClass, ExtensionsRegistry.class); return registry; }
Example #10
Source File: PhantomJS.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
private PhantomJS() { INSTANTIATED = true; this.jasperReportsContext = DefaultJasperReportsContext.getInstance(); this.scriptManager = new ScriptManager(jasperReportsContext); this.processDirector = new ProcessDirector(jasperReportsContext, this.scriptManager); }
Example #11
Source File: JRXmlDigesterFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * @deprecated Replaced by {@link #setComponentsInternalEntityResources(JasperReportsContext, JRXmlDigester)}. */ public static void setComponentsInternalEntityResources( JRXmlDigester digester ) { setComponentsInternalEntityResources(DefaultJasperReportsContext.getInstance(), digester); }
Example #12
Source File: WrappingDeprecatedRenderable.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void render( Graphics2D grx, Rectangle2D rectangle ) throws JRException { render(DefaultJasperReportsContext.getInstance(), grx, rectangle); }
Example #13
Source File: JRXmlWriter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see #write(JRReport, OutputStream, String) */ public static void writeReport( JRReport report, OutputStream outputStream, String encoding ) throws JRException { new JRXmlWriter(DefaultJasperReportsContext.getInstance()).write(report, outputStream, encoding); }
Example #14
Source File: JRXmlWriter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see #write(JRReport, String, String) */ public static void writeReport( JRReport report, String destFileName, String encoding ) throws JRException { new JRXmlWriter(DefaultJasperReportsContext.getInstance()).write(report, destFileName, encoding); }
Example #15
Source File: FileRepositoryServiceExtensionsRegistryFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { String root = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperty(properties, PROPERTY_FILE_REPOSITORY_ROOT); boolean resolveAbsolutePath = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getBooleanProperty(properties, PROPERTY_FILE_REPOSITORY_RESOLVE_ABSOLUTE_PATH, false); return new SingletonExtensionRegistry<RepositoryService>(RepositoryService.class, new FileRepositoryService(DefaultJasperReportsContext.getInstance(), root, resolveAbsolutePath)); }
Example #16
Source File: AbstractQueryExecuterFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * @deprecated Replaced by {@link #createQueryExecuter(JasperReportsContext, JRDataset, Map)}. */ @Override public final JRQueryExecuter createQueryExecuter( JRDataset dataset, Map<String, ? extends JRValueParameter> parameters ) throws JRException { return createQueryExecuter(DefaultJasperReportsContext.getInstance(), dataset, parameters); }
Example #17
Source File: FontExtensionsRegistry.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void ensureFontExtensions() { if ((fontFamilies == null || fontSets == null) && fontFamiliesLocations != null) { SimpleFontExtensionHelper fontExtensionHelper = SimpleFontExtensionHelper.getInstance(); DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance(); FontExtensionsCollector extensionsCollector = new FontExtensionsCollector(); for (String location : fontFamiliesLocations) { if (log.isDebugEnabled()) { log.debug("Loading font extensions from " + location); } try { fontExtensionHelper.loadFontExtensions(context, location, extensionsCollector); } catch (JRRuntimeException e)//only catching JRRuntimeException for now { log.error("Error loading font extensions from " + location, e); //keeping any font extensions collected so far, though it's a little weird } } fontFamilies = extensionsCollector.getFontFamilies(); fontSets = extensionsCollector.getFontSets(); } }
Example #18
Source File: JRViewer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see #JRViewer(JasperReportsContext, JasperPrint, Locale, ResourceBundle) */ public JRViewer(JasperPrint jrPrint, Locale locale, ResourceBundle resBundle) { this( DefaultJasperReportsContext.getInstance(), jrPrint, locale, resBundle ); }
Example #19
Source File: JRPdfExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected static synchronized void registerFonts () { if (!fontsRegistered) { List<PropertySuffix> fontFiles = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperties(PDF_FONT_FILES_PREFIX);//FIXMECONTEXT no default here and below if (!fontFiles.isEmpty()) { for (Iterator<PropertySuffix> i = fontFiles.iterator(); i.hasNext();) { JRPropertiesUtil.PropertySuffix font = i.next(); String file = font.getValue(); if (file.toLowerCase().endsWith(".ttc")) { FontFactory.register(file); } else { String alias = font.getSuffix(); FontFactory.register(file, alias); } } } List<PropertySuffix> fontDirs = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperties(PDF_FONT_DIRS_PREFIX); if (!fontDirs.isEmpty()) { for (Iterator<PropertySuffix> i = fontDirs.iterator(); i.hasNext();) { JRPropertiesUtil.PropertySuffix dir = i.next(); FontFactory.registerDirectory(dir.getValue()); } } fontsRegistered = true; } }
Example #20
Source File: DefaultRepositoryExtensionRegistry.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <T> List<T> getExtensions(Class<T> extensionType) { if (RepositoryService.class.equals(extensionType)) { return (List<T>) Collections.singletonList(new DefaultRepositoryService(DefaultJasperReportsContext.getInstance()));//FIXMEREPO check if this can be singleton } else if (PersistenceServiceFactory.class.equals(extensionType)) { return (List<T>) Collections.singletonList(DefaultRepositoryPersistenceServiceFactory.getInstance()); } return null; }
Example #21
Source File: JRXmlLoader.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * @deprecated Replaced by {@link #JRXmlLoader(JasperReportsContext, Digester)}. */ public JRXmlLoader(Digester digester) { this(DefaultJasperReportsContext.getInstance(), digester); }
Example #22
Source File: JRXmlTemplateLoader.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ private static JRXmlTemplateLoader getDefaultInstance() { return getInstance(DefaultJasperReportsContext.getInstance()); }
Example #23
Source File: HtmlExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
public HtmlExporter() { this(DefaultJasperReportsContext.getInstance()); }
Example #24
Source File: JRXmlDigesterFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * @deprecated Replaced by {@link #createParser(JasperReportsContext)}. */ protected static SAXParser createParser() { return createParser(DefaultJasperReportsContext.getInstance()); }
Example #25
Source File: ConvertChartContext.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@Override public JasperReportsContext getJasperReportsContext() { return DefaultJasperReportsContext.getInstance();//FIXMECONTEXT }
Example #26
Source File: JRXmlDigesterFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * @deprecated Replaced by {@link #addPartComponentRules(JasperReportsContext, Digester)}. */ protected static void addPartComponentRules(Digester digester) { addPartComponentRules(DefaultJasperReportsContext.getInstance(), digester); }
Example #27
Source File: JRXmlLoader.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * @see #load(JasperReportsContext, String) */ public static JasperDesign load(String sourceFileName) throws JRException//FIXMEREPO consider renaming { return load(DefaultJasperReportsContext.getInstance(), sourceFileName); }
Example #28
Source File: JsonQLExpressionsTest.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@BeforeMethod public void expectedResult(Method method) throws JRException { expectedResult = JsonUtil.parseJson(DefaultJasperReportsContext.getInstance(), "net/sf/jasperreports/jsonql/" + method.getName() + "_result.json"); }
Example #29
Source File: XmlServlet.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ public JRXmlExporter getExporter() { return new JRXmlExporter(DefaultJasperReportsContext.getInstance()); }
Example #30
Source File: JRXmlDigesterFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * @deprecated Replaced by {@link #configureDigester(JasperReportsContext, Digester)}. */ public static void configureDigester(Digester digester) throws SAXException, ParserConfigurationException { configureDigester(DefaultJasperReportsContext.getInstance(), digester); }