當前位置: 首頁>>代碼示例>>Java>>正文


Java JasperCompileManager.compileReport方法代碼示例

本文整理匯總了Java中net.sf.jasperreports.engine.JasperCompileManager.compileReport方法的典型用法代碼示例。如果您正苦於以下問題:Java JasperCompileManager.compileReport方法的具體用法?Java JasperCompileManager.compileReport怎麽用?Java JasperCompileManager.compileReport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.sf.jasperreports.engine.JasperCompileManager的用法示例。


在下文中一共展示了JasperCompileManager.compileReport方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generate

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
public void generate(String reportURL,Collection<Articulo> articulos)
{
    try {
        InputStream is = loadReport(reportURL);
        JasperDesign design = JRXmlLoader.load(is);
        JasperReport report = JasperCompileManager.compileReport(design);
        jp = JasperFillManager.fillReport(report,new HashMap(),new JRBeanCollectionDataSource(articulos));

        JasperViewer jasperViewer = new JasperViewer(jp, false);
        jasperViewer.setDefaultCloseOperation(JasperViewer.DISPOSE_ON_CLOSE);
        jasperViewer.setTitle("Etiquetas");
        jasperViewer.setZoomRatio((float) 1.25);
        jasperViewer.setExtendedState(JasperViewer.MAXIMIZED_BOTH);
        jasperViewer.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
        jasperViewer.requestFocus();
        jasperViewer.setVisible(true);
    }catch (Exception e) {
        logger.error("Error al generar etiquetas", e);
    }

}
 
開發者ID:ZooMMX,項目名稱:Omoikane,代碼行數:22,代碼來源:EtiquetaGenerator.java

示例2: loadReport

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
public void loadReport(String reportName, ReportObject reportObject) {

		logging = LoggingEngine.getInstance();
		
		try {
			
			final InputStream inputStream = ShowReport.class
					.getResourceAsStream("/com/coder/hms/reportTemplates/" + reportName + ".jrxml");
			JasperReport report = JasperCompileManager.compileReport(inputStream);

			HashMap<String, Object> parameters = new HashMap<String, Object>();	
			List<ReportObject> list = new ArrayList<ReportObject>();
			list.add(reportObject);
			JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(list);
			JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, beanColDataSource);
			final JRViewer viewer = new JRViewer(jasperPrint);

			setType(Type.POPUP);
			setResizable(false);
			setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
			this.setTitle("Reservation [Report]");
			this.setExtendedState(Frame.MAXIMIZED_BOTH);
			this.setAlwaysOnTop(isAlwaysOnTopSupported());
			this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			getContentPane().setLayout(new BorderLayout());
			this.setIconImage(Toolkit.getDefaultToolkit().
					getImage(LoginWindow.class.getResource(LOGOPATH)));
			this.setResizable(false);
			getContentPane().add(viewer, BorderLayout.CENTER);

		} catch (JRException e) {
			logging.setMessage("JRException report error!");
		}

	}
 
開發者ID:Coder-ACJHP,項目名稱:Hotel-Properties-Management-System,代碼行數:36,代碼來源:ShowReport.java

