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


Java OnErrorTypeEnum类代码示例

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


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

示例1: process

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
protected byte[] process(
	Renderable renderer,
	Dimension dimension,
	Color backcolor
	) throws JRException
{
	RendererUtil rendererUtil = RendererUtil.getInstance(getJasperReportsContext());
	
	if (renderer instanceof ResourceRenderer)
	{
		renderer = //hard to use a cache here and it would be just for some icon type of images, if any 
				rendererUtil.getNonLazyRenderable(
				((ResourceRenderer)renderer).getResourceLocation(), 
				OnErrorTypeEnum.ERROR
				);
	}

	DataRenderable dataRenderer = 
			rendererUtil.getDataRenderable(
			renderer,
			dimension,
			backcolor
			);
	
	return dataRenderer.getData(getJasperReportsContext());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:ImageServlet.java

示例2: convert

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 *
 */
public JRPrintElement convert(ReportConverter reportConverter, JRElement element) {
	JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider());
	JRChart chart = (JRChart) element;

	copyElement(reportConverter, chart, printImage);

	printImage.copyBox(chart.getLineBox());

	printImage.setAnchorName(JRExpressionUtil.getExpressionText(chart.getAnchorNameExpression()));
	printImage.setBookmarkLevel(chart.getBookmarkLevel());
	printImage.setLinkType(chart.getLinkType());
	printImage.setOnErrorType(OnErrorTypeEnum.ICON);
	printImage.setRenderable(getRenderer(reportConverter, chart));
	printImage.setScaleImage(ScaleImageEnum.CLIP);

	return printImage;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:21,代码来源:ChartConverter.java

示例3: getRenderable

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 *
 */
public Renderable getRenderable(Image img, OnErrorTypeEnum onErrorType) throws JRException
{
	ImageTypeEnum type = ImageTypeEnum.JPEG;
	if (img instanceof RenderedImage)
	{
		ColorModel colorModel = ((RenderedImage) img).getColorModel();
		//if the image has transparency, encode as PNG
		if (colorModel.hasAlpha() 
				&& colorModel.getTransparency() != Transparency.OPAQUE)
		{
			type = ImageTypeEnum.PNG;
		}
	}
	
	return getRenderable(img, type, onErrorType);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:20,代码来源:RenderableUtil.java

示例4: getOnErrorRendererForDimension

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * @deprecated To be removed.
 */
public Renderable getOnErrorRendererForDimension(Renderable renderer, OnErrorTypeEnum onErrorType) throws JRException
{
	Renderable result;
	try
	{
		renderer.getDimension(jasperReportsContext);
		result = renderer;
	}
	catch (Exception e)
	{
		result = handleImageError(e, onErrorType);
		
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType, e);
		}
	}
	return result;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:RenderableUtil.java

示例5: getOnErrorRendererForImageData

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * @deprecated To be removed.
 */
public Renderable getOnErrorRendererForImageData(Renderable renderer, OnErrorTypeEnum onErrorType) throws JRException
{
	Renderable result;
	try
	{
		renderer.getImageData(jasperReportsContext);
		result = renderer;
	}
	catch (Exception e)
	{
		result = handleImageError(e, onErrorType); 
		
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType, e);
		}
	}
	return result;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:RenderableUtil.java

