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

Java JRPrintImage类代码示例

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

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



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

示例1: createObject

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
	JRPrintImage printImage = (JRPrintImage)digester.peek();
	
 	 	boolean isLazy = 
 	 		printImage.getRenderer() instanceof ResourceRenderer
 	 		? ((ResourceRenderer)printImage.getRenderer()).isLazy()
 	 		: false;

	JRPrintImageSourceObject imageSource = new JRPrintImageSourceObject(isLazy);

	imageSource.setPrintImage(printImage);

	String isEmbedded = atts.getValue(JRXmlConstants.ATTRIBUTE_isEmbedded);
	if (isEmbedded != null && isEmbedded.length() > 0)
	{
		imageSource.setEmbedded(Boolean.valueOf(isEmbedded).booleanValue());
	}

	return imageSource;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:JRPrintImageSourceFactory.java


示例2: InternalImageProcessor

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
protected InternalImageProcessor(
	JRPrintImage imageElement
	)
{
	this.imageElement = imageElement;
	this.imageRenderersCache = imageElement.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext());
	
	topPadding =
		Math.max(imageElement.getLineBox().getTopPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getTopPen()));
	leftPadding =
		Math.max(imageElement.getLineBox().getLeftPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getLeftPen()));
	bottomPadding =
		Math.max(imageElement.getLineBox().getBottomPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getBottomPen()));
	rightPadding =
		Math.max(imageElement.getLineBox().getRightPadding().intValue(), getImageBorderCorrection(imageElement.getLineBox().getRightPen()));

	int tmpAvailableImageWidth = imageElement.getWidth() - leftPadding - rightPadding;
	availableImageWidth = tmpAvailableImageWidth < 0 ? 0 : tmpAvailableImageWidth;

	int tmpAvailableImageHeight = imageElement.getHeight() - topPadding - bottomPadding;
	availableImageHeight = tmpAvailableImageHeight < 0 ? 0 : tmpAvailableImageHeight;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:JRXlsExporter.java