示例3: compileReport

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
protected void compileReport() throws JRException, IOException
{
	InputStream jrxmlInput = JRLoader.getResourceInputStream(jrxml);
	JasperDesign design;
	try
	{
		design = JRXmlLoader.load(jrxmlInput);
	}
	finally
	{
		jrxmlInput.close();
	}
	
	report = JasperCompileManager.compileReport(design);
	
	fillManager = JasperFillManager.getInstance(jasperReportsContext);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:18,代碼來源:Report.java

示例4: loadDefinitions

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
/**
 * Load the report definitions.
 */
@Override
public void loadDefinitions() {

    jasperReports = new HashMap<String, JasperReport>();

    for (Reporting report : ReportingDao.getReportingAsList()) {
        File reportFile = getReportPath(report);
        if (reportFile != null && reportFile.exists()) {
            try {
                JasperDesign jasperDesign = JRXmlLoader.load(reportFile);
                JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                jasperReports.put(report.template, jasperReport);
                if (log.isDebugEnabled()) {
                    log.debug("the jasper report " + report.template + " has been loaded");
                }
            } catch (Exception e) {
                log.error("Error while loading the report " + report.template, e.getMessage());
            }

        } else {
            log.error("Jasper report " + report.template + " not found !");
        }
    }

}
 
開發者ID:theAgileFactory,項目名稱:maf-desktop-app,代碼行數:29,代碼來源:ReportingUtilsImpl.java

示例5: main

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
        InputStream inputStream = new FileInputStream (".\\src\\reports\\test_jasper.jrxml");
       
        DataBeanMaker dataBeanMaker = new DataBeanMaker();
        ArrayList<DataBean> dataBeanList = dataBeanMaker.getDataBeanList(null);
       
        JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(dataBeanList);
       
        Map parameters = new HashMap();
       
JasperDesign jasperDesign = JRXmlLoader.load(inputStream);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, beanColDataSource);
//JasperExportManager.exportReportToPdfFile(jasperPrint, "c:/test_jasper.pdf");
    JRViewer jv=new JRViewer(jasperPrint);
JFrame jf = new JFrame();
    jf.getContentPane().add(jv);
    jf.validate();
    jf.setVisible(true);
    jf.setSize(new Dimension(1000,800));
    jf.setLocation(300,100);
    jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
 
開發者ID:devang29,項目名稱:FACE-RECOGNITION-BASED-ATTENDANCE-MANAGEMENT-SYSTEM,代碼行數:25,代碼來源:Report.java

示例6: getJasperReport

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
/**
 * @return
 * @throws JazzOMRException
 * @throws JRException
 */
protected JasperReport getJasperReport() throws JazzOMRException {
	InputStream jasperJRXML = this.getClass().getResourceAsStream("/reports/ExamReport.jrxml");
	
	
	JasperReport jasperReport;
	try {
	
		jasperReport = JasperCompileManager.compileReport(jasperJRXML);

		//jasperReport = (JasperReport) JRLoader.loadObject(jasperReport);
	} catch (JRException e) {
		throw new JazzOMRParseException("Erro ao tentar carregar objeto de relatorio!", e);
	}
	return jasperReport;
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:21,代碼來源:OMRModelTest.java

示例7: compileReport

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
public JasperReport compileReport( final File sourcePath, final File outputPath,
		String reportName) throws Throwable
{
	String name = reportName;
	if (!name.contains(".jasper"))
	{
		name = name+".jasper";
	}
	JasperReport jasperReport = null;
	JasperDesign jasperDesign = getDesignFile(sourcePath, reportName);
	File outputReport = new File(outputPath.getAbsolutePath() + "/" + name);
	jasperReport = JasperCompileManager.compileReport(jasperDesign);
	JRSaver.saveObject(jasperReport, outputReport);
	logger.warn("Saving compiled report : " + outputReport.getName());

	// Compile sub reports
	JRElementsVisitor.visitReport(jasperReport, createVisitor(sourcePath, outputPath));

	if (subReportException != null)
		throw new RuntimeException(subReportException);
	return jasperReport;
}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:23,代碼來源:JasperReportCompiler.java

示例8: getJRReportTemplate

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
public static JRReportTemplate getJRReportTemplate(String jrxmlTemplate) throws JRException, IOException {

		InputStream isTemplate = new ByteArrayInputStream(jrxmlTemplate.getBytes(StandardCharsets.UTF_8));
		JRReportTemplate reportTemplate = (JRReportTemplate) JasperCompileManager.compileReport(isTemplate);

		if (isTemplate != null) {
			isTemplate.close();
		}

		return reportTemplate;
	}
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:12,代碼來源:JRReportTemplate.java

示例9: prepareReport

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
public static JasperPrint prepareReport(String reportpath) throws Exception {
    HashMap<String, Object> params = new HashMap<>();
    File f = new File("reports");
    String SUBREPORT_DIR = f.getAbsolutePath() + "\\";
    params.put("SUBREPORT_DIR", SUBREPORT_DIR);
    JasperReport jr = JasperCompileManager.compileReport(reportpath);
    return JasperFillManager.fillReport(jr, params, con);
}
 
開發者ID:isu3ru,項目名稱:java-swing-template,代碼行數:9,代碼來源:ReportsModel.java

示例10: imprimirClientesActivos

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
@Action(semantics = SemanticsOf.SAFE)
   @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
   @MemberOrder(sequence = "3")
public Blob imprimirClientesActivos() throws JRException, IOException {
	
	ClientesActivosDataSource datasource = new ClientesActivosDataSource();
	
	for (Cliente cli : clientesRepository.listarActivos()){
	
		ClientesActivosReporte reporteClientesActivos=new ClientesActivosReporte();
		
		reporteClientesActivos.setClienteNombre(cli.getClienteNombre());
		reporteClientesActivos.setClienteApellido(cli.getClienteApellido());
		reporteClientesActivos.setClienteDni(cli.getClienteDni());
		reporteClientesActivos.setClienteTipoDocumento(cli.getClienteTipoDocumento().toString());
		reporteClientesActivos.setPersonaMail(cli.getPersonaMail());
		reporteClientesActivos.setPersonaTelefono(cli.getPersonaTelefono());
		
		datasource.addParticipante(reporteClientesActivos);
	}
	String jrxml = "ClientesActivos.jrxml";
	String nombreArchivo = "Listado Clientes Activos ";
	
	InputStream input = ReporteRepository.class.getResourceAsStream(jrxml);
	JasperDesign jd = JRXmlLoader.load(input);
	
	JasperReport reporte = JasperCompileManager.compileReport(jd);
	Map<String, Object> parametros = new HashMap<String, Object>();
	JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, parametros, datasource);
	
	return ReporteRepository.imprimirReporteLista(jasperPrint, jrxml, nombreArchivo);
	
}
 
