Java 类net.sf.jasperreports.engine.JREmptyDataSource 实例源码

项目:jasperreports    文件:VirtualizerApp.java   
private static JasperPrint fillReport(JRFileVirtualizer virtualizer) throws JRException
{
    long start = System.currentTimeMillis();

    // Virtualization works only with in memory JasperPrint objects.
    // All the operations will first fill the report and then export
    // the filled object.

    // creating the data source
    JRDataSource dataSource = new JREmptyDataSource(1000);

    // Preparing parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);

    // filling the report
    JasperPrint jasperPrint = JasperFillManager.fillReport("build/reports/VirtualizerReport.jasper", parameters, dataSource);

    virtualizer.setReadOnly(true);

    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
    return jasperPrint;
}
项目:bisis-v4    文件:User.java   
private JPanel getPinCard(){
  try {
    Map<String, Object> params = new HashMap<String, Object>(3);
    params.put("library", BisisApp.getINIFile().getString("pincode", "library")); //$NON-NLS-1$
    params.put("userid", mmbrship.getUserID()); //$NON-NLS-1$
    params.put("name", userData.getFirstName() + " " + userData.getLastName());//$NON-NLS-1$
    params.put("pincode", userData.getPinCode()); //$NON-NLS-1$


    JasperPrint jp = JasperFillManager.fillReport(User.class.getResource(
          "/com/gint/app/bisis4/client/circ/jaspers/pincode.jasper").openStream(),  //$NON-NLS-1$
          params, new JREmptyDataSource());
    JRViewer jr = new JRViewer(jp);
    return jr;
  } catch (Exception e) {
    e.printStackTrace();
    log.error(e);
    return null;
  }
}
项目:jasperreports    文件:XChartApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    Map<String, Object> parameters = new HashMap<String, Object>();
    try
    {
        JRCsvDataSource xyds = new JRCsvDataSource(JRLoader.getLocationInputStream("data/xyDatasource.csv"), "UTF-8");
        xyds.setRecordDelimiter("\r\n");
        xyds.setUseFirstRowAsHeader(true);
        parameters.put("xyDatasource", xyds);
    }
    catch (Exception e)
    {
        throw new JRException(e);
    }
    JasperFillManager.fillReportToFile("build/reports/XYChart.jasper", new HashMap<String, Object>(parameters), new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:BatchExportApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile(
        "build/reports/Report1.jasper",
        null, 
        new JREmptyDataSource(2)
        );
    JasperFillManager.fillReportToFile(
        "build/reports/Report2.jasper",
        null, 
        new JREmptyDataSource(2)
        );
    JasperFillManager.fillReportToFile(
        "build/reports/Report3.jasper",
        null, 
        new JREmptyDataSource(2)
        );
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:I18nApp.java   
/**
     *
     */
    public void fill() throws JRException
    {
        long start = System.currentTimeMillis();
        Locale locale = chooseLocale();
        if (locale != null)
        {
//                  Object[] aw = new Object[] {new Double(1000000.45), "$", "Ferrari", new Integer(20),new Integer(88)};
            Map<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("number", new Double(1234567 + Math.random()));
//                  parameters.put("array", aw);
            parameters.put(JRParameter.REPORT_LOCALE, locale);
            JasperFillManager.fillReportToFile("build/reports/I18nReport.jasper", parameters, new JREmptyDataSource());
            System.err.println("Filling time : " + (System.currentTimeMillis() - start));
        }
    }
项目:karaku    文件:KarakuBaseReportAdvanced.java   
/**
 * @deprecated user
 *             {@link #generateReport(boolean, boolean, Map, String, Map, List)}
 */
@Deprecated
@Override
public void generateReport(boolean dataSource, Map<String, Object> params,
        String type, Map<String, Object> listFilters, List<String> listOrder)
        throws ReportException {

    if (!dataSource) {
        this.exportReport.exportAvancedReport(
                this.builReport(params, listFilters, listOrder),
                new JREmptyDataSource(), params, type);
    } else {
        this.exportReport.exportAvancedReport(
                this.builReport(params, listFilters, listOrder),
                this.getDataSourceCustom(listFilters, listOrder), params,
                type);
    }

}
项目:dynamicreports-jasper    文件:RowNumberColumnsReport.java   
private void build() {
    try {
        report()
          .setTemplate(Templates.reportTemplate)
          .setPageColumnsPerPage(2)
          .setPageColumnSpace(10)
          .columns(
            col.reportRowNumberColumn("Report row"),
            col.pageRowNumberColumn("Page row"),
            col.columnRowNumberColumn("Page column row"))
          .title(Templates.createTitleComponent("RowNumberColumns"))
          .pageFooter(Templates.footerComponent)
          .setDataSource(new JREmptyDataSource(150))
          .show();
    } catch (DRException e) {
        e.printStackTrace();
    }
}
项目:4mila-1.0    文件:GenericTableDynamicReport.java   
protected JasperPrint build() throws ProcessingException {
  if (content == null) {
    throw new IllegalArgumentException("content must be set");
  }
  if (headerFooterTemplatePath == null) {
    throw new IllegalArgumentException("Default Header/Footer Template is missing");
  }
  try {
    String reportDir = IOUtility.getFilePath(headerFooterTemplatePath);
    TemplateStylesBuilder styles = DynamicReports.stl.loadStyles(reportDir + FMilaUtility.FILE_SEPARATOR + "styles.jrtx");
    tableLeft = styles.getStyle("table.left");
    tableRight = styles.getStyle("table.right");
    int size = content.size();

    SubreportBuilder tableSubreport = cmp.subreport(new TableSubreportExpression()).setDataSource(new TableSubreportDataSourceExpression(content));

    JasperReportBuilder report = DynamicReports.report().setTemplate(DynamicTemplate.reportTemplate).setParameters(parameters).detail(tableSubreport, cmp.verticalGap(20)).setDataSource(new JREmptyDataSource(size));

    // Header Footer
    InputStream headerFooterTemplate = new FileInputStream(headerFooterTemplatePath);
    report.setTemplateDesign(headerFooterTemplate);

    return report.toJasperPrint();
  }
  catch (DRException | FileNotFoundException e) {
    throw new ProcessingException("Failed creating Report", e);
  }
}
项目:bisis-v4    文件:ReportResults.java   
private JPanel getPrint(){

    try{
        JasperPrint jp = JasperFillManager.fillReport(
                  User.class.getResource(
                    "/com/gint/app/bisis4/client/circ/jaspers/empty.jasper").openStream(), 
                    null, new JREmptyDataSource());
        jr = new JRViewer(jp);
        return jr;
    }catch (Exception e){
        e.printStackTrace();
        return null;
    }
}
项目:bisis-v4    文件:Picturebooks.java   
public static JasperPrint setPrint(Date start, Date end)
        throws IOException {

    Map<String, Object> params = new HashMap<String, Object>(5);

    if (start == null) {
        end = Utils.setMaxDate(end);
        start = Utils.setMinDate(end);
    } else if (end == null) {
        end = Utils.setMaxDate(start);
        start = Utils.setMinDate(start);
    } else {
        start = Utils.setMinDate(start);
        end = Utils.setMaxDate(end);
    }

    params.put("begdate", Utils.toLocaleDate(start));
    params.put("enddate", Utils.toLocaleDate(end));

    PictureBooksReportCommand pictureBooks = new PictureBooksReportCommand(start, end);
    pictureBooks = (PictureBooksReportCommand)Cirkulacija.getApp().getService().executeCommand(pictureBooks);
    List l= pictureBooks.getList();
    Object[] row = (Object[])l.get(0);
    params.put("users", ((Long)row[0]).toString());
    params.put("lend", ((Long)row[1]).toString());
    params.put("return", ((Long)row[2]).toString());

    try {

        JasperPrint jp = JasperFillManager.fillReport(Picturebooks.class.getResource(
                                        "/com/gint/app/bisis4/client/circ/jaspers/picturebooks.jasper")
                                .openStream(), params, new JREmptyDataSource());
        return jp;
    } catch (JRException e) {
        e.printStackTrace();
        return null;
    }
}
项目:jasperreports    文件:UnicodeApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/UnicodeReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:Barcode4JApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/Barcode4JReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:PdfEncryptApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/PdfEncryptReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:FormsApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/FormsReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:StyledTextApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/StyledTextReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:MapApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/MapReport.jasper", null, new JREmptyDataSource(5));
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:TabularApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/TabularReport.jasper", null, new JREmptyDataSource(50));
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:Java5App.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    Map<String,Object> parameters = new HashMap<String,Object>();
    parameters.put("greeting", Greeting.bye);

    JasperFillManager.fillReportToFile("build/reports/Java5Report.jasper", parameters, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:ImagesApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/ImagesReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:JavaScriptApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/JavaScriptReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:BarbecueApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/BarbecueReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:XChartApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/XChartReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:StretchApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/StretchReport.jasper", null, new JREmptyDataSource(20));
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:ParagraphsApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/ParagraphsReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:GroovyApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/GroovyReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:TableApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("TableDataSource", new JREmptyDataSource(50));
    JasperFillManager.fillReportToFile("build/reports/TableReport.jasper", params);
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:JFreeChartApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/JFreeChartReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:RotationApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/RotationReport.jasper", null, new JREmptyDataSource(10));
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:XlsFormulaApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/XlsFormulaReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:HtmlComponentApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/HtmlComponentReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:I18nApp.java   
/**
 *
 */
public void fillDefault() throws JRException
{
    long start = System.currentTimeMillis();
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("number", new Double(1234567 + Math.random()));
    JasperFillManager.fillReportToFile("build/reports/I18nReport.jasper", parameters, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:BeanShellApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/BeanShellReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:LandscapeApp.java   
/**
 *
 */
public void fill() throws JRException
{
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/LandscapeReport.jasper", null, new JREmptyDataSource());
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
项目:jasperreports    文件:EmptyDataAdapterService.java   
@Override
public void contributeParameters(Map<String, Object> parameters) throws JRException
{
    EmptyDataAdapter emptyDataAdapter = getEmptyDataAdapter();
    if (emptyDataAdapter != null)
    {
        parameters.put(JRParameter.REPORT_DATA_SOURCE, new JREmptyDataSource(emptyDataAdapter.getRecordCount()));
    }
}
项目:JasperViewerFx    文件:JRViewerMain.java   
@Override
public void start(Stage primaryStage) throws Exception {
    JasperPrint jasperPrint=null;
    try {
        jasperPrint = JasperFillManager.fillReport("target/classes/TestReport.jasper", new HashMap(),  new JREmptyDataSource());
    } catch (JRException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    };  
    JRViewerFx viewer = new JRViewerFx(jasperPrint, JRViewerFxMode.REPORT_VIEW,primaryStage);
    viewer.start(primaryStage);

}
项目:karaku    文件:KarakuBaseReportAdvanced.java   
@Override
public void generateReport(boolean dataSource, boolean isClass,
        Map<String, Object> params, String type,
        Map<String, Object> listFilters, List<String> listOrder)
        throws ReportException {

    // Si posee más de un dataSource
    if (!dataSource) {
        this.exportReport.exportAvancedReport(
                this.builReport(params, listFilters, listOrder),
                new JREmptyDataSource(), params, type);
    } else {
        // Si la lista a ser visualizada en el reporte esta representada por
        // una clase
        if (isClass) {
            this.exportReport.exportAvancedReport(
                    this.builReport(params, listFilters, listOrder),
                    this.getDataSource(listFilters, listOrder), params,
                    type);
        } else {
            this.exportReport.exportAvancedReport(
                    this.builReport(params, listFilters, listOrder),
                    this.getDataSourceCustom(listFilters, listOrder),
                    params, type);
        }

    }

}
项目:jasperreports-scala    文件:ScalaApp.java   
/**
 *
 */
public void fill() throws JRException {
    long start = System.currentTimeMillis();
    JasperFillManager.fillReportToFile("build/reports/ScalaReport.jasper",
            null, new JREmptyDataSource());
    System.err.println("Filling time : "
            + (System.currentTimeMillis() - start));
}
项目:SIRME    文件:GenerateReport.java   
public void rptCSV(Work work, OutputStream outputStream) {
    Map<String,Object> parameters = new HashMap<String,Object>();
    parameters.put("CLI_NAM", work.getCustomer().getNameCustomer());
    parameters.put("CLI_DAT", work.getDate() );
    parameters.put("CLI_ALB", work.getAlbaran() );
    parameters.put("CLI_ADD", work.getCustomer().getMainAddress() );
    parameters.put("CLI_TEC", work.getTeam().getNameTec() );
    parameters.put("PATH", "C:\\wsfirext\\Firext_local\\WebContent\\WEB-INF\\reports\\" );
    parameters.put("TITULO", "CERTIFICADO DE REVISION DE EXTINTORES" );

 JasperReport jasperReport;
    JasperPrint jasperPrint;
    try {
      //jasperReport = JasperCompileManager.compileReport( "C:\\wsfirext\\Firext_local\\WebContent\\WEB-INF\\reports\\test.jrxml" );
       jasperReport = (JasperReport) JRLoader.loadObject( new File("C:\\wsfirext\\Firext_local\\WebContent\\WEB-INF\\reports\\extintores.jasper") );
      jasperPrint = JasperFillManager.fillReport( jasperReport, parameters, new JREmptyDataSource() );

      if ( outputStream != null )
         JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
      else
         JasperExportManager.exportReportToPdfFile( jasperPrint, "C:\\wsfirext\\Firext_local\\WebContent\\WEB-INF\\reports\\" + System.currentTimeMillis() + ".pdf" );

      System.out.println("Done!");
    }
    catch (JRException e) {
      e.printStackTrace();
    }

}
项目:oscar-old    文件:PrintBarcodeAction.java   
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
        //patient
        String classpath = (String)request.getSession().getServletContext().getAttribute("org.apache.catalina.jsp_classpath");
        if (classpath==null) classpath = (String)request.getSession().getServletContext().getAttribute("com.ibm.websphere.servlet.application.classpath");

        System.setProperty("jasper.reports.compile.class.path", classpath);

        HashMap<String,String> parameters = new HashMap<String,String>();
        parameters.put("demo", request.getParameter("demographic_no"));
        ServletOutputStream sos = null;
        InputStream ins = null;
        try {

            ins = getClass().getResourceAsStream("/oscar/oscarDemographic/barcode.jrxml");
//            ins = context.getResourceAsStream("/label.xml");
//            ins = new FileInputStream(System.getProperty("user.home") + "/label.xml");
        }
        catch (Exception ex1) {MiscUtils.getLogger().error("Error", ex1);
        }

        try {
            sos = response.getOutputStream();
        }
        catch (IOException ex) {MiscUtils.getLogger().error("Error", ex);
        }

        response.setHeader("Content-disposition", getHeader(response).toString());
        OscarDocumentCreator osc = new OscarDocumentCreator();
        try {
//            osc.fillDocumentStream( parameters, sos, "pdf", ins, DbConnectionFilter.getThreadLocalDbConnection());
            osc.fillDocumentStream( parameters, sos, "pdf", ins, new JREmptyDataSource());
        }
        catch (Exception e) {
            MiscUtils.getLogger().error("Error", e);
        }

        return actionMapping.findForward(this.target);
    }
项目:dynamicreports-jasper    文件:TemplateDesign5Test.java   
@Override
protected void configureReport(JasperReportBuilder rb) throws DRException {
    InputStream is = TemplateDesign5Test.class.getResourceAsStream("templatedesign5.jrxml");
    JasperReportBuilder report = report();
    report.setTemplateDesign(is);
    report.addParameter("parameter", "parametertest");
    report.setDataSource(new JREmptyDataSource(1));
    report.setPageFormat(575, 842, PageOrientation.PORTRAIT);

    rb.title(cmp.subreport(report))
      .columns(
            column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Integer.class));
}