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


Java JRXmlLoader类代码示例

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


JRXmlLoader类属于net.sf.jasperreports.engine.xml包,在下文中一共展示了JRXmlLoader类的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: begin

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入依赖的package包/类
@Override
public void begin(String namespace, String name, Attributes attributes)
		throws Exception
{
	JRXmlLoader xmlLoader = getXmlLoader();
	TableComponent table = getTableComponent();
	JRDatasetRun datasetRun = table.getDatasetRun();
	String datasetName = datasetRun == null ? null : datasetRun.getDatasetName();
	
	if (log.isDebugEnabled())
	{
		log.debug("Pushing report context for dataset name " + datasetName);
	}
	
	XmlLoaderReportContext reportContext = new XmlLoaderReportContext(datasetName);
	xmlLoader.pushReportContext(reportContext);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:TableReportContextXmlRule.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: publishSubreport

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入依赖的package包/类
protected void publishSubreport(MReportUnit mrunit, IProgressMonitor monitor, JasperDesign jasper, Set<String> fileset, IFile file, JRDesignElement ele, String version) throws Exception {
	MJrxml fres = (MJrxml) impSRP.publish(jasper, ele, mrunit, monitor, fileset, file);
	if (fres == null)
		return;

	IFile[] fs = root.findFilesForLocationURI(fres.getFile().toURI());
	if (fs != null && fs.length > 0) {
		InputStream jrxmlInputStream = JRXMLUtils.getJRXMLInputStream(jrConfig, fs[0].getContents(), fs[0].getFileExtension(), fs[0].getCharset(true), version);
		InputSource is = new InputSource(new InputStreamReader(jrxmlInputStream, "UTF-8"));
		JasperDesign jrd = new JRXmlLoader(jrConfig, JasperReportsConfiguration.getJRXMLDigester()).loadXML(is);
		if (jrd != null) {
			fres.setJd(jrd);
			publishJrxml(fres, monitor, jrd, fileset, fs[0]);
			File f = FileUtils.createTempFile("jrsres", ".jrxml");
			FileUtils.writeFile(f, JRXmlWriterHelper.writeReport(jrConfig, jrd, version));
			fres.setFile(f);
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:JrxmlPublishContributor.java

示例10: initJDesign

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入依赖的package包/类
private void initJDesign(IFile file) {
	try {
		if (file != null && file.exists()) {
			if (jrConfig == null)
				jrConfig = new JasperReportsConfiguration(DefaultJasperReportsContext.getInstance(), file);
			else
				jrConfig.init(file);
			String fext = file.getFileExtension();
			if (jDesign == null && fext.equalsIgnoreCase(FileExtension.JRXML) || fext.equalsIgnoreCase(FileExtension.JASPER)) {
				jDesign = new JRXmlLoader(jrConfig, JasperReportsConfiguration.getJRXMLDigester()).loadXML(file.getContents());
				jrConfig.setJasperDesign(jDesign);
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:Publish2ServerWizard.java

示例11: getFromJRXML

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入依赖的package包/类
private JRBaseReport getFromJRXML(String path) {
	InputStream in = null;
	JRBaseReport jd = null;
	try {
		in = RepositoryUtil.getInstance(dto.getjConfig()).getInputStreamFromLocation(path);
		if (in != null) {
			InputSource is = new InputSource(new InputStreamReader(in, "UTF-8"));
			jd = new JRXmlLoader(dto.getjConfig(), JasperReportsConfiguration.getJRXMLDigester()).loadXML(is);
		}
	} catch (Exception e) {
		// e.printStackTrace();
	} finally {
		FileUtils.closeStream(in);
	}
	return jd;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:RVPropertyPage.java

示例12: xml2model

import net.sf.jasperreports.engine.xml.JRXmlLoader; //导入依赖的package包/类
/**
 * Xml2model.
 * 
 * @throws JRException
 *           the jR exception
 */
private void xml2model() throws Exception {
	InputStream in = null;
	try {
		IDocumentProvider dp = xmlEditor.getDocumentProvider();
		IDocument doc = dp.getDocument(xmlEditor.getEditorInput());
		in = new ByteArrayInputStream(doc.get().getBytes("UTF-8"));

		JasperDesign jd = new JRXmlLoader(jrContext, JasperReportsConfiguration.getJRXMLDigester()).loadXML(in);
		jrContext.setJasperDesign(jd);
		JaspersoftStudioPlugin.getExtensionManager().onLoad(jd, this);
		setModel(ReportFactory.createReport(jrContext));
	} finally {
		FileUtils.closeStream(in);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:JrxmlEditor.java

示例13: 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

示例14: 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

示例15: 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


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