当前位置: 首页>>代码示例>>Java>>正文


Java JRXmlLoader.load方法代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.xml.JRXmlLoader.load方法的典型用法代码示例。如果您正苦于以下问题:Java JRXmlLoader.load方法的具体用法?Java JRXmlLoader.load怎么用?Java JRXmlLoader.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jasperreports.engine.xml.JRXmlLoader的用法示例。


在下文中一共展示了JRXmlLoader.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generate

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的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: compileReport

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
public JasperReport compileReport(String jrxmlFileName) throws JRException, IOException
{
	JasperReport jasperReport = null;
	
	InputStream jrxmlInput = JRLoader.getResourceInputStream(jrxmlFileName);

	if (jrxmlInput != null)
	{
		JasperDesign design;
		try
		{
			design = JRXmlLoader.load(jrxmlInput);
		}
		finally
		{
			jrxmlInput.close();
		}
		jasperReport = JasperCompileManager.compileReport(design);
	}
	
	return jasperReport;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:AbstractTest.java

示例3: compileReport

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的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: loadJasperDesign

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
public static JasperDesign loadJasperDesign(byte[] template) throws SchemaException{
	    	try	 {
	    	byte[] reportTemplate = Base64.decodeBase64(template);
		 	
		 	InputStream inputStreamJRXML = new ByteArrayInputStream(reportTemplate);
		 	JasperDesign jasperDesign = JRXmlLoader.load(inputStreamJRXML);
//		 	LOGGER.trace("load jasper design : {}", jasperDesign);
		 	return jasperDesign;
	    	} catch (JRException ex){
	    		throw new SchemaException(ex.getMessage(), ex.getCause());
	    	}
	    }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:13,代码来源:ReportTypeUtil.java

示例5: findReports

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
private static void findReports(Map<File, String> aReportMap, File aDirectory) throws JRException {
	Thread.currentThread().setContextClassLoader(JasperUtils.class.getClassLoader());
	if (aDirectory != null && aDirectory.exists() && aDirectory.canRead()) {
		for (File theFile : aDirectory.listFiles()) {
			String theName = theFile.getName();
			if (theName.endsWith(".jrxml") && (!theName.contains("_"))) {
				try {
					JasperDesign theDesign = JRXmlLoader.load(new FileInputStream(theFile));
					String theReportName = theDesign.getName();
					if (StringUtils.isNotEmpty(theReportName)) {
						aReportMap.put(theFile, theReportName);
					}
				} catch (FileNotFoundException e) {
					// This cannot happen
				}

			} else {
				if ((theFile.isDirectory()) && (!".".equals(theName)) && (!"..".equals(theName))) {
					findReports(aReportMap, theFile);
				}
			}
		}
	}
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:25,代码来源:JasperUtils.java

示例6: loadDefinitions

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的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

示例7: main

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的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

示例8: loadJasperDesign

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
/**
 * Code to load a JasperDesign. We should not load a jasperDesign, since we already have one in memory.
 * This code must be replaced at some point. Please note that this code use the SourceTraceDigester digester
 * (not used in the JrxmlLoader. We should merge this code with the one provided by JrxmlLoader.
 */
public static JasperDesign loadJasperDesign(InputStream fileStream, SourceTraceDigester digester) throws JRException
{
        try
        {
                JasperDesign jd = JRXmlLoader.load(fileStream);
                return jd;
        }
        finally
        {
                try
                {
                        fileStream.close();
                }
                catch (IOException e)
                {
                        // ignore
                }
        }
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:25,代码来源:IReportCompiler.java

示例9: resourceWillBeUpdated

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
public void resourceWillBeUpdated(RepositoryFile repositoryFile, RepositoryReportUnit reportUnit, File file) throws Exception {

        try {
            JasperDesign jd = (JasperDesign) JRXmlLoader.load(file);
            if (jd.getQuery() != null &&
                jd.getQuery().getLanguage() != null &&
                jd.getQuery().getLanguage().equalsIgnoreCase("xmla-mdx"))
            {
                JOptionPane.showMessageDialog(Misc.getMainFrame(), "You are trying to upload on JasperServer a report which uses the xmla-mdx query language.\nThis language is not supported by JasperServer and it is outdated.\nYou should use the mdx language instead.", "Unsupported language", JOptionPane.WARNING_MESSAGE);

            }

        } catch (Exception ex)
        {
            ex.printStackTrace();
        }


    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:20,代码来源:JrxmlNotifier.java

示例10: load

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
@Override
public JasperTemplate load(String name) {
    URL url = templateURLs.get(name);
    if (url != null) {
        JasperDesign jasperDesign;
        try {
            jasperDesign = JRXmlLoader.load(url.openStream());
        } catch (Exception e) {
            throw SeedException.wrap(e, JasperErrorCode.ERROR_LOADING_JASPER_REPORT)
                    .put("template", name)
                    .put("url", url.toExternalForm());
        }
        return new JasperTemplate(jasperDesign, url.getFile());
    } else {
        return null;
    }
}
 
开发者ID:seedstack,项目名称:io-addon,代码行数:18,代码来源:JasperStaticTemplateLoader.java

示例11: createJasperPrint

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
/**
 * generate report ByteArrayOutputStream
 *
 * @param jrDataSource data for report
 * @param template       report template
 * @return report ByteArrayOutputStream
 * @throws JRException will occurred generating report
 */
public JasperPrint createJasperPrint(JRDataSource jrDataSource, String template)throws JRException {

    // create a byte array from given report template
    
    byte[] templateBytes = template.getBytes();
    InputStream templateInputStream = new ByteArrayInputStream(templateBytes);
    JasperPrint jasperPrint;
    try {
        // load JasperDesign
        JasperDesign jasperDesign = JRXmlLoader.load(templateInputStream);
        // compiling JasperDesign from JasperCompileManager
        JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
        // generate JasperPrint Object from given JasperReport file and JRDataSource by JasperFillManager
        jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), jrDataSource);
    } catch (JRException e) {
        throw new JRException("JasperPrint creation failed from " + template , e);
    }
    return jasperPrint;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:28,代码来源:JPCreator.java

示例12: renderDocument

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的package包/类
@Override
public void renderDocument() {
    try {
        switch (getExtension(reportTemplate)) {
            case JASPER_EXT:
                printReport((JasperReport) JRLoader.loadObject(reportTemplate.getDocumentContent()));
                break;
            case JRXML_EXT:
                JasperDesign design = JRXmlLoader.load(reportTemplate.getDocumentContent());
                if (!design.getParametersMap().containsKey(CUBA_PARAM))
                    design.addParameter(createJRParameter());

                printReport(JasperCompileManager.compileReport(design));
                break;
            default:
                throw new ReportFormattingException("Error handling template extension");
        }
    } catch (JRException e) {
        throw new ReportFormattingException("Error formatting jasper report: " + e.getMessage(), e);
    }
}
 
开发者ID:cuba-platform,项目名称:yarg,代码行数:22,代码来源:JasperFormatter.java

示例13: imprimirClientesActivos

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的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

示例14: imprimirFacturacionAnualPorCompania

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的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

示例15: imprimirPolizasPorCompania

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入方法依赖的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


注:本文中的net.sf.jasperreports.engine.xml.JRXmlLoader.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。