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


Java DefaultJasperReportsContext类代码示例

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


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

示例1: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".xls";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRXlsExporter exporter = new JRXlsExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:23,代码来源:XlsExporter.java

示例2: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res)
		throws Exception {
	res.setContentType("text/xml");
	res.setHeader("Content-Disposition", "inline; filename=\"file.jrpxml\"");
	JRXmlExporter exporter = new JRXmlExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	//exporter.setParameter(JRExporterParameter.START_PAGE_INDEX, Integer.valueOf(1));
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:22,代码来源:JrpxmlExporter.java

示例3: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".rtf";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRRtfExporter exporter = new JRRtfExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:23,代码来源:RtfExporter.java

示例4: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	res.setContentType("text/html;charset=UTF-8");
	JRHtmlExporter exporter=new JRHtmlExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	req.getSession().setAttribute(BaseHttpServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	String path=req.getContextPath();
	if(path.endsWith("/")){
		path+="dorado/bdf2/jasperreports/html.image";
	}else{
		path+="/dorado/bdf2/jasperreports/html.image";			
	}
	exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,path+"?image=");
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:27,代码来源:HtmlExporter.java

示例5: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".pptx";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRPptxExporter exporter = new JRPptxExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:23,代码来源:PptxExporter.java

示例6: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".pdf";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRPdfExporter exporter = new JRPdfExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:23,代码来源:PdfExporter.java

示例7: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".docx";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRDocxExporter exporter = new JRDocxExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:23,代码来源:DocxExporter.java

示例8: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".csv";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRCsvExporter exporter = new JRCsvExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:23,代码来源:CsvExporter.java

示例9: viewReport

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
 * @see #viewReport(JasperReportsContext, InputStream, boolean, boolean, Locale, ResourceBundle)
 */
public static void viewReport(
	InputStream is,
	boolean isXMLFile,
	boolean isExitOnClose,
	Locale locale
	) throws JRException
{
	viewReport(
		DefaultJasperReportsContext.getInstance(),
		is,
		isXMLFile,
		isExitOnClose,
		locale,
		null
		);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:20,代码来源:JasperViewer.java

示例10: JRBasePart

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public JRBasePart(JRPart part, JRBaseObjectFactory factory)
{
	factory.put(part, this);
	
	this.uuid = part.getUUID();
	this.propertiesMap = JRPropertiesMap.getPropertiesClone(part);
	this.printWhenExpression = factory.getExpression(part.getPrintWhenExpression());
	this.partNameExpression = factory.getExpression(part.getPartNameExpression());
	this.evaluationTime = part.getEvaluationTime();

	componentKey = part.getComponentKey();
	
	PartComponentManager manager = PartComponentsEnvironment.getInstance(DefaultJasperReportsContext.getInstance()).getManager(componentKey);
	component = manager.getComponentCompiler(DefaultJasperReportsContext.getInstance()).toCompiledComponent(
			part.getComponent(), factory);

	if (component instanceof JRVisitable)
	{
		((JRVisitable) component).visit(factory);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:JRBasePart.java

示例11: initExcludeProperties

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
private void initExcludeProperties()
{
	JasperReportsContext context = jasperReportsContext == null 
			? DefaultJasperReportsContext.getInstance() : jasperReportsContext;
	List<PropertySuffix> excludeProperties = JRPropertiesUtil.getInstance(context).getProperties(
			PREFIX_EXCLUDE_PROPERTIES);
	
	excludePropertiesPattern = new ArrayList<Pattern>(excludeProperties.size());
	for (PropertySuffix propertySuffix : excludeProperties)
	{
		String regex = propertySuffix.getValue();
		Pattern pattern = Pattern.compile(regex);
		excludePropertiesPattern.add(pattern);
	}

	excludeUuids = JRPropertiesUtil.getInstance(context).getBooleanProperty(PROPERTY_EXCLUDE_UUIDS);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:JRXmlWriter.java

示例12: readObject

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
 * 
 */
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
{
	in.defaultReadObject();
	
	if (sortFieldsMap == null)
	{
		sortFieldsMap = new HashMap<String, JRSortField>();
	}
	if (sortFieldsList == null)
	{
		sortFieldsList = new ArrayList<JRSortField>();
	}
	
	if (propertyExpressions == null)
	{
		propertyExpressions = new ArrayList<DatasetPropertyExpression>();
	}

	@SuppressWarnings("resource")
	ContextClassLoaderObjectInputStream cclois = 
		in instanceof ContextClassLoaderObjectInputStream ? (ContextClassLoaderObjectInputStream)in : null;
	if (cclois == null)
	{
		jasperReportsContext = DefaultJasperReportsContext.getInstance();
	}
	else
	{
		jasperReportsContext = cclois.getJasperReportsContext();
	}
	
	//the listener is serialized, but not added to the query.
	//serializing the listener does not make much sense, it could have been easily recreated.
	addQueryLanguageListener();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:38,代码来源:JRDesignDataset.java

示例13: fill

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JRDataSource datasource = createDataSource(DefaultJasperReportsContext.getInstance(), Locale.US);
	JasperFillManager.fillReportToFile("build/reports/FunctionsReport.jasper", null, datasource);
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:11,代码来源:FunctionsApp.java

示例14: getHtmlPrintElementFactory

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
 * Return an {@link HtmlPrintElementFactory factory} instance.
 * 
 * @return a HtmlPrintElementFactory instance
 * @throws JRException if the {@link #PROPERTY_HTML_PRINTELEMENT_FACTORY factory property} is not defined
 * or the factory cannot be instantiated.
 */
public static HtmlPrintElementFactory getHtmlPrintElementFactory() throws JRException
{
	String factoryClassName = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperty(PROPERTY_HTML_PRINTELEMENT_FACTORY);
	if (factoryClassName == null)
	{
		factoryClassName = DefaultHtmlPrintElementFactory.class.getName();
	}
	
	return cache.getCachedInstance(factoryClassName);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:HtmlPrintElementUtils.java

示例15: getDefaultInstance

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
 *
 */
private static ChartUtil getDefaultInstance()//FIXMECONTEXT check this use of this
{
	return new ChartUtil(DefaultJasperReportsContext.getInstance());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:ChartUtil.java


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