Package net.sf.jasperreports.engine

Examples of net.sf.jasperreports.engine.JasperReport


  }

  private static JRFillDataset createFillDataset(JRDatasetRun datasetRun,
      JRFillObjectFactory factory) throws JRException
  {
    JasperReport jasperReport = factory.getFiller().getJasperReport();
    JRDataset reportDataset = JRReportUtils.findSubdataset(datasetRun, jasperReport);
    JRFillDataset fillDataset = new JRFillDataset(factory.getFiller(), reportDataset, factory);
    fillDataset.createCalculator(jasperReport);
    return fillDataset;
  }
View Full Code Here


        try
        {
          System.out.print("File : " + srcFileName + " ... ");

          JasperReport jasperReport = (JasperReport)JRLoader.loadObject(srcFileName);
         
          JRXmlWriter.writeReport(jasperReport, destFileName, "UTF-8");
         
          System.out.println("OK.");
        }
View Full Code Here

        Integer crosstabId = expressionCollector.getCrosstabId(crosstab);
        reportCompileData.setCrosstabCompileData(crosstabId.intValue(), units[datasets.size() + it.nextIndex()].getCompileData());
      }

      // creating the report
      JasperReport jasperReport =
        new JasperReport(
          jasperDesign,
          getCompilerClass(),
          reportCompileData,
          expressionCollector,
          nameSuffix
View Full Code Here

    }
  }

  protected FillTableSubreport createFillTableSubreport() throws JRException
  {
    JasperReport parentReport = fillContext.getFiller().getJasperReport();
    JRDataset reportSubdataset = JRReportUtils.findSubdataset(table.getDatasetRun(),
        parentReport);
   
    Map<JRExpression, BuiltinExpressionEvaluator> builtinEvaluators =
      new HashMap<JRExpression, BuiltinExpressionEvaluator>();
   
    String tableReportName = JRAbstractCompiler.getUnitName(parentReport, reportSubdataset);
   
    // clone the table subdataset in order to have a different instance for other
    // elements that might be using it.
    // we're cloning the subdataset via an object factory in order to preserve
    // the relationship between objects (e.g. variables and groups) in the cloned
    // dataset
    JRDataset tableSubdataset = DatasetCloneObjectFactory.cloneDataset(reportSubdataset);
    TableReportDataset reportDataset = new TableReportDataset(tableSubdataset, tableReportName);
    TableReport tableReport = new TableReport(fillContext, reportDataset, fillColumns, builtinEvaluators);
   
    if (log.isDebugEnabled())
    {
      String tableReportXml = JRXmlWriter.writeReport(tableReport, "UTF-8");
      log.debug("Generated table report:\n" + tableReportXml);
    }
   
    JRReportCompileData tableReportCompileData = createTableReportCompileData(
        parentReport, reportSubdataset);
   
    JasperReport compiledTableReport = new JasperReport(tableReport,
        parentReport.getCompilerClass(),
        tableReportCompileData,
        new TableReportBaseObjectFactory(reportDataset),
        "");// no suffix as already included in the report name
   
View Full Code Here

    }
  }

  protected JasperReport evaluateReport(byte evaluation) throws JRException
  {
    JasperReport report = null;
   
    JRExpression expression = getExpression();
    Object source = evaluateExpression(expression, evaluation);
    if (source != null) // FIXME put some default broken image like in browsers
    {
View Full Code Here

    fileResolver.setResolveAbsolutePath(true);
   
    parameters.put(JRParameter.REPORT_FILE_RESOLVER, fileResolver);
   
   
    JasperReport jasperReport = (JasperReport)JRLoader.loadObject("build/reports/TableOfContentsReport.jasper");

    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, getDemoHsqldbConnection());
   
    jasperPrint = moveTableOfContents(jasperPrint);
View Full Code Here

         
    JasperPrint jasperPrint = null;

    try
    {
      JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());
     
      jasperPrint =
        JasperFillManager.fillReport(
          jasperReport,
          parameters,
View Full Code Here

  public void fill() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/AlterDesignReport.jasper");
    System.err.println(" : " + sourceFile.getAbsolutePath());
    JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);
   
    JRRectangle rectangle = (JRRectangle)jasperReport.getTitle().getElementByKey("first.rectangle");
    rectangle.setForecolor(new Color((int)(16000000 * Math.random())));
    rectangle.setBackcolor(new Color((int)(16000000 * Math.random())));

    rectangle = (JRRectangle)jasperReport.getTitle().getElementByKey("second.rectangle");
    rectangle.setForecolor(new Color((int)(16000000 * Math.random())));
    rectangle.setBackcolor(new Color((int)(16000000 * Math.random())));

    rectangle = (JRRectangle)jasperReport.getTitle().getElementByKey("third.rectangle");
    rectangle.setForecolor(new Color((int)(16000000 * Math.random())));
    rectangle.setBackcolor(new Color((int)(16000000 * Math.random())));

    JRStyle style = jasperReport.getStyles()[0];
    style.setFontSize(16);
    style.setItalic(true);

    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, (JRDataSource)null);
   
    File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint");
    JRSaver.saveObject(jasperPrint, destFile);
   
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
  }
View Full Code Here

    {
      File reportFile = new File(context.getRealPath("/reports/WebappReport.jasper"));
      if (!reportFile.exists())
        throw new JRRuntimeException("File WebappReport.jasper not found. The report design must be compiled first.");

      JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());
   
      Map parameters = new HashMap();
      parameters.put("ReportTitle", "Address Report");
      parameters.put("BaseDir", reportFile.getParentFile());
           
View Full Code Here

    {
      File reportFile = new File(context.getRealPath("/reports/WebappReport.jasper"));
      if (!reportFile.exists())
        throw new JRRuntimeException("File WebappReport.jasper not found. The report design must be compiled first.");

      JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());
   
      Map parameters = new HashMap();
      parameters.put("ReportTitle", "Address Report");
      parameters.put("BaseDir", reportFile.getParentFile());
           
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.JasperReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.