開發者ID:leandrogonqn,項目名稱:Proyecto2017Seguros,代碼行數:34,代碼來源:ReporteMenu.java

示例11: imprimirFacturacionAnualPorCompania

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
@Action(semantics = SemanticsOf.SAFE)
   @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
   @MemberOrder(sequence = "5")
public Blob imprimirFacturacionAnualPorCompania() throws JRException, IOException {
   	
   	FacturacionDataSource datasource = new FacturacionDataSource();
	
	for (FacturacionCompaniasViewModel fac : facturacionRepository.facturacion()){
	
		FacturacionReporte facturacionCompania =new FacturacionReporte();
		
		facturacionCompania.setCompania(fac.getCompania().getCompaniaNombre().toString());
		facturacionCompania.setPrimaTotal(fac.getPrimaTotal());
		
		datasource.addParticipante(facturacionCompania);
	}
	String jrxml = "FacturacionCompanias.jrxml";
	String nombreArchivo = "Facturacion companias ";
	
	InputStream input = ReporteRepository.class.getResourceAsStream(jrxml);
	JasperDesign jd = JRXmlLoader.load(input);
	
	JasperReport reporte = JasperCompileManager.compileReport(jd);
	Map<String, Object> parametros = new HashMap<String, Object>();
	JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, parametros, datasource);
	
	return ReporteRepository.imprimirReporteLista(jasperPrint, jrxml, nombreArchivo);
   	
   }
 
開發者ID:leandrogonqn,項目名稱:Proyecto2017Seguros,代碼行數:30,代碼來源:ReporteMenu.java

示例12: imprimirPolizasPorCompania

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
@Action(semantics = SemanticsOf.SAFE)
   @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
   @MemberOrder(sequence = "6")
