本文整理汇总了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;未经允许,请勿转载。 |
请发表评论