示例6: getOnErrorRenderer

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
public Renderable getOnErrorRenderer(OnErrorTypeEnum onErrorType, JRException e) throws JRException
{
	Renderable renderer = null;
	
	switch (onErrorType)
	{
		case ICON :
		{
			renderer = new JRImageRenderer(JRImageLoader.NO_IMAGE_RESOURCE);
			//FIXME cache these renderers
			break;
		}
		case BLANK :
		{
			break;
		}
		case ERROR :
		default :
		{
			throw e;
		}
	}

	return renderer;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:RenderableUtil.java

示例7: convert

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
@Override
public JRPrintElement convert(ReportConverter reportConverter, JRElement element)
{
	JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider());
	JRChart chart = (JRChart)element;

	copyElement(reportConverter, chart, printImage);
	
	printImage.copyBox(chart.getLineBox());
	
	printImage.setAnchorName(JRExpressionUtil.getExpressionText(chart.getAnchorNameExpression()));
	printImage.setBookmarkLevel(chart.getBookmarkLevel());
	printImage.setLinkType(chart.getLinkType());
	printImage.setOnErrorType(OnErrorTypeEnum.ICON);
	printImage.setRenderer(getRenderer(reportConverter, chart));
	printImage.setScaleImage(ScaleImageEnum.CLIP);
	
	return printImage;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:20,代码来源:ChartConverter.java

示例8: getRenderer

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * @deprecated To be removed.
 */
protected net.sf.jasperreports.engine.Renderable getRenderer(JasperReportsContext jasperReportsContext)
{
	try
	{
		return 
			net.sf.jasperreports.engine.RenderableUtil.getInstance(jasperReportsContext).getRenderable(
				iconLocation, 
				OnErrorTypeEnum.ERROR);
	}
	catch (JRException e)
	{
		log.warn("Error creating component design preview icon", e);
		return null;
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:ElementIconConverter.java

示例9: getOnErrorRendererForImage

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * @deprecated To be removed.
 */
public static JRImageRenderer getOnErrorRendererForImage(JasperReportsContext jasperReportsContext, JRImageRenderer renderer, OnErrorTypeEnum onErrorType) throws JRException
{
	JRImageRenderer result;
	try
	{
		renderer.getImage(jasperReportsContext);
		result = renderer;
	}
	catch (Exception e)
	{
		result = (JRImageRenderer)RenderableUtil.getInstance(jasperReportsContext).handleImageError(e, onErrorType);
		
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType, e);
		}
	}
	return result;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:JRImageRenderer.java

示例10: getLoadedRenderer

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * 
 */
public Renderable getLoadedRenderer(ResourceRenderer resourceRenderer) throws JRException
{
	Renderable loadedRenderer;
	String resourceRendererId = resourceRenderer.getId();
	if (resourceRenderers.containsKey(resourceRendererId))
	{
		loadedRenderer = resourceRenderers.get(resourceRendererId);
	}
	else
	{
		// since we force OnErrorTypeEnum.ERROR, it is guaranteed that the method will return a DataRenderable implementation
		loadedRenderer = rendererUtil.getNonLazyRenderable(resourceRenderer.getResourceLocation(), OnErrorTypeEnum.ERROR);
		resourceRenderers.put(resourceRendererId, loadedRenderer);
	}
	
	return loadedRenderer;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:RenderersCache.java

示例11: getNonLazyRenderable

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 *
 */
public Renderable getNonLazyRenderable(String resourceLocation, OnErrorTypeEnum onErrorType) throws JRException
{
	byte[] data;

	try
	{
		data = RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(resourceLocation);
	}
	catch (Exception e)
	{
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType + " for location " + resourceLocation, e);
		}
		
		return handleImageError(e, onErrorType); 
	}
	
	return SimpleDataRenderer.getInstance(data);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:RendererUtil.java

示例12: getOnErrorRenderer

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 *
 */
public Renderable getOnErrorRenderer(OnErrorTypeEnum onErrorType, JRException e) throws JRException
{
	Renderable renderer = null;
	
	switch (onErrorType)
	{
		case ICON :
		{
			renderer = NO_IMAGE_RENDERER;
			break;
		}
		case BLANK :
		{
			break;
		}
		case ERROR :
		default :
		{
			throw e;
		}
	}

	return renderer;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:RendererUtil.java

示例13: convert

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 *
 */
public JRPrintElement convert(final ReportConverter reportConverter, final JRElement element) {
	JRImage image = (JRImage) element;
	JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider());
	Renderable cacheRenderer = getRenderable(reportConverter, element, image, printImage);
	copyGraphicElement(reportConverter, image, printImage);

	printImage.copyBox(image.getLineBox());

	printImage.setAnchorName(JRExpressionUtil.getExpressionText(image.getAnchorNameExpression()));
	printImage.setBookmarkLevel(image.getBookmarkLevel());
	printImage.setHorizontalAlignment(image.getOwnHorizontalAlignmentValue());
	printImage.setLazy(image.isLazy());
	printImage.setLinkType(image.getLinkType());
	printImage.setOnErrorType(OnErrorTypeEnum.ICON);
	printImage.setVerticalAlignment(image.getOwnVerticalAlignmentValue());
	if (cacheRenderer == null)
		cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), image, printImage);
	printImage.setRenderable(cacheRenderer);
	printImage.setScaleImage(image.getOwnScaleImageValue());

	return printImage;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:26,代码来源:ImageConverter.java

示例14: getRenderable

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * 
 */
private Renderable getRenderable(JasperReportsContext jasperReportsContext, JRImage imageElement,
		JRPrintImage printImage, KeyValue<JasperReportsContext, String> key) {
	// long ctime = System.currentTimeMillis();
	Renderable r = null;
	String location = ExpressionUtil.eval(imageElement.getExpression(),
			(JasperReportsConfiguration) jasperReportsContext);
	// JRExpressionUtil.getSimpleExpressionText(imageElement.getExpression());
	// long etime = System.currentTimeMillis();
	if (location != null) {
		try {
			r = RenderableUtil.getInstance(jasperReportsContext).getRenderable(location, OnErrorTypeEnum.ERROR, false);
			imgCache.put(key, r);
		} catch (JRException e) {
			if (log.isDebugEnabled())
				log.debug("Creating location renderer for converted image failed.", e);
		}
	}
	if (r == null)
		r = getRenderableNoImage(jasperReportsContext, imageElement, printImage);
	// long ftime = System.currentTimeMillis();
	// System.out.println("GetRenderable: " + (ftime - ctime) + " : " + (ftime - etime) + " " + location);
	return r;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:27,代码来源:ImageConverter.java

示例15: convertImage

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * Return the content for an MImage element
 * 
 * @param reportConverter the report converter 
 * @param element a not null MImage element
 * @return An image pointed by the expression of the element if it can be found, the
 * standard not found image otherwise. it is never null
 */
public JRPrintElement convertImage(ReportConverter reportConverter, MGraphicElement element){
	JRImage image = (JRImage) element.getValue();
	JRBasePrintImage printImage = new JRBasePrintImage(reportConverter.getDefaultStyleProvider());
	Renderable cacheRenderer = getRenderable(reportConverter, image, element);
	copyGraphicElement(reportConverter, image, printImage);

	printImage.copyBox(image.getLineBox());

	printImage.setAnchorName(JRExpressionUtil.getExpressionText(image.getAnchorNameExpression()));
	printImage.setBookmarkLevel(image.getBookmarkLevel());
	printImage.setHorizontalAlignment(image.getOwnHorizontalAlignmentValue());
	printImage.setLazy(image.isLazy());
	printImage.setLinkType(image.getLinkType());
	printImage.setOnErrorType(OnErrorTypeEnum.ICON);
	printImage.setVerticalAlignment(image.getOwnVerticalAlignmentValue());
	//If it is null load the no image found element
	if (cacheRenderer == null)
		cacheRenderer = getRenderableNoImage(reportConverter.getJasperReportsContext(), image, printImage);
	printImage.setRenderable(cacheRenderer);
	printImage.setScaleImage(image.getOwnScaleImageValue());

	return printImage;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:32,代码来源:LazyImageConverter.java


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