示例3: InternalImageProcessor

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
public InternalImageProcessor(
	JRPrintImage imageElement,
	JRExporterGridCell cell,
	int availableImageWidth,
	int availableImageHeight,
	DocumentBuilder documentBuilder,
	JasperReportsContext jasperReportsContext
	)
{
	this.imageElement = imageElement;
	this.imageRenderersCache = imageElement.isUsingCache() ? documentBuilder.getRenderersCache() 
			: new RenderersCache(jasperReportsContext);
	this.cell = cell;
	this.availableImageWidth = availableImageWidth;
	this.availableImageHeight = availableImageHeight;
	this.documentBuilder = documentBuilder;
	this.jasperReportsContext = jasperReportsContext;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:InternalImageProcessor.java


示例4: InternalImageProcessor

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
private InternalImageProcessor(JRPrintImage printImage)
{
	this.printImage = printImage;
	this.imageRenderersCache = printImage.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext());
	
	topPadding = printImage.getLineBox().getTopPadding().intValue();
	leftPadding = printImage.getLineBox().getLeftPadding().intValue();
	bottomPadding = printImage.getLineBox().getBottomPadding().intValue();
	rightPadding = printImage.getLineBox().getRightPadding().intValue();

	int tmpAvailableImageWidth = printImage.getWidth() - leftPadding - rightPadding;
	availableImageWidth = tmpAvailableImageWidth < 0 ? 0 : tmpAvailableImageWidth;

	int tmpAvailableImageHeight = printImage.getHeight() - topPadding - bottomPadding;
	availableImageHeight = tmpAvailableImageHeight < 0 ? 0 : tmpAvailableImageHeight;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:JRPdfExporter.java


示例5: InternalImageProcessor

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
protected InternalImageProcessor(
	JRPrintImage imageElement,
	boolean isLazy,
	boolean needDimension, 
	TableCell cell,
	int availableImageWidth,
	int availableImageHeight
	)
{
	this.imageElement = imageElement;
	this.imageRenderersCache = imageElement.isUsingCache() ? renderersCache : new RenderersCache(getJasperReportsContext());
	this.isLazy = isLazy;
	this.embedImage = isEmbedImage(imageElement);
	this.needDimension = needDimension;
	this.cell = cell;
	this.availableImageWidth = availableImageWidth;
	this.availableImageHeight = availableImageHeight;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:HtmlExporter.java


示例6: getImageHorizontalAlignmentStyle

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
protected String getImageHorizontalAlignmentStyle(JRPrintImage image)
{
	String horizontalAlignment = CSS_TEXT_ALIGN_LEFT;
	switch (image.getHorizontalImageAlign())
	{
		case RIGHT :
		{
			horizontalAlignment = CSS_TEXT_ALIGN_RIGHT;
			break;
		}
		case CENTER :
		{
			horizontalAlignment = CSS_TEXT_ALIGN_CENTER;
			break;
		}
		case LEFT :
		default :
		{
			horizontalAlignment = CSS_TEXT_ALIGN_LEFT;
		}
	}
	return horizontalAlignment;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:HtmlExporter.java


示例7: getImageVerticalAlignmentStyle

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
protected String getImageVerticalAlignmentStyle(JRPrintImage image)
{
	String verticalAlignment = HTML_VERTICAL_ALIGN_TOP;
	switch (image.getVerticalImageAlign())
	{
		case BOTTOM :
		{
			verticalAlignment = HTML_VERTICAL_ALIGN_BOTTOM;
			break;
		}
		case MIDDLE :
		{
			verticalAlignment = HTML_VERTICAL_ALIGN_MIDDLE;
			break;
		}
		case TOP :
		default :
		{
			verticalAlignment = HTML_VERTICAL_ALIGN_TOP;
		}
	}
	return verticalAlignment;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:HtmlExporter.java


示例8: exportFrame

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
protected void exportFrame(JRPrintFrame frame) throws JRException {
	
	for (Object element : frame.getElements()) {
		if (element instanceof JRPrintLine) {
			exportLine((JRPrintLine)element);
		} else if (element instanceof JRPrintRectangle) {
			exportRectangle((JRPrintRectangle)element);
		} else if (element instanceof JRPrintEllipse) {
			exportRectangle((JRPrintEllipse)element);
		} else if (element instanceof JRPrintImage) {
			exportImage((JRPrintImage) element);
		} else if (element instanceof JRPrintText) {
			exportText((JRPrintText)element);
		} else if (element instanceof JRPrintFrame) {
			exportFrame((JRPrintFrame) element);
		} else if (element instanceof JRGenericPrintElement) {
			exportGenericElement((JRGenericPrintElement) element);
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:JRXlsMetadataExporter.java


示例9: getImage

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
/**
 * 
 */
public static JRPrintImage getImage(List<JasperPrint> jasperPrintList, JRPrintElementIndex imageIndex)
{
	JasperPrint report = jasperPrintList.get(imageIndex.getReportIndex());
	JRPrintPage page = report.getPages().get(imageIndex.getPageIndex());

	Integer[] elementIndexes = imageIndex.getAddressArray();
	Object element = page.getElements().get(elementIndexes[0].intValue());

	for (int i = 1; i < elementIndexes.length; ++i)
	{
		JRPrintFrame frame = (JRPrintFrame) element;
		element = frame.getElements().get(elementIndexes[i].intValue());
	}

	return (JRPrintImage) element;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:20,代码来源:AbstractHtmlExporter.java


示例10: InternalImageDrawer

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
protected InternalImageDrawer(
	JRPrintImage printImage,
	int offsetX,
	int offsetY
	)
{
	this.printImage = printImage;
	this.offsetX = offsetX;
	this.offsetY = offsetY;

	topPadding = printImage.getLineBox().getTopPadding().intValue();
	leftPadding = printImage.getLineBox().getLeftPadding().intValue();
	bottomPadding = printImage.getLineBox().getBottomPadding().intValue();
	rightPadding = printImage.getLineBox().getRightPadding().intValue();
	
	int tmpAvailableImageWidth = printImage.getWidth() - leftPadding - rightPadding;
	availableImageWidth = tmpAvailableImageWidth < 0 ? 0 : tmpAvailableImageWidth;

	int tmpAvailableImageHeight = printImage.getHeight() - topPadding - bottomPadding;
	availableImageHeight = tmpAvailableImageHeight < 0 ? 0 : tmpAvailableImageHeight;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:ImageDrawer.java


示例11: visit

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
public void visit(JRPrintImage image, Offset offset)
{
	try
	{
		imageDrawer.draw(
				grx,
				image, 
				offset.getX(), 
				offset.getY()
				);
	} 
	catch (JRException e)
	{
		throw new JRRuntimeException(e);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:PrintDrawVisitor.java


示例12: copy

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
/**
 *
 */
protected void copy(JRPrintImage printImage)
{
	printImage.setRenderer(getRenderable());
	printImage.setAnchorName(getAnchorName());
	if (getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen))
	{
		printImage.setHyperlinkReference(getHyperlinkReference());
		printImage.setHyperlinkAnchor(getHyperlinkAnchor());
		printImage.setHyperlinkPage(getHyperlinkPage());
		printImage.setHyperlinkTooltip(getHyperlinkTooltip());
		printImage.setHyperlinkParameters(hyperlinkParameters);
	}
	else
	{
		if (printImage instanceof JRTemplatePrintImage)//this is normally the case
		{
			((JRTemplatePrintImage) printImage).setHyperlinkOmitted(true);
		}
		
		printImage.setHyperlinkReference(null);
	}
	transferProperties(printImage);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:JRFillChart.java


示例13: copy

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
protected void copy(JRPrintImage printImage)
	{
		printImage.setRenderer(getRenderable());
		printImage.setAnchorName(getAnchorName());
		if (getChartSettings().getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen))
		{
			printImage.setHyperlinkReference(getHyperlinkReference());
			printImage.setHyperlinkAnchor(getHyperlinkAnchor());
			printImage.setHyperlinkPage(getHyperlinkPage());
			printImage.setHyperlinkTooltip(getHyperlinkTooltip());
			printImage.setHyperlinkParameters(hyperlinkParameters);
		}
		else
		{
			if (printImage instanceof JRTemplatePrintImage)//this is normally the case
			{
				((JRTemplatePrintImage) printImage).setHyperlinkOmitted(true);
			}
			
			printImage.setHyperlinkReference(null);
		}
//		transferProperties(printImage);
	}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:FillSpiderChart.java


示例14: getRenderable

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的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: initHypelinks

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
private void initHypelinks() {
	links.clear();
	if (page == null)
		return;
	List<JRPrintElement> elements = page.getElements();
	if (elements == null)
		return;

	for (JRPrintElement element : elements) {
		if (element instanceof JRPrintImage) {
			Renderable r = ((JRPrintImage) element).getRenderable();
			if (r instanceof ImageMapRenderable) {
				try {
					List<JRPrintImageAreaHyperlink> hyperlinks = ((ImageMapRenderable) r).getImageAreaHyperlinks(new java.awt.Rectangle(0, 0, element.getWidth(), element.getHeight()));
					if (hyperlinks != null)
						links.add(new ImageAreaHyperlink(element.getX(), element.getY(), hyperlinks));
				} catch (JRException e) {
					throw new RuntimeException(e);
				}
			}
		} else if (element instanceof JRPrintHyperlink && !((JRPrintHyperlink) element).getHyperlinkTypeValue().equals(HyperlinkTypeEnum.NONE))
			links.add(new PrintHyperlink(0, 0, element));
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:25,代码来源:ViewerCanvas.java


示例16: test

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
public void test() {
	super.test();

	numberOfPagesTest(1);

	elementCountTest("detail.column_field11", 3);
	elementValueTest("detail.column_field11", "True", "False", "");

	elementCountTest("detail.column_field12", 3);
	elementValueTest("detail.column_field12", "True", "False", "False");

	testImage("detail.column_field13", 0);
	testImage("detail.column_field13", 1);
	Assert.assertNull((((JRPrintImage) getElementAt("detail.column_field13", 2)).getRenderable()));

	testImage("detail.column_field14", 0);
	testImage("detail.column_field14", 1);
	testImage("detail.column_field14", 2);
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:21,代码来源:BooleanColumn2Test.java


示例17: test

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
public void test() {
	super.test();

	numberOfPagesTest(1);

	try {
		byte[] imageData = JRImageLoader.getInstance(DefaultJasperReportsContext.getInstance()).loadBytesFromAwtImage(image, ImageTypeEnum.JPEG);
		JRPrintImage jrImage = (JRPrintImage) getElementAt("title.image1", 0);
		Assert.assertTrue("image data", Arrays.equals(imageData, jrImage.getRenderable().getImageData(DefaultJasperReportsContext.getInstance())));
		Assert.assertEquals("scale image", ScaleImageEnum.CLIP, jrImage.getScaleImageValue());
	} catch (JRException e) {
		e.printStackTrace();
		Assert.fail(e.getMessage());
	}
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:17,代码来源:Image1Test.java


示例18: exportElement

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
public void exportElement(JExcelApiExporterContext exporterContext,
    JRGenericPrintElement element, JRExporterGridCell gridCell,
    int colIndex, int rowIndex, int emptyCols, int yCutsRow,
    JRGridLayout layout) {
  try {
    JExcelApiExporter exporter = (JExcelApiExporter) exporterContext
        .getExporter();
    JasperReportsContext reportsContext = exporterContext
        .getJasperReportsContext();
    JRPrintImage printImage = getImage(reportsContext, element);
    exporter.exportImage(printImage, gridCell, colIndex, rowIndex, emptyCols,
        yCutsRow, layout);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:sourcepole,项目名称:jasperreports-wms-component,代码行数:18,代码来源:WmsMapElementJExcelApiHandler.java


示例19: createImageFromElement

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
public JRPrintImage createImageFromElement(JRGenericPrintElement element) throws JRException {
	String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT);
	String scaleType = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_SCALE_TYPE);
	String horizontalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HORIZONTAL_ALIGN);
	String verticalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_VERTICAL_ALIGN);
	Boolean hasOverflowed = (Boolean) element.getParameterValue(HtmlPrintElement.BUILTIN_PARAMETER_HAS_OVERFLOWED);
	Boolean clipOnOverflow = (Boolean) element.getParameterValue(HtmlPrintElement.PARAMETER_CLIP_ON_OVERFLOW);
	
	JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider());
	printImage.setStyle(element.getStyle());
	printImage.setMode(element.getModeValue());
	printImage.setBackcolor(element.getBackcolor());
	printImage.setForecolor(element.getForecolor());
	printImage.setX(element.getX());
	printImage.setY(element.getY());
	printImage.setWidth(element.getWidth());
	printImage.setScaleImage(ScaleImageEnum.getByName(scaleType));
	printImage.setHorizontalImageAlign(HorizontalImageAlignEnum.getByName(horizontalAlignment));
	printImage.setVerticalImageAlign(VerticalImageAlignEnum.getByName(verticalAlignment));
	
	FlyingSaucerXhtmlToImageRenderer renderer = new FlyingSaucerXhtmlToImageRenderer(getHtmlDocument(htmlContent), element.getWidth(), element.getHeight());
	
	if (printImage.getScaleImageValue() == ScaleImageEnum.REAL_HEIGHT || printImage.getScaleImageValue() == ScaleImageEnum.REAL_SIZE) {
		boolean canClip = hasOverflowed != null ? hasOverflowed : false;
		if (canClip) {
			printImage.setHeight(element.getHeight());
			if (clipOnOverflow) {
				printImage.setScaleImage(ScaleImageEnum.CLIP);
			}
		} else {
			printImage.setHeight(renderer.getComputedSize().height);
		}
	} else {
		printImage.setHeight(element.getHeight());
	}

	printImage.setRenderer(renderer);
	return printImage;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:41,代码来源:FlyingSaucerHtmlPrintElement.java


示例20: createImageFromComponentElement

import net.sf.jasperreports.engine.JRPrintImage; //导入依赖的package包/类
@Override
public JRPrintImage createImageFromComponentElement(JRComponentElement componentElement) throws JRException {
	HtmlComponent html = (HtmlComponent) componentElement.getComponent();
	
	String htmlContent = "";
	
	if (html.getHtmlContentExpression() != null) {
		htmlContent = JRExpressionUtil.getExpressionText(html.getHtmlContentExpression());
	}
	
	JRBasePrintImage printImage = new JRBasePrintImage(componentElement.getDefaultStyleProvider());

	printImage.setStyle(componentElement.getStyle());
	printImage.setMode(componentElement.getModeValue());
	printImage.setBackcolor(componentElement.getBackcolor());
	printImage.setForecolor(componentElement.getForecolor());
	printImage.setX(componentElement.getX());
	printImage.setY(componentElement.getY());
	printImage.setWidth(componentElement.getWidth());
	printImage.setHeight(componentElement.getHeight());
	printImage.setScaleImage(html.getScaleType());
	printImage.setHorizontalImageAlign(html.getHorizontalImageAlign());
	printImage.setVerticalImageAlign(html.getVerticalImageAlign());
	
	FlyingSaucerXhtmlToImageRenderer renderer = new FlyingSaucerXhtmlToImageRenderer(getHtmlDocument(htmlContent), componentElement.getWidth(), componentElement.getHeight());
	printImage.setRenderer(renderer);
	return printImage;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:29,代码来源:FlyingSaucerHtmlPrintElement.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DidOpenTextDocumentParams类代码示例发布时间:2022-05-23
下一篇:
Java BookmarkNode类代码示例发布时间: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