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

Java OnErrorTypeEnum类代码示例

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

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



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

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


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


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


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


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


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


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


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


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


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


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


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


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


示例16: getImageRenderable

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
public static Renderable getImageRenderable(
    JasperReportsContext jasperReportsContext, String elementName,
    WmsRequestBuilder requestBuilder)
    throws MalformedURLException,
    IOException, JRException {

  URL mapUrl = requestBuilder.toMapUrl();
  HttpURLConnection httpConnection = (HttpURLConnection) mapUrl
      .openConnection();

  // Handle XML response
  validateServerResponse(elementName, mapUrl, httpConnection);

  JasperReportsContext context = jasperReportsContext;
  if (context == null) {
    context = DefaultJasperReportsContext.getInstance();
  }
  Renderable cacheRenderer = RenderableUtil.getInstance(context)
      .getRenderable(
          httpConnection.getInputStream(),
          OnErrorTypeEnum.ERROR);
  // cacheRenderer.getImageData(jasperReportsContext);
  return cacheRenderer;
}
 
开发者ID:sourcepole,项目名称:jasperreports-wms-component,代码行数:25,代码来源:WmsMapElementImageProvider.java


示例17: process

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
protected byte[] process(
	JasperReportsContext jasperReportsContext,
	Renderable renderer,
	Dimension dimension,
	Color backcolor
	) throws JRException
{
	RendererUtil rendererUtil = RendererUtil.getInstance(jasperReportsContext);
	
	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(jasperReportsContext);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:ImageWebResourceHandler.java


示例18: handleImageError

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
/**
 * 
 */
public Renderable handleImageError(Exception error, OnErrorTypeEnum onErrorType) throws JRException
{
	Renderable errorRenderable;
	if (error instanceof JRException)
	{
		errorRenderable = getOnErrorRenderer(onErrorType, (JRException) error);
	}
	else if (error instanceof JRRuntimeException)
	{
		errorRenderable = getOnErrorRenderer(onErrorType, (JRRuntimeException) error);
	}
	else if (error instanceof RuntimeException)
	{
		throw (RuntimeException) error;
	}
	else
	{
		// we shouldn't get here normally
		if (log.isDebugEnabled())
		{
			log.debug("got unexpected image exception of type " + error.getClass().getName(), error);
		}
		
		throw 
			new JRRuntimeException(
				EXCEPTION_MESSAGE_KEY_IMAGE_ERROR,
				(Object[])null,
				error);
	}
	return errorRenderable;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:35,代码来源:RenderableUtil.java


示例19: setOnErrorType

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
@Override
public void setOnErrorType(OnErrorTypeEnum onErrorTypeValue)
{
	OnErrorTypeEnum old = this.onErrorTypeValue;
	this.onErrorTypeValue = onErrorTypeValue;
	getEventSupport().firePropertyChange(PROPERTY_ON_ERROR_TYPE, old, this.onErrorTypeValue);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:JRBaseImage.java


示例20: readObject

import net.sf.jasperreports.engine.type.OnErrorTypeEnum; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
	in.defaultReadObject();

	if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
	{
		horizontalAlignmentValue = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getByValue(horizontalAlignment);
		verticalAlignmentValue = net.sf.jasperreports.engine.type.VerticalAlignEnum.getByValue(verticalAlignment);
		scaleImageValue = ScaleImageEnum.getByValue(scaleImage);
		onErrorTypeValue = OnErrorTypeEnum.getByValue(onErrorType);
		evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);

		horizontalAlignment = null;
		verticalAlignment = null;
		scaleImage = null;
	}

	if (linkType == null)
	{
		 linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType));
	}

	if (linkTarget == null)
	{
		 linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget));
	}

	if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2)
	{
		horizontalImageAlign = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getHorizontalImageAlignEnum(horizontalAlignmentValue);
		verticalImageAlign = net.sf.jasperreports.engine.type.VerticalAlignEnum.getVerticalImageAlignEnum(verticalAlignmentValue);

		horizontalAlignmentValue = null;
		verticalAlignmentValue = null;
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:38,代码来源:JRBaseImage.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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