From 0f73d49e9e279e9c0e4df124da62a4f8d8420d53 Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Tue, 3 Sep 2019 12:07:42 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-1197=20=E6=96=B0=E5=A2=9Eutils=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E4=B8=80=E4=BA=9B=E7=B1=BB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/base/AbstractPainter.java | 4 ++++ .../com/fanruan/api/base/BaseFormula.java | 4 ++++ .../design/work/formula/TinyFormulaPane.java | 7 ++++++ .../fanruan/api/util/BaseHTMLWriterKit.java | 21 ++++++++++++++++++ .../java/com/fanruan/api/util/CellKit.java | 22 +++++++++++++++++++ .../java/com/fanruan/api/util/StableKit.java | 15 +++++++++++++ 6 files changed, 73 insertions(+) create mode 100644 src/main/java/com/fanruan/api/base/AbstractPainter.java create mode 100644 src/main/java/com/fanruan/api/base/BaseFormula.java create mode 100644 src/main/java/com/fanruan/api/design/work/formula/TinyFormulaPane.java create mode 100644 src/main/java/com/fanruan/api/util/BaseHTMLWriterKit.java create mode 100644 src/main/java/com/fanruan/api/util/CellKit.java create mode 100644 src/main/java/com/fanruan/api/util/StableKit.java diff --git a/src/main/java/com/fanruan/api/base/AbstractPainter.java b/src/main/java/com/fanruan/api/base/AbstractPainter.java new file mode 100644 index 0000000..e236deb --- /dev/null +++ b/src/main/java/com/fanruan/api/base/AbstractPainter.java @@ -0,0 +1,4 @@ +package com.fanruan.api.base; + +public abstract class AbstractPainter extends com.fr.base.AbstractPainter { +} diff --git a/src/main/java/com/fanruan/api/base/BaseFormula.java b/src/main/java/com/fanruan/api/base/BaseFormula.java new file mode 100644 index 0000000..8529608 --- /dev/null +++ b/src/main/java/com/fanruan/api/base/BaseFormula.java @@ -0,0 +1,4 @@ +package com.fanruan.api.base; + +public abstract class BaseFormula extends com.fr.base.BaseFormula { +} diff --git a/src/main/java/com/fanruan/api/design/work/formula/TinyFormulaPane.java b/src/main/java/com/fanruan/api/design/work/formula/TinyFormulaPane.java new file mode 100644 index 0000000..23b7af5 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/work/formula/TinyFormulaPane.java @@ -0,0 +1,7 @@ +package com.fanruan.api.design.work.formula; + +public class TinyFormulaPane extends com.fr.design.formula.TinyFormulaPane { + public TinyFormulaPane() { + super(); + } +} diff --git a/src/main/java/com/fanruan/api/util/BaseHTMLWriterKit.java b/src/main/java/com/fanruan/api/util/BaseHTMLWriterKit.java new file mode 100644 index 0000000..ada9dde --- /dev/null +++ b/src/main/java/com/fanruan/api/util/BaseHTMLWriterKit.java @@ -0,0 +1,21 @@ +package com.fanruan.api.util; + +import com.fr.stable.html.Tag; +import com.fr.stable.web.Repository; +import com.fr.web.BaseHTMLWriterUtils; + +import java.awt.*; + +public class BaseHTMLWriterKit { + + /** + * 根据原始的图片和指定的尺寸以及报表上下文生成图片的HTML标签,该方法只生成一个简单的img标签 + * @param image 原始图片 + * @param dimension 指定尺寸 + * @param repo 报表上下文 + * @return img图片标签 + */ + public static Tag createImageTag4RepoWithCheckVml(Image image, Dimension dimension, Repository repo){ + return BaseHTMLWriterUtils.createImageTag4RepoWithCheckVml(image, dimension, repo); + } +} diff --git a/src/main/java/com/fanruan/api/util/CellKit.java b/src/main/java/com/fanruan/api/util/CellKit.java new file mode 100644 index 0000000..7a6759f --- /dev/null +++ b/src/main/java/com/fanruan/api/util/CellKit.java @@ -0,0 +1,22 @@ +package com.fanruan.api.util; + +import com.fr.base.Style; +import com.fr.report.cell.cellattr.core.CellUtils; + +import java.awt.*; + +public class CellKit { + + /** + * 如果value是ImageWithSuffix类的一个实例,则创建一个宽为width,高为height,类型为TYPE_4BYTE_ABGR的image,并将其按照比例和Style绘制。 + * @param value 传入的需要判断为是否是ImageWithSuffix实例的对象 + * @param resolution 缩放比例的分母,缩放比例为1/resolution + * @param style 绘制image的style + * @param width 绘制image的宽 + * @param height 绘制image的高 + * @return + */ + public static Image value2Image(Object value, int resolution, Style style, int width, int height){ + return CellUtils.value2Image(value, resolution, style, width, height); + } +} diff --git a/src/main/java/com/fanruan/api/util/StableKit.java b/src/main/java/com/fanruan/api/util/StableKit.java new file mode 100644 index 0000000..1a67501 --- /dev/null +++ b/src/main/java/com/fanruan/api/util/StableKit.java @@ -0,0 +1,15 @@ +package com.fanruan.api.util; + +import com.fr.stable.StableUtils; + +public class StableKit { + + /** + * 判断一个对象是否可以转化为公式 + * @param object 要判断的字符串 + * @return 如果该字符串是以"="开头,说明可以转化成公式,否则不能转化成公式 + */ + public static boolean canBeFormula(Object object){ + return StableUtils.canBeFormula(object); + } +}