public Blob imprimirPolizasPorCompania(
           @ParameterLayout(named="Compania: ") final Compania companiaSeleccionada) throws JRException, IOException {
   	
   	PolizaPorCompaniaDataSource datasource = new PolizaPorCompaniaDataSource();
	
	for (Poliza pol : polizaRepository.buscarPorCompania(companiaSeleccionada)){
	
		PolizaPorCompaniaReporte reportePolizaPorCompania =new PolizaPorCompaniaReporte();
		
		reportePolizaPorCompania.setPolizasCliente(pol.getPolizaCliente().toString());
		reportePolizaPorCompania.setPolizasCompania(pol.getPolizaCompania().getCompaniaNombre());
		reportePolizaPorCompania.setPolizaNumero(pol.getPolizaNumero());
		reportePolizaPorCompania.setPolizaFechaVigencia(pol.getPolizaFechaVigencia());
		reportePolizaPorCompania.setPolizaFechaVencimiento(pol.getPolizaFechaVencimiento());
		reportePolizaPorCompania.setPolizaFechaEmision(pol.getPolizaFechaEmision());
		reportePolizaPorCompania.setPolizaImporteTotal(pol.getPolizaImporteTotal());
		
		
		datasource.addParticipante(reportePolizaPorCompania);
	}
	String jrxml = "PolizasPorCompania.jrxml";
	String nombreArchivo = "Listado de polizas por compania"+" "+companiaSeleccionada.getCompaniaNombre()+" ";
	
	InputStream input = ReporteRepository.class.getResourceAsStream(jrxml);
	JasperDesign jd = JRXmlLoader.load(input);
	
	JasperReport reporte = JasperCompileManager.compileReport(jd);
	Map<String, Object> parametros = new HashMap<String, Object>();
	parametros.put("compania", companiaSeleccionada.getCompaniaNombre());
	JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, parametros, datasource);
	
	return ReporteRepository.imprimirReporteLista(jasperPrint, jrxml, nombreArchivo);
   }
 
開發者ID:leandrogonqn,項目名稱:Proyecto2017Seguros,代碼行數:37,代碼來源:ReporteMenu.java

示例13: raporti

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
private void raporti(){
    Thread t = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
                JasperReport jreport = JasperCompileManager.compileReport(raporti);
                JasperPrint jprint = JasperFillManager.fillReport(jreport, new HashedMap(), conn);
                JasperViewer.viewReport(jprint, false);
                conn.close();
            }catch (Exception ex){ex.printStackTrace();}
        }
    });
    btnRaport.setOnAction(e -> t.start());
}
 
開發者ID:urankajtazaj,項目名稱:Automekanik,代碼行數:16,代碼來源:ShikoKonsumatoret.java

示例14: jMenuItem6ActionPerformed

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
    // TODO add your handling code here:
     try {
        conectar cc= new conectar();
        
        JasperReport reportes=JasperCompileManager.compileReport("Estudiante.jrxml");
        JasperPrint print=JasperFillManager.fillReport(reportes, null, cc.conexion());
        JasperViewer.viewReport(print);
        
    } catch (Exception e) {
        System.out.printf(e.getMessage());
    }
}
 
開發者ID:ExsonCardona,項目名稱:ESIPC,代碼行數:14,代碼來源:Menu.java

示例15: jMenuItem13ActionPerformed

import net.sf.jasperreports.engine.JasperCompileManager; //導入方法依賴的package包/類
private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
    // TODO add your handling code here:
    try {
        conectar cc= new conectar();
        
        JasperReport reportes=JasperCompileManager.compileReport("Factura.jrxml");
        JasperPrint print=JasperFillManager.fillReport(reportes, null, cc.conexion());
        JasperViewer.viewReport(print);
        
    } catch (Exception e) {
        System.out.printf(e.getMessage());
    }
  
}
 
開發者ID:ExsonCardona,項目名稱:ESIPC,代碼行數:15,代碼來源:Menu.java


注:本文中的net.sf.jasperreports.engine.JasperCompileManager.compileReport方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。