Java 类net.sf.jasperreports.engine.design.JRCompilationSourceCode 实例源码

项目:PDFReporter-Studio    文件:JasperReportCompiler.java   
@Override
public void processProblems() {
    for (int i = 0; i < units.length; i++) {
        JRCompilationSourceCode sourceCode = units[i].getCompilationSource();
        IProblem[] problems = unitResults[i].getProblems();
        if (problems != null) {
            for (int j = 0; j < problems.length; j++) {
                IProblem problem = problems[j];
                int line = problem.getSourceLineNumber();
                JRExpression expression = sourceCode.getExpressionAtLine(line);
                if (expression == null)
                    errorHandler.addMarker(problem, null);
                else if (!addExpressionError(expression))
                    errorHandler.addMarker(problem, digester.getLocation(expression), expression);
            }
        }
    }
}
项目:jasperreports    文件:JavaScriptCompilerBase.java   
@Override
protected JRCompilationSourceCode generateSourceCode(
        JRSourceCompileTask sourceTask) throws JRException
{
    //no source code
    return null;
}
项目:PDFReporter-Studio    文件:JEvalCompiler.java   
@Override
protected JRCompilationSourceCode generateSourceCode(
        JRSourceCompileTask sourceTask) throws JRException {
    // TODO (12.04.2013, Donat, Open Software Solutions): Create a evaluator instance per call and serialize it
    JEvalExpressionEvaluator evaluator = new JEvalExpressionEvaluator();
    evaluator.initializeWithDefaults(sourceTask);
    evaluator.parseExpressions(sourceTask);
    evaluators.put(sourceTask.getUnitName(), evaluator);
    return new JRDefaultCompilationSourceCode(sourceTask.getUnitName(),null);
}
项目:PDFReporter-Studio    文件:JRJdtCompiler.java   
protected JRCompilationUnit recreateCompileUnit(JRCompilationUnit compilationUnit, Set<Method> missingMethods) {
    String unitName = compilationUnit.getName();

    JRSourceCompileTask sourceTask = compilationUnit.getCompileTask();
    JRCompilationSourceCode sourceCode = JRClassGenerator.modifySource(sourceTask, missingMethods, compilationUnit.getSourceCode());

    File sourceFile = compilationUnit.getSourceFile();
    File saveSourceDir = sourceFile == null ? null : sourceFile.getParentFile();
    sourceFile = getSourceFile(saveSourceDir, unitName, sourceCode);

    return new JRCompilationUnit(unitName, sourceCode, sourceFile, compilationUnit.getExpressions(), sourceTask);
}
项目:ireport-fork    文件:ExtendedJRJdtCompiler.java   
public void acceptResult(CompilationResult result)
{
    super.acceptResult(result);
    if (result.hasErrors())
    {
        String className = String.valueOf(result.getCompilationUnit().getMainTypeName());

        JRCompilationUnit unit = null;
        for (int classIdx = 0; classIdx < units.length; ++classIdx)
        {
            if (className.equals(units[classIdx].getName()))
            {
                unit = units[classIdx];
                break;
            }
        }

        IProblem[] errors = result.getErrors();
        for (int i = 0; i < errors.length; i++)
        {
            IProblem problem = errors[i];
            int line = problem.getSourceLineNumber();
            JRCompilationSourceCode sourceCode = unit.getCompilationSource();
            JRExpression expression = sourceCode.getExpressionAtLine(line);
            if (expression == null)
            {
                getErrorHandler().addMarker( problem, null);
            }
            else if (addExpressionError(expression, problem))
            {
                SourceLocation location = getDigester().getLocation(expression);
                getErrorHandler().addMarker(problem, expression, location);
            }
        }
    }
}
项目:jasperreports    文件:JRBshCompiler.java   
@Override
protected JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask) throws JRException
{
    return new JRDefaultCompilationSourceCode(JRBshGenerator.generateScript(sourceTask), null);
}
项目:jasperreports    文件:JRGroovyCompiler.java   
@Override
protected JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask) throws JRException
{
    return new JRDefaultCompilationSourceCode(JRGroovyGenerator.generateClass(sourceTask), null);
}
项目:PDFReporter-Studio    文件:JRJdtCompiler.java   
protected JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask) throws JRException {
    return JRClassGenerator.generateClass(sourceTask);
}
项目:jasperreports-scala    文件:JRScalaCompiler.java   
/**
 * @see net.sf.jasperreports.engine.design.JRAbstractCompiler#generateSourceCode(net.sf.jasperreports.engine.design.JRSourceCompileTask)
 */
@Override
protected JRCompilationSourceCode generateSourceCode(
        JRSourceCompileTask sourceTask) throws JRException {
    return new JRDefaultCompilationSourceCode(JRScalaGenerator.generateClass(sourceTask), null);
}