From 41a09a060ed5dc0e0a3a86cfc1d986fbcd6eb2ea Mon Sep 17 00:00:00 2001 From: zhouping Date: Thu, 13 Oct 2016 14:20:26 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-437=20=E8=A1=A8=E5=8D=95=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E7=BC=A9=E7=95=A5=E5=9B=BE,=20=E4=B8=8D?= =?UTF-8?q?=E5=AD=98xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XElementCase.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 474acfbb9..252ec35c7 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -1,5 +1,6 @@ package com.fr.design.designer.creator; +import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; @@ -20,6 +21,7 @@ import com.fr.form.FormElementCaseProvider; import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; +import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.fun.FitProvider; import com.fr.stable.fun.ReportFitAttrProvider; @@ -35,6 +37,18 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme private UILabel imageLable; private JPanel coverPanel; private FormDesigner designer; + //缩略图 + private BufferedImage thumbnailImage; + private static BufferedImage DEFAULT_BACKGROUND; + + static{ + try{ + DEFAULT_BACKGROUND = BaseUtils.readImageWithCache("com/fr/base/images/report/elementcase.png"); + }catch (Throwable e) { + //IBM jdk 1.5.0_22 并发下读取图片有时会异常(EOFException), 这个图片反正只有设计器用到, 捕获住 + DEFAULT_BACKGROUND = CoreGraphHelper.createBufferedImage(0, 0); + } + } public XElementCase(ElementCaseEditor widget, Dimension initSize) { super(widget, initSize); @@ -145,7 +159,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme */ private UILabel initImageBackground(){ UILabel imageLable = new UILabel(); - BufferedImage image = toData().getECImage(); + BufferedImage image = getThumbnailImage(); setLabelBackground(image, imageLable); return imageLable; @@ -222,10 +236,18 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme } public void setBackground(BufferedImage image){ - toData().setECImage(image); + setThumbnailImage(image); setEditorIcon(image); } + private void setThumbnailImage(BufferedImage image) { + this.thumbnailImage = image; + } + + private BufferedImage getThumbnailImage(){ + return thumbnailImage == null ? DEFAULT_BACKGROUND : thumbnailImage; + } + private void setEditorIcon(BufferedImage image){ setLabelBackground(image, imageLable); }