本文整理汇总了Java中net.sf.jasperreports.engine.type.ScaleImageEnum类的典型用法代码示例。如果您正苦于以下问题:Java ScaleImageEnum类的具体用法?Java ScaleImageEnum怎么用?Java ScaleImageEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScaleImageEnum类属于net.sf.jasperreports.engine.type包,在下文中一共展示了ScaleImageEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的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;
}
示例2: getScaleImageValue
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
/**
*
*/
public ScaleImageEnum getScaleImageValue(JRCommonImage image)
{
ScaleImageEnum ownScaleImage = image.getOwnScaleImageValue();
if (ownScaleImage != null)
{
return ownScaleImage;
}
JRStyle baseStyle = getBaseStyle(image);
if (baseStyle != null)
{
ScaleImageEnum scaleImage = baseStyle.getScaleImageValue();
if (scaleImage != null)
{
return scaleImage;
}
}
return ScaleImageEnum.RETAIN_SHAPE;
}
示例3: createElementTemplate
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
@Override
protected JRTemplateElement createElementTemplate()
{
JRTemplateImage template =
new JRTemplateImage(
getElementOrigin(),
filler.getJasperPrint().getDefaultStyleProvider(),
this
);
if (getScaleImageValue() == ScaleImageEnum.REAL_HEIGHT
|| getScaleImageValue() == ScaleImageEnum.REAL_SIZE)
{
template.setScaleImage(ScaleImageEnum.RETAIN_SHAPE);
}
return template;
}
示例4: getTemplateImage
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
protected JRTemplateImage getTemplateImage()
{
JRStyle elementStyle = fillContext.getElementStyle();
JRTemplateImage templateImage = printTemplates.get(elementStyle);
if (templateImage == null)
{
templateImage = new JRTemplateImage(
fillContext.getElementOrigin(),
fillContext.getDefaultStyleProvider());
templateImage.setElement(fillContext.getComponentElement());
templateImage.setStyle(elementStyle);//already set by setElement, but keeping for safety
templateImage.setScaleImage(ScaleImageEnum.RETAIN_SHAPE);
templateImage.setUsingCache(false);
templateImage = deduplicate(templateImage);
printTemplates.put(elementStyle, templateImage);
}
return templateImage;
}
示例5: getTemplateImage
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
protected JRTemplateImage getTemplateImage()
{
JRStyle elementStyle = fillContext.getElementStyle();
JRTemplateImage templateImage = printTemplates.get(elementStyle);
if (templateImage == null)
{
templateImage = new JRTemplateImage(
fillContext.getElementOrigin(),
fillContext.getDefaultStyleProvider());
templateImage.setStyle(elementStyle);
templateImage.setScaleImage(ScaleImageEnum.RETAIN_SHAPE);
templateImage.setUsingCache(false);
templateImage = deduplicate(templateImage);
printTemplates.put(elementStyle, templateImage);
}
return templateImage;
}
示例6: convert
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的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;
}
示例7: convert
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
/**
*
*/
public JRPrintElement convert(final ReportConverter reportConverter, final JRComponentElement element) {
MapComponent map = (MapComponent) element.getComponent();
JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider());
Renderable cacheRenderer = getRenderable(reportConverter, element, map, printImage);
printImage.setUUID(element.getUUID());
printImage.setX(element.getX());
printImage.setY(element.getY());
printImage.setWidth(element.getWidth());
printImage.setHeight(element.getHeight());
printImage.setStyle(element.getStyle());
printImage.setMode(element.getModeValue());
printImage.setBackcolor(element.getBackcolor());
printImage.setForecolor(element.getForecolor());
printImage.setLazy(false);
// FIXMEMAP there are no scale image, alignment and onError attributes
// defined for the map element
printImage.setScaleImage(ScaleImageEnum.CLIP);
printImage.setHorizontalAlignment(HorizontalAlignEnum.LEFT);
printImage.setVerticalAlignment(VerticalAlignEnum.TOP);
printImage.setRenderable(cacheRenderer);
return printImage;
}
示例8: test
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的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());
}
}
示例9: createImageFromElement
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的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;
}
示例10: createImageFromElement
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
@Override
public JRPrintImage createImageFromElement(JRGenericPrintElement element) {
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);
JEditorPane editorPane = new JEditorPane();
editorPane.setEditorKitForContentType("text/html", new SynchronousImageLoaderKit());
editorPane.setContentType("text/html");
editorPane.setText(htmlContent);
editorPane.setBorder(null);
editorPane.setSize(editorPane.getPreferredSize());
JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider());
printImage.setX(element.getX());
printImage.setY(element.getY());
printImage.setWidth(element.getWidth());
printImage.setHeight(element.getHeight());
printImage.setScaleImage(ScaleImageEnum.getByName(scaleType));
printImage.setHorizontalImageAlign(HorizontalImageAlignEnum.getByName(horizontalAlignment));
printImage.setVerticalImageAlign(VerticalImageAlignEnum.getByName(verticalAlignment));
printImage.setStyle(element.getStyle());
printImage.setMode(element.getModeValue());
printImage.setBackcolor(element.getBackcolor());
printImage.setForecolor(element.getForecolor());
printImage.setRenderer(new AwtComponentRendererImpl(editorPane));
return printImage;
}
示例11: setHtmlComponentRules
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void setHtmlComponentRules(Digester digester)
{
String htmlComponentPattern = "*/componentElement/html";
digester.addObjectCreate(htmlComponentPattern, HtmlComponent.class.getName());
digester.addSetProperties(htmlComponentPattern, new String[] {
HtmlComponent.PROPERTY_SCALE_TYPE,
HtmlComponent.PROPERTY_HORIZONTAL_ALIGN,
HtmlComponent.PROPERTY_VERTICAL_ALIGN,
HtmlComponent.PROPERTY_EVALUATION_TIME },
new String[0]);
digester.addRule(htmlComponentPattern,
new XmlConstantPropertyRule(
HtmlComponent.PROPERTY_SCALE_TYPE,
ScaleImageEnum.values()));
digester.addRule(htmlComponentPattern,
new XmlConstantPropertyRule(
HtmlComponent.PROPERTY_HORIZONTAL_ALIGN,
"horizontalImageAlign",
HorizontalImageAlignEnum.values()));
digester.addRule(htmlComponentPattern,
new XmlConstantPropertyRule(
HtmlComponent.PROPERTY_VERTICAL_ALIGN,
"verticalImageAlign",
VerticalImageAlignEnum.values()));
digester.addRule(htmlComponentPattern,
new XmlConstantPropertyRule(
HtmlComponent.PROPERTY_EVALUATION_TIME,
EvaluationTimeEnum.values()));
String htmlContentPattern = htmlComponentPattern + "/htmlContentExpression";
digester.addFactoryCreate(htmlContentPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
digester.addCallMethod(htmlContentPattern, "setText", 0);
digester.addSetNext(htmlContentPattern, "setHtmlContentExpression", JRExpression.class.getName());
}
示例12: setScaleType
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
/**
* @param scaleType the scaleType to set
*/
public void setScaleType(ScaleImageEnum scaleType) {
Object old = this.scaleType;
this.scaleType = scaleType;
getEventSupport().firePropertyChange(PROPERTY_SCALE_TYPE,
old, this.scaleType);
}
示例13: setScaleImage
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
@Override
public void setScaleImage(ScaleImageEnum scaleImageValue)
{
Object old = this.scaleImageValue;
this.scaleImageValue = scaleImageValue;
getEventSupport().firePropertyChange(PROPERTY_SCALE_IMAGE, old, this.scaleImageValue);
}
示例14: setScaleImage
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的package包/类
@Override
public void setScaleImage(ScaleImageEnum scaleImageValue)
{
Object old = this.scaleImageValue;
this.scaleImageValue = scaleImageValue;
getEventSupport().firePropertyChange(JRBaseStyle.PROPERTY_SCALE_IMAGE, old, this.scaleImageValue);
}
示例15: readObject
import net.sf.jasperreports.engine.type.ScaleImageEnum; //导入依赖的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;
}
}