From 0f73d49e9e279e9c0e4df124da62a4f8d8420d53 Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Tue, 3 Sep 2019 12:07:42 +0800 Subject: [PATCH 1/6] =?UTF-8?q?KERNEL-1197=20=E6=96=B0=E5=A2=9Eutils?= =?UTF-8?q?=EF=BC=8C=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); + } +} From ff5eba5ead5eb4fca6feb7ca58d92b843efeb0ad Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Tue, 3 Sep 2019 12:45:08 +0800 Subject: [PATCH 2/6] =?UTF-8?q?KERNEL-1197=20=E6=8C=89=E8=A6=81=E6=B1=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/base/AbstractPainter.java | 4 ---- .../fanruan/api/design/work/formula/TinyFormulaPane.java | 7 ------- .../fanruan/api/{util => report}/BaseHTMLWriterKit.java | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/base/AbstractPainter.java delete mode 100644 src/main/java/com/fanruan/api/design/work/formula/TinyFormulaPane.java rename src/main/java/com/fanruan/api/{util => report}/BaseHTMLWriterKit.java (95%) diff --git a/src/main/java/com/fanruan/api/base/AbstractPainter.java b/src/main/java/com/fanruan/api/base/AbstractPainter.java deleted file mode 100644 index e236deb..0000000 --- a/src/main/java/com/fanruan/api/base/AbstractPainter.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.base; - -public abstract class AbstractPainter extends com.fr.base.AbstractPainter { -} 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 deleted file mode 100644 index 23b7af5..0000000 --- a/src/main/java/com/fanruan/api/design/work/formula/TinyFormulaPane.java +++ /dev/null @@ -1,7 +0,0 @@ -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/report/BaseHTMLWriterKit.java similarity index 95% rename from src/main/java/com/fanruan/api/util/BaseHTMLWriterKit.java rename to src/main/java/com/fanruan/api/report/BaseHTMLWriterKit.java index ada9dde..fd9a07f 100644 --- a/src/main/java/com/fanruan/api/util/BaseHTMLWriterKit.java +++ b/src/main/java/com/fanruan/api/report/BaseHTMLWriterKit.java @@ -1,4 +1,4 @@ -package com.fanruan.api.util; +package com.fanruan.api.report; import com.fr.stable.html.Tag; import com.fr.stable.web.Repository; From 1429f63c69236c6850a05a61acd0b2bb545d8ee1 Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Tue, 3 Sep 2019 16:35:09 +0800 Subject: [PATCH 3/6] =?UTF-8?q?KERNEL-1197=20=E6=96=B0=E5=A2=9E=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA=E8=BF=94=E5=9B=9E=E5=80=BC?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=EF=BC=8C=E5=88=A0=E9=99=A4=E6=8E=89=E4=BA=86?= =?UTF-8?q?=E8=A2=AB=E6=A0=87=E8=AE=B0=E4=B8=BAOpen=E7=9A=84BaseFormula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/base/BaseFormula.java | 4 ---- .../java/com/fanruan/api/util/CellKit.java | 2 +- .../com/fanruan/api/util/CellKitTest.java | 22 +++++++++++++++++++ .../com/fanruan/api/util/StableKitTest.java | 19 ++++++++++++++++ 4 files changed, 42 insertions(+), 5 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/base/BaseFormula.java create mode 100644 src/test/java/com/fanruan/api/util/CellKitTest.java create mode 100644 src/test/java/com/fanruan/api/util/StableKitTest.java diff --git a/src/main/java/com/fanruan/api/base/BaseFormula.java b/src/main/java/com/fanruan/api/base/BaseFormula.java deleted file mode 100644 index 8529608..0000000 --- a/src/main/java/com/fanruan/api/base/BaseFormula.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.base; - -public abstract class BaseFormula extends com.fr.base.BaseFormula { -} diff --git a/src/main/java/com/fanruan/api/util/CellKit.java b/src/main/java/com/fanruan/api/util/CellKit.java index 7a6759f..c007b5b 100644 --- a/src/main/java/com/fanruan/api/util/CellKit.java +++ b/src/main/java/com/fanruan/api/util/CellKit.java @@ -14,7 +14,7 @@ public class CellKit { * @param style 绘制image的style * @param width 绘制image的宽 * @param height 绘制image的高 - * @return + * @return 返回宽为width,高为height,类型为TYPE_4BYTE_ABGR的image */ 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/test/java/com/fanruan/api/util/CellKitTest.java b/src/test/java/com/fanruan/api/util/CellKitTest.java new file mode 100644 index 0000000..5d22589 --- /dev/null +++ b/src/test/java/com/fanruan/api/util/CellKitTest.java @@ -0,0 +1,22 @@ +package com.fanruan.api.util; + +import com.fr.base.Style; +import com.fr.plugin.present.fun.StarPainter; +import org.junit.Assert; +import org.junit.Test; + +import java.awt.*; + +import static org.junit.Assert.*; + +public class CellKitTest { + + @Test + public void value2Image() { + StarPainter star = new StarPainter(1); + Style style = Style.getInstance(); + Image image = CellKit.value2Image(star, 1, style, 30, 50); + Assert.assertEquals(30, image.getWidth(null)); + Assert.assertEquals(50, image.getHeight(null)); + } +} \ No newline at end of file diff --git a/src/test/java/com/fanruan/api/util/StableKitTest.java b/src/test/java/com/fanruan/api/util/StableKitTest.java new file mode 100644 index 0000000..753edd3 --- /dev/null +++ b/src/test/java/com/fanruan/api/util/StableKitTest.java @@ -0,0 +1,19 @@ +package com.fanruan.api.util; + +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class StableKitTest { + + @Test + public void canBeFormula() { + String s1 = "=1"; + String s2 = "=a+b+"; + String s3 = "ppp"; + Assert.assertTrue(StableKit.canBeFormula(s1)); + Assert.assertTrue(StableKit.canBeFormula(s2)); + Assert.assertFalse(StableKit.canBeFormula(s3)); + } +} \ No newline at end of file From b741f9b9d5757ece06ccda958ed8c95b3bb14f66 Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Tue, 3 Sep 2019 16:53:52 +0800 Subject: [PATCH 4/6] =?UTF-8?q?KERNEL-1197=20=E6=8C=89=E8=A6=81=E6=B1=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/cal/FormulaKit.java | 11 +++++++++++ .../CellKit.java => report/PaintKit.java} | 4 ++-- .../java/com/fanruan/api/util/StableKit.java | 15 --------------- .../com/fanruan/api/cal/FormulaKitTest.java | 10 ++++++++++ .../{CellKitTest.java => PaintKitTest.java} | 7 +++---- .../com/fanruan/api/util/StableKitTest.java | 19 ------------------- 6 files changed, 26 insertions(+), 40 deletions(-) rename src/main/java/com/fanruan/api/{util/CellKit.java => report/PaintKit.java} (93%) delete mode 100644 src/main/java/com/fanruan/api/util/StableKit.java rename src/test/java/com/fanruan/api/util/{CellKitTest.java => PaintKitTest.java} (75%) delete mode 100644 src/test/java/com/fanruan/api/util/StableKitTest.java diff --git a/src/main/java/com/fanruan/api/cal/FormulaKit.java b/src/main/java/com/fanruan/api/cal/FormulaKit.java index 93cd52a..503a8ab 100644 --- a/src/main/java/com/fanruan/api/cal/FormulaKit.java +++ b/src/main/java/com/fanruan/api/cal/FormulaKit.java @@ -7,6 +7,7 @@ import com.fr.base.ScriptFormula; import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; import com.fr.stable.FormulaProvider; +import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.UtilEvalError; import com.fr.stable.script.CalculatorProvider; @@ -104,4 +105,14 @@ public class FormulaKit { } return checkFormulaContent(formula.getPureContent()); } + + /** + * 判断一个对象是否可以转化为公式 + * @param object 要判断的字符串 + * @return 如果该字符串是以"="开头,说明可以转化成公式,否则不能转化成公式 + */ + public static boolean canBeFormula(Object object){ + return StableUtils.canBeFormula(object); + } + } diff --git a/src/main/java/com/fanruan/api/util/CellKit.java b/src/main/java/com/fanruan/api/report/PaintKit.java similarity index 93% rename from src/main/java/com/fanruan/api/util/CellKit.java rename to src/main/java/com/fanruan/api/report/PaintKit.java index c007b5b..3b1787e 100644 --- a/src/main/java/com/fanruan/api/util/CellKit.java +++ b/src/main/java/com/fanruan/api/report/PaintKit.java @@ -1,11 +1,11 @@ -package com.fanruan.api.util; +package com.fanruan.api.report; import com.fr.base.Style; import com.fr.report.cell.cellattr.core.CellUtils; import java.awt.*; -public class CellKit { +public class PaintKit { /** * 如果value是ImageWithSuffix类的一个实例,则创建一个宽为width,高为height,类型为TYPE_4BYTE_ABGR的image,并将其按照比例和Style绘制。 diff --git a/src/main/java/com/fanruan/api/util/StableKit.java b/src/main/java/com/fanruan/api/util/StableKit.java deleted file mode 100644 index 1a67501..0000000 --- a/src/main/java/com/fanruan/api/util/StableKit.java +++ /dev/null @@ -1,15 +0,0 @@ -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); - } -} diff --git a/src/test/java/com/fanruan/api/cal/FormulaKitTest.java b/src/test/java/com/fanruan/api/cal/FormulaKitTest.java index abed6cb..f2faf24 100644 --- a/src/test/java/com/fanruan/api/cal/FormulaKitTest.java +++ b/src/test/java/com/fanruan/api/cal/FormulaKitTest.java @@ -72,4 +72,14 @@ public class FormulaKitTest extends Prepare { assertEquals(true, FormulaKit.checkFormulaContent(new Formula("="))); assertEquals(false, FormulaKit.checkFormulaContent("=")); } + + @Test + public void canBeFormula() { + String s1 = "=1"; + String s2 = "=a+b+"; + String s3 = "ppp"; + Assert.assertTrue(FormulaKit.canBeFormula(s1)); + Assert.assertTrue(FormulaKit.canBeFormula(s2)); + Assert.assertFalse(FormulaKit.canBeFormula(s3)); + } } \ No newline at end of file diff --git a/src/test/java/com/fanruan/api/util/CellKitTest.java b/src/test/java/com/fanruan/api/util/PaintKitTest.java similarity index 75% rename from src/test/java/com/fanruan/api/util/CellKitTest.java rename to src/test/java/com/fanruan/api/util/PaintKitTest.java index 5d22589..33e2c17 100644 --- a/src/test/java/com/fanruan/api/util/CellKitTest.java +++ b/src/test/java/com/fanruan/api/util/PaintKitTest.java @@ -1,5 +1,6 @@ package com.fanruan.api.util; +import com.fanruan.api.report.PaintKit; import com.fr.base.Style; import com.fr.plugin.present.fun.StarPainter; import org.junit.Assert; @@ -7,15 +8,13 @@ import org.junit.Test; import java.awt.*; -import static org.junit.Assert.*; - -public class CellKitTest { +public class PaintKitTest { @Test public void value2Image() { StarPainter star = new StarPainter(1); Style style = Style.getInstance(); - Image image = CellKit.value2Image(star, 1, style, 30, 50); + Image image = PaintKit.value2Image(star, 1, style, 30, 50); Assert.assertEquals(30, image.getWidth(null)); Assert.assertEquals(50, image.getHeight(null)); } diff --git a/src/test/java/com/fanruan/api/util/StableKitTest.java b/src/test/java/com/fanruan/api/util/StableKitTest.java deleted file mode 100644 index 753edd3..0000000 --- a/src/test/java/com/fanruan/api/util/StableKitTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fanruan.api.util; - -import org.junit.Assert; -import org.junit.Test; - -import static org.junit.Assert.*; - -public class StableKitTest { - - @Test - public void canBeFormula() { - String s1 = "=1"; - String s2 = "=a+b+"; - String s3 = "ppp"; - Assert.assertTrue(StableKit.canBeFormula(s1)); - Assert.assertTrue(StableKit.canBeFormula(s2)); - Assert.assertFalse(StableKit.canBeFormula(s3)); - } -} \ No newline at end of file From 05c42fc0a37521f8c7deb461a5477b671645c853 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Tue, 3 Sep 2019 17:44:36 +0800 Subject: [PATCH 5/6] =?UTF-8?q?update:=20=E6=96=B0=E5=A2=9E=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E6=96=B9=E6=B3=95=E5=92=8C=E5=8F=82=E6=95=B0=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=B9=B6=E6=8F=90=E4=BE=9B=E5=8D=95=E6=B5=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/cal/ParameterKit.java | 9 +++++++++ .../api/design/ui/editor/ValueEditors.java | 17 +---------------- .../java/com/fanruan/api/util/ArrayKit.java | 11 +++++++++++ .../com/fanruan/api/cal/ParameterKitTest.java | 13 +++++++++++++ .../java/com/fanruan/api/util/ArrayKitTest.java | 14 ++++++++++++++ 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/fanruan/api/cal/ParameterKit.java b/src/main/java/com/fanruan/api/cal/ParameterKit.java index bc1cb30..67e316e 100644 --- a/src/main/java/com/fanruan/api/cal/ParameterKit.java +++ b/src/main/java/com/fanruan/api/cal/ParameterKit.java @@ -108,4 +108,13 @@ public class ParameterKit { public static ParameterProvider[] analyzeAndUnionSameParameters(String[] paramTexts, Parameter[] ps){ return ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps); } + + /** + * 将ParameterProvider类型数组转换为Parameter类型数组 + * @param providers ParameterProvider类型数组 + * @return Parameter类型数组 + * */ + public static Parameter[] providers2Parameter(ParameterProvider[] providers) { + return Parameter.providers2Parameter(providers); + } } diff --git a/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java b/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java index 4dda75f..760464c 100644 --- a/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java +++ b/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java @@ -4,22 +4,7 @@ import com.fanruan.api.design.DesignKit; import com.fanruan.api.design.ui.component.table.model.ParameterTableModel; import com.fanruan.api.util.StringKit; import com.fr.base.BaseFormula; -import com.fr.design.editor.editor.BooleanEditor; -import com.fr.design.editor.editor.ColumnRowEditor; -import com.fr.design.editor.editor.ColumnRowGroupEditor; -import com.fr.design.editor.editor.ColumnSelectedEditor; -import com.fr.design.editor.editor.ConstantsEditor; -import com.fr.design.editor.editor.CursorEditor; -import com.fr.design.editor.editor.DateEditor; -import com.fr.design.editor.editor.DoubleEditor; -import com.fr.design.editor.editor.Editor; -import com.fr.design.editor.editor.FormulaEditor; -import com.fr.design.editor.editor.IntegerEditor; -import com.fr.design.editor.editor.NoneEditor; -import com.fr.design.editor.editor.ParameterEditor; -import com.fr.design.editor.editor.SpinnerIntegerEditor; -import com.fr.design.editor.editor.TextEditor; -import com.fr.design.editor.editor.WidgetNameEditor; +import com.fr.design.editor.editor.*; import java.util.ArrayList; import java.util.Iterator; diff --git a/src/main/java/com/fanruan/api/util/ArrayKit.java b/src/main/java/com/fanruan/api/util/ArrayKit.java index 56322f1..92510c4 100644 --- a/src/main/java/com/fanruan/api/util/ArrayKit.java +++ b/src/main/java/com/fanruan/api/util/ArrayKit.java @@ -2,6 +2,8 @@ package com.fanruan.api.util; import com.fr.stable.ArrayUtils; +import java.util.List; + /** * @author richie * @version 10.0 @@ -91,4 +93,13 @@ public class ArrayKit { public static boolean isNotEmpty(T[] array) { return ArrayUtils.isNotEmpty(array); } + + /** + * 返回一个ArrayList + * @param array 数组 + * @return 链表 + * */ + public static List toList(T[] array) { + return ArrayUtils.toList(array); + } } diff --git a/src/test/java/com/fanruan/api/cal/ParameterKitTest.java b/src/test/java/com/fanruan/api/cal/ParameterKitTest.java index 4093687..2b05a31 100644 --- a/src/test/java/com/fanruan/api/cal/ParameterKitTest.java +++ b/src/test/java/com/fanruan/api/cal/ParameterKitTest.java @@ -114,4 +114,17 @@ public class ParameterKitTest extends Prepare { Assert.assertEquals(provider.getName(),"p1"); Assert.assertEquals("", provider.getValue()); } + + @Test + public void providers2Parameter() { + ParameterProvider[] parameters = new ParameterProvider[]{ + ParameterKit.newParameter("p1", 100), + ParameterKit.newParameter("p2", 200) + }; + Parameter [] result = new Parameter[]{ + new Parameter("p1", 100), + new Parameter("p2", 200) + }; + Assert.assertEquals(ParameterKit.providers2Parameter(parameters), result); + } } \ No newline at end of file diff --git a/src/test/java/com/fanruan/api/util/ArrayKitTest.java b/src/test/java/com/fanruan/api/util/ArrayKitTest.java index cfedded..054ae22 100644 --- a/src/test/java/com/fanruan/api/util/ArrayKitTest.java +++ b/src/test/java/com/fanruan/api/util/ArrayKitTest.java @@ -1,6 +1,9 @@ package com.fanruan.api.util; import com.fanruan.api.Prepare; +import java.util.*; + +import com.fr.third.org.apache.poi.hssf.record.formula.functions.Int; import org.junit.Assert; import org.junit.Test; @@ -97,4 +100,15 @@ public class ArrayKitTest extends Prepare { Assert.assertEquals(ArrayKit.addAll(longTestArray, 5L,6L), longTestResult); Assert.assertEquals(ArrayKit.addAll(shortTestArray, new Short("5"),new Short("6")), shortTestResult); } + + @Test + public void toList() throws Exception{ + Integer array[] = {1,2,3}; + ArrayList result = new ArrayList(); + result.add(1); + result.add(2); + result.add(3); + Assert.assertEquals(ArrayKit.toList(array),result); + } + } From e0f727939e5304dd627e40f9b51e94556b0be570 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Tue, 3 Sep 2019 19:45:55 +0800 Subject: [PATCH 6/6] =?UTF-8?q?update:=20=E5=8E=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/cal/ParameterKit.java | 8 -------- .../api/design/ui/editor/ValueEditors.java | 17 ++++++++++++++++- .../com/fanruan/api/cal/ParameterKitTest.java | 13 ------------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/fanruan/api/cal/ParameterKit.java b/src/main/java/com/fanruan/api/cal/ParameterKit.java index 67e316e..afb080d 100644 --- a/src/main/java/com/fanruan/api/cal/ParameterKit.java +++ b/src/main/java/com/fanruan/api/cal/ParameterKit.java @@ -109,12 +109,4 @@ public class ParameterKit { return ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps); } - /** - * 将ParameterProvider类型数组转换为Parameter类型数组 - * @param providers ParameterProvider类型数组 - * @return Parameter类型数组 - * */ - public static Parameter[] providers2Parameter(ParameterProvider[] providers) { - return Parameter.providers2Parameter(providers); - } } diff --git a/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java b/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java index 760464c..4dda75f 100644 --- a/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java +++ b/src/main/java/com/fanruan/api/design/ui/editor/ValueEditors.java @@ -4,7 +4,22 @@ import com.fanruan.api.design.DesignKit; import com.fanruan.api.design.ui.component.table.model.ParameterTableModel; import com.fanruan.api.util.StringKit; import com.fr.base.BaseFormula; -import com.fr.design.editor.editor.*; +import com.fr.design.editor.editor.BooleanEditor; +import com.fr.design.editor.editor.ColumnRowEditor; +import com.fr.design.editor.editor.ColumnRowGroupEditor; +import com.fr.design.editor.editor.ColumnSelectedEditor; +import com.fr.design.editor.editor.ConstantsEditor; +import com.fr.design.editor.editor.CursorEditor; +import com.fr.design.editor.editor.DateEditor; +import com.fr.design.editor.editor.DoubleEditor; +import com.fr.design.editor.editor.Editor; +import com.fr.design.editor.editor.FormulaEditor; +import com.fr.design.editor.editor.IntegerEditor; +import com.fr.design.editor.editor.NoneEditor; +import com.fr.design.editor.editor.ParameterEditor; +import com.fr.design.editor.editor.SpinnerIntegerEditor; +import com.fr.design.editor.editor.TextEditor; +import com.fr.design.editor.editor.WidgetNameEditor; import java.util.ArrayList; import java.util.Iterator; diff --git a/src/test/java/com/fanruan/api/cal/ParameterKitTest.java b/src/test/java/com/fanruan/api/cal/ParameterKitTest.java index 2b05a31..4093687 100644 --- a/src/test/java/com/fanruan/api/cal/ParameterKitTest.java +++ b/src/test/java/com/fanruan/api/cal/ParameterKitTest.java @@ -114,17 +114,4 @@ public class ParameterKitTest extends Prepare { Assert.assertEquals(provider.getName(),"p1"); Assert.assertEquals("", provider.getValue()); } - - @Test - public void providers2Parameter() { - ParameterProvider[] parameters = new ParameterProvider[]{ - ParameterKit.newParameter("p1", 100), - ParameterKit.newParameter("p2", 200) - }; - Parameter [] result = new Parameter[]{ - new Parameter("p1", 100), - new Parameter("p2", 200) - }; - Assert.assertEquals(ParameterKit.providers2Parameter(parameters), result); - } } \ No newline at end of file