private static JRCompiler getCompiler(JasperDesign jasperDesign) throws JRException { JRCompiler compiler = null; String compilerClassName = JRProperties.getProperty(JRProperties.COMPILER_CLASS); if (compilerClassName == null || compilerClassName.trim().length() == 0) { String language = jasperDesign.getLanguage(); compilerClassName = JRProperties.getProperty(JRCompiler.COMPILER_PREFIX + language); if (compilerClassName == null || compilerClassName.trim().length() == 0) { if (JRReport.LANGUAGE_JAVA.equals(language)) { return getJavaCompiler(); } else { throw new JRException("No report compiler set for language : " + language); } } } try { Class clazz = JRClassLoader.loadClassForName(compilerClassName); compiler = (JRCompiler) clazz.newInstance(); } catch (Exception e) { throw new JRException("Could not instantiate report compiler : " + compilerClassName, e); } return compiler; }
public Class<?> getNestedType() { if (nestedTypeName != null && nestedType == null) { try { nestedType = JRClassLoader.loadClassForName(nestedTypeName); } catch (ClassNotFoundException e) { throw new JRRuntimeException(e); } } return nestedType; }
public Class<?> getValueClass() { if (valueClass == null) { String className = getValueClassRealName(); if (className != null) { try { valueClass = JRClassLoader.loadClassForName(className); } catch (ClassNotFoundException e) { throw new JRRuntimeException(e); } } } return valueClass; }
/** * Creates the scriptlet. * * @return the scriptlet * @throws JRException */ protected JRAbstractScriptlet createScriptlet() throws JRException { JRAbstractScriptlet tmpScriptlet = null; if (scriptletClassName != null) { try { Class scriptletClass = JRClassLoader.loadClassForName(scriptletClassName); tmpScriptlet = (JRAbstractScriptlet) scriptletClass.newInstance(); } catch (ClassNotFoundException e) { throw new JRException("Error loading scriptlet class : " + scriptletClassName, e); } catch (Exception e) { throw new JRException("Error creating scriptlet class instance : " + scriptletClassName, e); } } else { tmpScriptlet = new JRDefaultScriptlet(); } return tmpScriptlet; }
protected void evaluateRenderer(byte evaluation) throws JRException { maxValue = (Double) fillContext.evaluate(getPlot().getMaxValueExpression(), evaluation); titleText = JRStringUtil.getString( fillContext.evaluate(getChartSettings().getTitleExpression(), evaluation)); subtitleText = JRStringUtil.getString( fillContext.evaluate(getChartSettings().getSubtitleExpression(), evaluation)); anchorName = JRStringUtil.getString( fillContext.evaluate(getChartSettings().getAnchorNameExpression(), evaluation)); hyperlinkReference = JRStringUtil.getString( fillContext.evaluate(getChartSettings().getHyperlinkReferenceExpression(), evaluation)); hyperlinkAnchor = JRStringUtil.getString( fillContext.evaluate(getChartSettings().getHyperlinkAnchorExpression(), evaluation)); hyperlinkPage = (Integer) fillContext.evaluate(getChartSettings().getHyperlinkPageExpression(), evaluation); hyperlinkTooltip = JRStringUtil.getString( fillContext.evaluate(getChartSettings().getHyperlinkTooltipExpression(), evaluation)); hyperlinkParameters = JRFillHyperlinkHelper.evaluateHyperlinkParameters( getChartSettings(), expressionEvaluator, evaluation); dataset.evaluateDatasetRun(evaluation); dataset.finishDataset(); chartHyperlinkProvider = new CategoryChartHyperlinkProvider(dataset.getItemHyperlinks()); bookmarkLevel = getChartSettings().getBookmarkLevel(); JRComponentElement element = fillContext.getComponentElement(); SpiderChartSharedBean spiderChartSharedBean = new SpiderChartSharedBean( getChartSettings().getRenderType(), maxValue, titleText, subtitleText, chartHyperlinkProvider, dataset); customizerClass = chartSettings.getCustomizerClass(); if (customizerClass != null && customizerClass.length() > 0) { try { Class<?> myClass = JRClassLoader.loadClassForName(customizerClass); chartCustomizer = (ChartCustomizer) myClass.newInstance(); } catch (Exception e) { throw new JRRuntimeException("Could not create chart customizer instance.", e); } if (chartCustomizer instanceof AbstractChartCustomizer) { ((AbstractChartCustomizer) chartCustomizer).init(fillContext.getFiller(), getDataset()); } } renderer = SpiderChartRendererEvaluator.evaluateRenderable( fillContext.getFiller().getJasperReportsContext(), element, spiderChartSharedBean, chartCustomizer, JRChart.RENDER_TYPE_DRAW, SpiderChartRendererEvaluator.FILL_DATASET); }