• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleFileResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SimpleFileResolver类属于net.sf.jasperreports.engine.util包,在下文中一共展示了SimpleFileResolver类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fillReport

import net.sf.jasperreports.engine.util.SimpleFileResolver; //导入依赖的package包/类
private void fillReport() {
    // jrVirtualizer = (JRFileVirtualizer) reportParameters
    // .get(JRParameter.REPORT_VIRTUALIZER);
    // if (null == jrVirtualizer) {
    // File tmp = new File(JASPER_PATH + sp + "cache");
    // if (!tmp.exists())
    // tmp.mkdirs();
    // jrVirtualizer = new JRFileVirtualizer(30, tmp.getAbsolutePath());
    // }
    // reportParameters.put(JRParameter.REPORT_VIRTUALIZER, jrVirtualizer);
     
    try {
        long start = System.currentTimeMillis();
        //set relative path during compilation process in jasper
        fr = new SimpleFileResolver(new File(templateContextPath));
        reportParameters.put(JRParameter.REPORT_FILE_RESOLVER, fr);
        setJasperPrint(JasperFillManager.fillReport(getJasperReport(), reportParameters));
        //System.out.println("isFirmTypeParamSet=" + reportParameters.containsKey("firmTypeParam"));
    } catch (JRException jre) {
        jre.printStackTrace();
     
    }
     
    // jrVirtualizer.setReadOnly(true);
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:26,代码来源:ReportGenerator.java


示例2: LocalJasperReportsContext

import net.sf.jasperreports.engine.util.SimpleFileResolver; //导入依赖的package包/类
@Override
public void	contextInitialized(ServletContextEvent ce) 
{
	LocalJasperReportsContext localJasperReportsContext = new LocalJasperReportsContext(DefaultJasperReportsContext.getInstance());
	SimpleFileResolver fileResolver = 
		new SimpleFileResolver(
			new File(
				new File(ce.getServletContext().getRealPath("/")), 
				ce.getServletContext().getInitParameter("net.sf.jasperreports.web.file.repository.root")
				)
			);
	localJasperReportsContext.setFileResolver(fileResolver);
	
	AbstractServlet.setJasperReportsContext(localJasperReportsContext);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:JasperReportsContextListener.java


示例3: getLocalJasperReportsContext

import net.sf.jasperreports.engine.util.SimpleFileResolver; //导入依赖的package包/类
/**
 * 
 */
protected JasperReportsContext getLocalJasperReportsContext(File file)
{
	SimpleFileResolver fileResolver =
		new SimpleFileResolver(
			Arrays.asList(new File[]{file.getParentFile(), new File(".")})
			);
	fileResolver.setResolveAbsolutePath(true);
	
	LocalJasperReportsContext localJasperReportsContext = new LocalJasperReportsContext(jasperReportsContext);
	localJasperReportsContext.setFileResolver(fileResolver);
	return localJasperReportsContext;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:JasperFillManager.java


示例4: findFile

import net.sf.jasperreports.engine.util.SimpleFileResolver; //导入依赖的package包/类
/**
 * Given a report in the workspace and a resource name
 * it return a file to that resource
 * 
 * @param file file of the report
 * @param str name of the resource
 * @return file to the resource in the filesystem
 */
protected File findFile(IFile file, String str) {
	if (str == null) return null;
	SimpleFileResolver fr = new SimpleFileResolver(
			Arrays.asList(new File[] {
					new File(file.getParent().getLocationURI()),
					new File("."), //$NON-NLS-1$
					new File(file.getProject().getLocationURI()) }));
	fr.setResolveAbsolutePath(true);
	return fr.resolveFile(str);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:ResourcePage.java


示例5: findFile

import net.sf.jasperreports.engine.util.SimpleFileResolver; //导入依赖的package包/类
public static File findFile(IFile file, String str) {
	if (str == null || str.isEmpty())
		return null;
	IContainer parent = file.getParent();
	SimpleFileResolver fr = new SimpleFileResolver(Arrays.asList(new File[] { new File(parent.getLocationURI()), file.getRawLocation().toFile().getParentFile(),
			new File(file.getProject().getLocationURI()) }));
	fr.setResolveAbsolutePath(true);
	return fr.resolveFile(str);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:10,代码来源:FileUtils.java


示例6: fillReport

import net.sf.jasperreports.engine.util.SimpleFileResolver; //导入依赖的package包/类
public static JasperPrint fillReport(StorageService storageService, String key, JasperReport jasper, Map<String, Object> params, Connection conn) throws JRException, InterruptedException {
    	Settings settings = storageService.getSettings();
        params.put(JRParameter.REPORT_FILE_RESOLVER, new SimpleFileResolver(new File(settings.getJasper().getHome())));

        // process stopped before runner starts
        if (JasperRunnerFactory.containsRunner(key)) {
            JasperRunnerFactory.removeRunner(key);
            ConnectionUtil.closeConnection(conn);
            return null;
        }

//        System.out.println("------------------------------");
//        for (String s : params.keySet()) {
//            System.out.println("  -> param="+s + " ["  + params.get(s)  + "]");
//        }
//        System.out.println("------------------------------");

        // Jasper 5.1.0+
        if (ctx == null) {
        	LocalJasperReportsContext localContext = new LocalJasperReportsContext(DefaultJasperReportsContext.getInstance());
        	localContext.setClassLoader(JasperReportsUtil.class.getClassLoader());
        	localContext.setFileResolver(new SimpleFileResolver(new File(settings.getJasper().getHome())));
        	ctx = localContext;
        }
        final JasperAsynchronousFillHandle handle = new JasperAsynchronousFillHandle(ctx, jasper, params, conn);
//        final JasperAsynchronousFillHandle handle = new JasperAsynchronousFillHandle(jasper, params, conn);
        JasperPrint print = null;
        try {
            JasperRunnerFactory.addRunner(key, handle);
            //Start the asynchronous thread to fill the report
            handle.startFill();
            //Wait until the thread ends to get the result
            handle.getFillThread().join();

            if (!handle.isCancelled()) {
                print = handle.getJasperPrint();
            } else {
                throw new InterruptedException("Running process was interrupted.");
            }
        } catch (InterruptedException ie) {
            throw ie;
        } catch (Exception e) {
            throw new JRException(e.getMessage());
        } finally {
            JasperRunnerFactory.removeRunner(key);
        }
        return print;
    }
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:49,代码来源:JasperReportsUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WSDLParserExtension类代码示例发布时间:2022-05-23
下一篇:
Java JavaStructureMember类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap