From 64ea8befd0b2651a72c2b7ff439bd887ee1d2434 Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Thu, 5 Sep 2019 11:50:19 +0800 Subject: [PATCH 01/30] =?UTF-8?q?KERNEL-1198=20JSON=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=B3=A2FineKit=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/cal/Parameter.java | 4 ++++ .../com/fanruan/api/data/TableDataKit.java | 9 +++++++++ .../api/data/impl/NameDatabaseConnection.java | 11 +++++++++++ .../ui/component/UITableEditorPane.java | 17 +++++++++++++++++ .../ui/container/AbstractTableDataPane.java | 10 ++++++++++ .../design/ui/container/UISQLEditPane.java | 11 +++++++++++ .../com/fanruan/api/util/TemplateKit.java | 19 +++++++++++++++++++ 7 files changed, 81 insertions(+) create mode 100644 src/main/java/com/fanruan/api/cal/Parameter.java create mode 100644 src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java create mode 100644 src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java create mode 100644 src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java create mode 100644 src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java create mode 100644 src/main/java/com/fanruan/api/util/TemplateKit.java diff --git a/src/main/java/com/fanruan/api/cal/Parameter.java b/src/main/java/com/fanruan/api/cal/Parameter.java new file mode 100644 index 0000000..6375a76 --- /dev/null +++ b/src/main/java/com/fanruan/api/cal/Parameter.java @@ -0,0 +1,4 @@ +package com.fanruan.api.cal; + +public class Parameter extends com.fr.base.Parameter { +} diff --git a/src/main/java/com/fanruan/api/data/TableDataKit.java b/src/main/java/com/fanruan/api/data/TableDataKit.java index 333245f..90eacfb 100644 --- a/src/main/java/com/fanruan/api/data/TableDataKit.java +++ b/src/main/java/com/fanruan/api/data/TableDataKit.java @@ -3,6 +3,7 @@ package com.fanruan.api.data; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.api.TableDataAssist; +import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.file.TableDataConfig; import com.fr.script.Calculator; import com.fr.stable.script.CalculatorProvider; @@ -74,4 +75,12 @@ public class TableDataKit { public static void renameTableData(@NotNull String oldName, @NotNull String newName) { TableDataConfig.getInstance().renameTableData(oldName, newName); } + + /** + * 直接预览数据集,没有实际值和显示值 + * @param tableData 数据集 + */ + public static void previewTableData(TableData tableData) { + PreviewTablePane.previewTableData(tableData); + } } diff --git a/src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java b/src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java new file mode 100644 index 0000000..8751618 --- /dev/null +++ b/src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java @@ -0,0 +1,11 @@ +package com.fanruan.api.data.impl; + +/** + * 列表数据连接组件 + */ +public class NameDatabaseConnection extends com.fr.data.impl.NameDatabaseConnection { + public NameDatabaseConnection() { super();} + public NameDatabaseConnection(String name) { + super(name); + } +} diff --git a/src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java b/src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java new file mode 100644 index 0000000..2c6d5c3 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java @@ -0,0 +1,17 @@ +package com.fanruan.api.design.ui.component; + +import com.fr.design.gui.itableeditorpane.UITableModelAdapter; + +/** + * 表格编辑面板 + * @param + */ +public class UITableEditorPane extends com.fr.design.gui.itableeditorpane.UITableEditorPane { + public UITableEditorPane(UITableModelAdapter model){ + super(model); + } + + public UITableEditorPane(UITableModelAdapter model, String string){ + super(model, string); + } +} diff --git a/src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java b/src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java new file mode 100644 index 0000000..0ff1eab --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java @@ -0,0 +1,10 @@ +package com.fanruan.api.design.ui.container; + +import com.fr.base.TableData; + +/** + * 表格面板 + * @param + */ +public abstract class AbstractTableDataPane extends com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane { +} diff --git a/src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java b/src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java new file mode 100644 index 0000000..2113b93 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java @@ -0,0 +1,11 @@ +package com.fanruan.api.design.ui.container; + +/** + * SQL编辑面板 + */ +public class UISQLEditPane extends com.fr.design.data.datapane.sqlpane.SQLEditPane { + public UISQLEditPane(){ super();} + public UISQLEditPane(boolean bool) { + super(bool); + } +} diff --git a/src/main/java/com/fanruan/api/util/TemplateKit.java b/src/main/java/com/fanruan/api/util/TemplateKit.java new file mode 100644 index 0000000..1244c49 --- /dev/null +++ b/src/main/java/com/fanruan/api/util/TemplateKit.java @@ -0,0 +1,19 @@ +package com.fanruan.api.util; + +import com.fr.base.TemplateUtils; + +import java.util.Map; + +public class TemplateKit { + + /** + * 根据参数, 来计算文档字符串 + * @param tpl 文档来源 + * @param context 参数map + * @return 计算后结果 + * @throws Exception + */ + public static String renderParameter4Tpl(String tpl, Map context) throws Exception { + return TemplateUtils.renderParameter4Tpl(tpl, context); + } +} From 3f0d694707f040d545dc780197fda62c12f40bef Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Thu, 5 Sep 2019 14:28:18 +0800 Subject: [PATCH 02/30] =?UTF-8?q?KERNEL-1198=20=E6=B6=88=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/data/impl/NameDatabaseConnection.java | 11 ----------- .../ui/component/UITableEditorPane.java | 17 ----------------- .../ui/container/AbstractTableDataPane.java | 10 ---------- .../design/ui/container/UISQLEditPane.java | 11 ----------- .../com/fanruan/api/util/TemplateKit.java | 19 ------------------- 5 files changed, 68 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java delete mode 100644 src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java delete mode 100644 src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java delete mode 100644 src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java delete mode 100644 src/main/java/com/fanruan/api/util/TemplateKit.java diff --git a/src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java b/src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java deleted file mode 100644 index 8751618..0000000 --- a/src/main/java/com/fanruan/api/data/impl/NameDatabaseConnection.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fanruan.api.data.impl; - -/** - * 列表数据连接组件 - */ -public class NameDatabaseConnection extends com.fr.data.impl.NameDatabaseConnection { - public NameDatabaseConnection() { super();} - public NameDatabaseConnection(String name) { - super(name); - } -} diff --git a/src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java b/src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java deleted file mode 100644 index 2c6d5c3..0000000 --- a/src/main/java/com/fanruan/api/design/ui/component/UITableEditorPane.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fanruan.api.design.ui.component; - -import com.fr.design.gui.itableeditorpane.UITableModelAdapter; - -/** - * 表格编辑面板 - * @param - */ -public class UITableEditorPane extends com.fr.design.gui.itableeditorpane.UITableEditorPane { - public UITableEditorPane(UITableModelAdapter model){ - super(model); - } - - public UITableEditorPane(UITableModelAdapter model, String string){ - super(model, string); - } -} diff --git a/src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java b/src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java deleted file mode 100644 index 0ff1eab..0000000 --- a/src/main/java/com/fanruan/api/design/ui/container/AbstractTableDataPane.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.fanruan.api.design.ui.container; - -import com.fr.base.TableData; - -/** - * 表格面板 - * @param - */ -public abstract class AbstractTableDataPane extends com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane { -} diff --git a/src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java b/src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java deleted file mode 100644 index 2113b93..0000000 --- a/src/main/java/com/fanruan/api/design/ui/container/UISQLEditPane.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fanruan.api.design.ui.container; - -/** - * SQL编辑面板 - */ -public class UISQLEditPane extends com.fr.design.data.datapane.sqlpane.SQLEditPane { - public UISQLEditPane(){ super();} - public UISQLEditPane(boolean bool) { - super(bool); - } -} diff --git a/src/main/java/com/fanruan/api/util/TemplateKit.java b/src/main/java/com/fanruan/api/util/TemplateKit.java deleted file mode 100644 index 1244c49..0000000 --- a/src/main/java/com/fanruan/api/util/TemplateKit.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fanruan.api.util; - -import com.fr.base.TemplateUtils; - -import java.util.Map; - -public class TemplateKit { - - /** - * 根据参数, 来计算文档字符串 - * @param tpl 文档来源 - * @param context 参数map - * @return 计算后结果 - * @throws Exception - */ - public static String renderParameter4Tpl(String tpl, Map context) throws Exception { - return TemplateUtils.renderParameter4Tpl(tpl, context); - } -} From 852b32943a8258830ff167d0758ef3b3f8f0b7eb Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Fri, 6 Sep 2019 11:38:04 +0800 Subject: [PATCH 03/30] =?UTF-8?q?KERNEL-1198=20JSON=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/cal/Parameter.java | 4 ---- .../com/fanruan/api/cal/ParameterKit.java | 8 +++++++ .../fanruan/api/conf/ConfigurationKit.java | 10 +++++++++ .../fanruan/api/data/AbstractDataModel.java | 4 ++++ .../api/data/AbstractDatabaseConnection.java | 4 ++++ .../api/data/AbstractParameterTableData.java | 4 ++++ .../com/fanruan/api/net/http/EntityKit.java | 21 +++++++++++++++++++ .../net/http/message/BasicNameValuePair.java | 9 ++++++++ .../java/com/fanruan/api/util/CodeKit.java | 10 +++++++++ .../com/fanruan/api/util/ComparatorKit.java | 15 +++++++++++++ src/main/java/com/fanruan/api/xml/XmlKit.java | 16 +++++++++----- 11 files changed, 96 insertions(+), 9 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/cal/Parameter.java create mode 100644 src/main/java/com/fanruan/api/data/AbstractDataModel.java create mode 100644 src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java create mode 100644 src/main/java/com/fanruan/api/data/AbstractParameterTableData.java create mode 100644 src/main/java/com/fanruan/api/net/http/EntityKit.java create mode 100644 src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java create mode 100644 src/main/java/com/fanruan/api/util/ComparatorKit.java diff --git a/src/main/java/com/fanruan/api/cal/Parameter.java b/src/main/java/com/fanruan/api/cal/Parameter.java deleted file mode 100644 index 6375a76..0000000 --- a/src/main/java/com/fanruan/api/cal/Parameter.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.cal; - -public class Parameter extends com.fr.base.Parameter { -} diff --git a/src/main/java/com/fanruan/api/cal/ParameterKit.java b/src/main/java/com/fanruan/api/cal/ParameterKit.java index 471d9fe..c1e1b68 100644 --- a/src/main/java/com/fanruan/api/cal/ParameterKit.java +++ b/src/main/java/com/fanruan/api/cal/ParameterKit.java @@ -136,4 +136,12 @@ public class ParameterKit { return parameters; } + /** + * 将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/conf/ConfigurationKit.java b/src/main/java/com/fanruan/api/conf/ConfigurationKit.java index b433465..43625ed 100644 --- a/src/main/java/com/fanruan/api/conf/ConfigurationKit.java +++ b/src/main/java/com/fanruan/api/conf/ConfigurationKit.java @@ -1,5 +1,6 @@ package com.fanruan.api.conf; +import com.fr.config.ConfigContext; import com.fr.config.Configuration; import com.fr.config.holder.ConfigChangeListener; import com.fr.transaction.Configurations; @@ -38,4 +39,13 @@ public class ConfigurationKit { }); } + /** + * 返回config实例,且config实例只存在一个 + * @param configuration Configuration类 + * @param + * @return config实例 + */ + public static T getConfigInstance(final Class configuration) { + return ConfigContext.getConfigInstance(configuration); + } } diff --git a/src/main/java/com/fanruan/api/data/AbstractDataModel.java b/src/main/java/com/fanruan/api/data/AbstractDataModel.java new file mode 100644 index 0000000..7ee273f --- /dev/null +++ b/src/main/java/com/fanruan/api/data/AbstractDataModel.java @@ -0,0 +1,4 @@ +package com.fanruan.api.data; + +public abstract class AbstractDataModel extends com.fr.data.AbstractDataModel { +} diff --git a/src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java b/src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java new file mode 100644 index 0000000..925da74 --- /dev/null +++ b/src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java @@ -0,0 +1,4 @@ +package com.fanruan.api.data; + +public abstract class AbstractDatabaseConnection extends com.fr.data.impl.AbstractDatabaseConnection { +} diff --git a/src/main/java/com/fanruan/api/data/AbstractParameterTableData.java b/src/main/java/com/fanruan/api/data/AbstractParameterTableData.java new file mode 100644 index 0000000..23c1f05 --- /dev/null +++ b/src/main/java/com/fanruan/api/data/AbstractParameterTableData.java @@ -0,0 +1,4 @@ +package com.fanruan.api.data; + +public abstract class AbstractParameterTableData extends com.fr.data.AbstractParameterTableData { +} diff --git a/src/main/java/com/fanruan/api/net/http/EntityKit.java b/src/main/java/com/fanruan/api/net/http/EntityKit.java new file mode 100644 index 0000000..d1d7b3f --- /dev/null +++ b/src/main/java/com/fanruan/api/net/http/EntityKit.java @@ -0,0 +1,21 @@ +package com.fanruan.api.net.http; + +import com.fr.third.org.apache.http.HttpEntity; +import com.fr.third.org.apache.http.ParseException; +import com.fr.third.org.apache.http.util.EntityUtils; + +import java.io.IOException; + +public class EntityKit { + /** + * 利用defaultCharset字符集将HttpEntity对象转化为String对象 + * @param entity 需要转化为String的HttpEntity对象 + * @param defaultCharset 传入的字符集 + * @return HttpEntity对象转化为的String对象 + * @throws IOException + * @throws ParseException + */ + public static String toString(HttpEntity entity, String defaultCharset) throws IOException, ParseException { + return EntityUtils.toString(entity, defaultCharset); + } +} diff --git a/src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java b/src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java new file mode 100644 index 0000000..82ffb80 --- /dev/null +++ b/src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java @@ -0,0 +1,9 @@ +package com.fanruan.api.net.http.message; +/** + * 键值对类 + */ +public class BasicNameValuePair extends com.fr.third.org.apache.http.message.BasicNameValuePair { + public BasicNameValuePair(String name, String value) { + super(name, value); + } +} diff --git a/src/main/java/com/fanruan/api/util/CodeKit.java b/src/main/java/com/fanruan/api/util/CodeKit.java index b819eb4..5c89421 100644 --- a/src/main/java/com/fanruan/api/util/CodeKit.java +++ b/src/main/java/com/fanruan/api/util/CodeKit.java @@ -12,4 +12,14 @@ public class CodeKit { public static String passwordDecode(String passwordText) { return CodeUtils.passwordDecode(passwordText); } + + /** + * 将经过处理的中日韩文字符串解码成原先的中日韩文 + * @param text 经过处理的中日韩文字 + * @return 中日韩文字 + * @throws Exception + */ + public static String cjkDecode(String text) throws Exception { + return CodeUtils.cjkDecode(text); + } } diff --git a/src/main/java/com/fanruan/api/util/ComparatorKit.java b/src/main/java/com/fanruan/api/util/ComparatorKit.java new file mode 100644 index 0000000..39fddff --- /dev/null +++ b/src/main/java/com/fanruan/api/util/ComparatorKit.java @@ -0,0 +1,15 @@ +package com.fanruan.api.util; + +import com.fr.general.ComparatorUtils; + +public class ComparatorKit { + /** + * 比较两个Object对象是否相等 + * @param object1 第一个Object对象 + * @param object2 第二个Object对象 + * @return 相等返回True 不相等返回False + */ + public static boolean equals(Object object1, Object object2){ + return ComparatorUtils.equals(object1, object2); + } +} diff --git a/src/main/java/com/fanruan/api/xml/XmlKit.java b/src/main/java/com/fanruan/api/xml/XmlKit.java index 89de42a..bcc1ae0 100644 --- a/src/main/java/com/fanruan/api/xml/XmlKit.java +++ b/src/main/java/com/fanruan/api/xml/XmlKit.java @@ -3,11 +3,8 @@ package com.fanruan.api.xml; import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.impl.Connection; import com.fr.general.xml.GeneralXMLTools; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLReadable; -import com.fr.stable.xml.XMLTools; -import com.fr.stable.xml.XMLable; -import com.fr.stable.xml.XMLableReader; +import com.fr.stable.ParameterProvider; +import com.fr.stable.xml.*; import java.io.InputStream; @@ -76,4 +73,13 @@ public class XmlKit { DataCoreXmlUtils.writeXMLConnection(writer, connection); } + /** + *读出xml参数 + * @param reader xml读出对象 + * @return 返回保存参数数组 + */ + public static ParameterProvider readParameter(XMLableReader reader) { + return StableXMLUtils.readParameter(reader); + } + } From 056141604d2ff53eff0dc26e4509c582c8476a00 Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Fri, 6 Sep 2019 11:55:52 +0800 Subject: [PATCH 04/30] =?UTF-8?q?KERNEL-1198=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 --- .../com/fanruan/api/cal/ParameterKit.java | 9 ---- .../fanruan/api/conf/ConfigurationKit.java | 51 ------------------- 2 files changed, 60 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/conf/ConfigurationKit.java diff --git a/src/main/java/com/fanruan/api/cal/ParameterKit.java b/src/main/java/com/fanruan/api/cal/ParameterKit.java index c1e1b68..388726f 100644 --- a/src/main/java/com/fanruan/api/cal/ParameterKit.java +++ b/src/main/java/com/fanruan/api/cal/ParameterKit.java @@ -135,13 +135,4 @@ public class ParameterKit { return parameters; } - - /** - * 将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/conf/ConfigurationKit.java b/src/main/java/com/fanruan/api/conf/ConfigurationKit.java deleted file mode 100644 index 43625ed..0000000 --- a/src/main/java/com/fanruan/api/conf/ConfigurationKit.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fanruan.api.conf; - -import com.fr.config.ConfigContext; -import com.fr.config.Configuration; -import com.fr.config.holder.ConfigChangeListener; -import com.fr.transaction.Configurations; -import com.fr.transaction.ValidateProxy; -import com.fr.transaction.WorkerFacade; - -/** - * @author richie - * @version 10.0 - * Created by richie on 2019-08-30 - * 配置监听管理器 - */ -public class ConfigurationKit { - - /** - * 注册监听配置变化的监听器 - * - * @param listener 监听器 - */ - public static void registerListener(ConfigChangeListener listener) { - ValidateProxy.getInstance().getValidateManager().registerListener(listener); - } - - /** - * 保存配置 - * - * @param type 配置的类型 - * @param action 保存动作 - */ - public static void modify(Class type, Runner action) { - Configurations.modify(new WorkerFacade(type) { - @Override - public void run() { - action.run(); - } - }); - } - - /** - * 返回config实例,且config实例只存在一个 - * @param configuration Configuration类 - * @param - * @return config实例 - */ - public static T getConfigInstance(final Class configuration) { - return ConfigContext.getConfigInstance(configuration); - } -} From d77dbffebf653c6df3db8cef89136bec7190ac92 Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 6 Sep 2019 16:00:56 +0800 Subject: [PATCH 05/30] =?UTF-8?q?ignore=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bce210c..71cf645 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ .idea/ target/ .DS_Store -.class_path +.classpath *.jar \ No newline at end of file From 3bc58139f8f40d92adbcd73348420df1b27fc977 Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Sat, 7 Sep 2019 08:36:18 +0800 Subject: [PATCH 06/30] =?UTF-8?q?KERNEL-1198=20=E5=8E=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E4=BF=AE=E6=94=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/data/AbstractDataModel.java | 4 ---- .../api/data/AbstractDatabaseConnection.java | 4 ---- .../api/data/AbstractParameterTableData.java | 4 ---- .../com/fanruan/api/data/TableDataKit.java | 7 ------- .../com/fanruan/api/net/http/EntityKit.java | 21 ------------------- .../net/http/message/BasicNameValuePair.java | 9 -------- .../com/fanruan/api/util/ComparatorKit.java | 15 ------------- src/main/java/com/fanruan/api/xml/XmlKit.java | 7 ++++++- 8 files changed, 6 insertions(+), 65 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/data/AbstractDataModel.java delete mode 100644 src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java delete mode 100644 src/main/java/com/fanruan/api/data/AbstractParameterTableData.java delete mode 100644 src/main/java/com/fanruan/api/net/http/EntityKit.java delete mode 100644 src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java delete mode 100644 src/main/java/com/fanruan/api/util/ComparatorKit.java diff --git a/src/main/java/com/fanruan/api/data/AbstractDataModel.java b/src/main/java/com/fanruan/api/data/AbstractDataModel.java deleted file mode 100644 index 7ee273f..0000000 --- a/src/main/java/com/fanruan/api/data/AbstractDataModel.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.data; - -public abstract class AbstractDataModel extends com.fr.data.AbstractDataModel { -} diff --git a/src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java b/src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java deleted file mode 100644 index 925da74..0000000 --- a/src/main/java/com/fanruan/api/data/AbstractDatabaseConnection.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.data; - -public abstract class AbstractDatabaseConnection extends com.fr.data.impl.AbstractDatabaseConnection { -} diff --git a/src/main/java/com/fanruan/api/data/AbstractParameterTableData.java b/src/main/java/com/fanruan/api/data/AbstractParameterTableData.java deleted file mode 100644 index 23c1f05..0000000 --- a/src/main/java/com/fanruan/api/data/AbstractParameterTableData.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.data; - -public abstract class AbstractParameterTableData extends com.fr.data.AbstractParameterTableData { -} diff --git a/src/main/java/com/fanruan/api/data/TableDataKit.java b/src/main/java/com/fanruan/api/data/TableDataKit.java index 90eacfb..955bc32 100644 --- a/src/main/java/com/fanruan/api/data/TableDataKit.java +++ b/src/main/java/com/fanruan/api/data/TableDataKit.java @@ -76,11 +76,4 @@ public class TableDataKit { TableDataConfig.getInstance().renameTableData(oldName, newName); } - /** - * 直接预览数据集,没有实际值和显示值 - * @param tableData 数据集 - */ - public static void previewTableData(TableData tableData) { - PreviewTablePane.previewTableData(tableData); - } } diff --git a/src/main/java/com/fanruan/api/net/http/EntityKit.java b/src/main/java/com/fanruan/api/net/http/EntityKit.java deleted file mode 100644 index d1d7b3f..0000000 --- a/src/main/java/com/fanruan/api/net/http/EntityKit.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fanruan.api.net.http; - -import com.fr.third.org.apache.http.HttpEntity; -import com.fr.third.org.apache.http.ParseException; -import com.fr.third.org.apache.http.util.EntityUtils; - -import java.io.IOException; - -public class EntityKit { - /** - * 利用defaultCharset字符集将HttpEntity对象转化为String对象 - * @param entity 需要转化为String的HttpEntity对象 - * @param defaultCharset 传入的字符集 - * @return HttpEntity对象转化为的String对象 - * @throws IOException - * @throws ParseException - */ - public static String toString(HttpEntity entity, String defaultCharset) throws IOException, ParseException { - return EntityUtils.toString(entity, defaultCharset); - } -} diff --git a/src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java b/src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java deleted file mode 100644 index 82ffb80..0000000 --- a/src/main/java/com/fanruan/api/net/http/message/BasicNameValuePair.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fanruan.api.net.http.message; -/** - * 键值对类 - */ -public class BasicNameValuePair extends com.fr.third.org.apache.http.message.BasicNameValuePair { - public BasicNameValuePair(String name, String value) { - super(name, value); - } -} diff --git a/src/main/java/com/fanruan/api/util/ComparatorKit.java b/src/main/java/com/fanruan/api/util/ComparatorKit.java deleted file mode 100644 index 39fddff..0000000 --- a/src/main/java/com/fanruan/api/util/ComparatorKit.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fanruan.api.util; - -import com.fr.general.ComparatorUtils; - -public class ComparatorKit { - /** - * 比较两个Object对象是否相等 - * @param object1 第一个Object对象 - * @param object2 第二个Object对象 - * @return 相等返回True 不相等返回False - */ - public static boolean equals(Object object1, Object object2){ - return ComparatorUtils.equals(object1, object2); - } -} diff --git a/src/main/java/com/fanruan/api/xml/XmlKit.java b/src/main/java/com/fanruan/api/xml/XmlKit.java index bcc1ae0..dc2cfc1 100644 --- a/src/main/java/com/fanruan/api/xml/XmlKit.java +++ b/src/main/java/com/fanruan/api/xml/XmlKit.java @@ -4,7 +4,12 @@ import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.impl.Connection; import com.fr.general.xml.GeneralXMLTools; import com.fr.stable.ParameterProvider; -import com.fr.stable.xml.*; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLable; +import com.fr.stable.xml.XMLableReader; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.StableXMLUtils; import java.io.InputStream; From c4076bda6c48e61712cf8f31e072f92b9d3164fb Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Sat, 7 Sep 2019 13:05:55 +0800 Subject: [PATCH 07/30] =?UTF-8?q?KERNEL-1198=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 --- src/main/java/com/fanruan/api/data/TableDataKit.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/fanruan/api/data/TableDataKit.java b/src/main/java/com/fanruan/api/data/TableDataKit.java index 955bc32..63a7d91 100644 --- a/src/main/java/com/fanruan/api/data/TableDataKit.java +++ b/src/main/java/com/fanruan/api/data/TableDataKit.java @@ -3,7 +3,6 @@ package com.fanruan.api.data; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.api.TableDataAssist; -import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.file.TableDataConfig; import com.fr.script.Calculator; import com.fr.stable.script.CalculatorProvider; From 635e03f693adc5933f3cafd925083c63ef7a5fca Mon Sep 17 00:00:00 2001 From: Palin Date: Sat, 7 Sep 2019 13:25:39 +0800 Subject: [PATCH 08/30] =?UTF-8?q?finkit=E5=88=9D=E6=AC=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/design/ui/container/ReportletPane.java | 4 ++++ .../com/fanruan/api/err/ValidationException.java | 4 ++++ .../java/com/fanruan/api/function/FunctionKit.java | 6 ++++++ src/main/java/com/fanruan/api/net/NetworkKit.java | 6 ++++++ .../java/com/fanruan/api/newer/NodeVisitor.java | 4 ++++ .../com/fanruan/api/newer/RHFunctionProcessor.java | 4 ++++ .../fanruan/api/newer/TemplateSessionIDInfo.java | 4 ++++ src/main/java/com/fanruan/api/util/RenderKit.java | 13 +++++++++++++ 8 files changed, 45 insertions(+) create mode 100644 src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java create mode 100644 src/main/java/com/fanruan/api/err/ValidationException.java create mode 100644 src/main/java/com/fanruan/api/newer/NodeVisitor.java create mode 100644 src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java create mode 100644 src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java diff --git a/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java b/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java new file mode 100644 index 0000000..4337dcd --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java @@ -0,0 +1,4 @@ +package com.fanruan.api.design.ui.container; + +public class ReportletPane extends com.fr.design.gui.itree.filetree.ReportletPane { +} diff --git a/src/main/java/com/fanruan/api/err/ValidationException.java b/src/main/java/com/fanruan/api/err/ValidationException.java new file mode 100644 index 0000000..1d8fcad --- /dev/null +++ b/src/main/java/com/fanruan/api/err/ValidationException.java @@ -0,0 +1,4 @@ +package com.fanruan.api.err; + +public abstract class ValidationException extends com.fr.design.Exception.ValidationException { +} diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index 68eaa19..adb5419 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -7,6 +7,7 @@ import com.fr.file.FunctionManager; import com.fr.file.FunctionManagerProvider; import com.fr.script.Calculator; import com.fr.stable.StringUtils; +import com.fr.stable.fun.FunctionHelper; import com.fr.stable.script.FunctionDef; import java.util.ArrayList; @@ -84,4 +85,9 @@ public class FunctionKit { public static com.fr.file.FunctionManager getInstance() { return com.fr.file.FunctionManager.getInstance(); } + + public static int generateFunctionID(String var0) { + return FunctionHelper.generateFunctionID(var0); + } + } \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/net/NetworkKit.java b/src/main/java/com/fanruan/api/net/NetworkKit.java index d534934..ebc52ef 100644 --- a/src/main/java/com/fanruan/api/net/NetworkKit.java +++ b/src/main/java/com/fanruan/api/net/NetworkKit.java @@ -1,5 +1,6 @@ package com.fanruan.api.net; +import com.fr.base.ServerConfig; import com.fr.data.NetworkHelper; import org.jetbrains.annotations.Nullable; @@ -117,4 +118,9 @@ public class NetworkKit { public static @Nullable String getHTTPRequestParameter(HttpServletRequest req, String... paraNames) { return NetworkHelper.getHTTPRequestParameter(req, paraNames); } + + + public static String createServletURL(HttpServletRequest req) { + return NetworkHelper.createServletURL(req, ServerConfig.getInstance().getServletName()); + } } diff --git a/src/main/java/com/fanruan/api/newer/NodeVisitor.java b/src/main/java/com/fanruan/api/newer/NodeVisitor.java new file mode 100644 index 0000000..3abc52c --- /dev/null +++ b/src/main/java/com/fanruan/api/newer/NodeVisitor.java @@ -0,0 +1,4 @@ +package com.fanruan.api.newer; + +public abstract class NodeVisitor extends com.fr.stable.core.NodeVisitor { +} diff --git a/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java b/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java new file mode 100644 index 0000000..374e5cf --- /dev/null +++ b/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java @@ -0,0 +1,4 @@ +package com.fanruan.api.newer; + +public abstract class RHFunctionProcessor extends com.fr.plugin.form.widget.monitor.RHFunctionProcessor { +} diff --git a/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java new file mode 100644 index 0000000..160fdcd --- /dev/null +++ b/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java @@ -0,0 +1,4 @@ +package com.fanruan.api.newer; + +public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo { +} diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index 3858679..cf5311c 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -1,6 +1,7 @@ package com.fanruan.api.util; import com.fr.base.TemplateUtils; +import com.fr.script.Calculator; import java.util.Map; @@ -19,4 +20,16 @@ public class RenderKit { public static String renderParameter4Tpl(String text, Map map) throws Exception { return TemplateUtils.renderParameter4Tpl(text, map); } + + /** + * 根据参数, 来计算文档字符串 + * @param var0 待渲染的文本模板 + * @param var1 参数集合 + * @return 返回渲染后的文本 + * @throws Exception 渲染过程中出现错误则抛出此异常 + */ + public static String render(String var0, Calculator var1) throws Exception { + return TemplateUtils.render(var0, var1); + } + } From fc36f997c76474ba8ae2d6ba81cce4d50f24b81f Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Mon, 9 Sep 2019 14:22:03 +0800 Subject: [PATCH 09/30] =?UTF-8?q?KERNEL-1198=20=E6=96=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/util/CodeKitTest.java | 14 +++++++ .../java/com/fanruan/api/xml/XmlKitTest.java | 38 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/test/java/com/fanruan/api/xml/XmlKitTest.java diff --git a/src/test/java/com/fanruan/api/util/CodeKitTest.java b/src/test/java/com/fanruan/api/util/CodeKitTest.java index 10853e6..5224324 100644 --- a/src/test/java/com/fanruan/api/util/CodeKitTest.java +++ b/src/test/java/com/fanruan/api/util/CodeKitTest.java @@ -1,5 +1,6 @@ package com.fanruan.api.util; +import com.fr.stable.CodeUtils; import com.fr.stable.CommonCodeUtils; import org.junit.Assert; import org.junit.Test; @@ -9,4 +10,17 @@ public class CodeKitTest { public void passwordDecode(String passwordText) { Assert.assertEquals(CodeKit.passwordDecode(passwordText), 123); } + + @Test + public void cjkDecode() { + String s = "中文 한글 日本語"; + String encode = CodeUtils.cjkEncode(s); + + try { + String decode = CodeKit.cjkDecode(encode); + Assert.assertTrue(s.equals(decode)); + } catch (Exception e) { + + } + } } diff --git a/src/test/java/com/fanruan/api/xml/XmlKitTest.java b/src/test/java/com/fanruan/api/xml/XmlKitTest.java new file mode 100644 index 0000000..2c33d4d --- /dev/null +++ b/src/test/java/com/fanruan/api/xml/XmlKitTest.java @@ -0,0 +1,38 @@ +package com.fanruan.api.xml; + +import com.fr.base.Parameter; +import com.fr.base.TableData; +import com.fr.plugin.db.json.core.JSONTableData; +import com.fr.stable.ParameterProvider; +import com.fr.stable.bridge.StableFactory; +import com.fr.stable.xml.StableXMLUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLUtils; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.javax.xml.stream.XMLStreamException; +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class XmlKitTest { + + @Test + public void readParameter() { + try { + XMLableReader xml = XMLableReader.createXMLableReader("\n" + + "\n" + + "Tove\n" + + "Jani\n" + + "Reminder\n" + + "Don't forget me this weekend!\n" + + ""); + Parameter parameter = new Parameter("test", 1); + StableFactory.registerXMLDescription("Parameter",parameter); + Parameter p = (Parameter)XmlKit.readParameter(xml); + Assert.assertTrue(p.getName().equals("test")); + } catch (XMLStreamException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file From 161ff0ba486182a12fe77cd3e031582d3eb33105 Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 9 Sep 2019 17:10:00 +0800 Subject: [PATCH 10/30] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/conf/HolderKit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/fanruan/api/conf/HolderKit.java b/src/main/java/com/fanruan/api/conf/HolderKit.java index 16b3ee4..323ceb3 100644 --- a/src/main/java/com/fanruan/api/conf/HolderKit.java +++ b/src/main/java/com/fanruan/api/conf/HolderKit.java @@ -1,11 +1,11 @@ package com.fanruan.api.conf; +import com.fanruan.api.conf.impl.ColConf; import com.fanruan.api.conf.impl.ObjConf; import com.fanruan.api.conf.impl.ObjectColConf; import com.fanruan.api.conf.impl.ObjectMapConf; import com.fanruan.api.conf.impl.SimConf; import com.fr.config.holder.Conf; -import com.fr.config.holder.impl.ColConf; import java.util.Collection; import java.util.Map; From 161206536e8d6dc02a56fd664f8d79254c339b60 Mon Sep 17 00:00:00 2001 From: Palin Date: Mon, 9 Sep 2019 23:40:26 +0800 Subject: [PATCH 11/30] =?UTF-8?q?=E6=8C=89=E8=A6=81=E6=B1=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/{ui/container => work}/ReportletPane.java | 2 +- .../java/com/fanruan/api/err/ValidationException.java | 5 ++++- .../java/com/fanruan/api/function/FunctionKit.java | 9 +++++++-- src/main/java/com/fanruan/api/newer/NodeVisitor.java | 4 ---- .../com/fanruan/api/newer/RHFunctionProcessor.java | 4 ---- .../com/fanruan/api/newer/TemplateSessionIDInfo.java | 4 ---- .../com/fanruan/api/report/TemplateSessionIDInfo.java | 9 +++++++++ .../com/fanruan/api/report/analy/data/NodeVisitor.java | 4 ++++ src/main/java/com/fanruan/api/util/RenderKit.java | 8 ++++---- src/test/java/com/fanruan/api/util/RenderKitTest.java | 10 +++++++++- 10 files changed, 38 insertions(+), 21 deletions(-) rename src/main/java/com/fanruan/api/design/{ui/container => work}/ReportletPane.java (66%) delete mode 100644 src/main/java/com/fanruan/api/newer/NodeVisitor.java delete mode 100644 src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java delete mode 100644 src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java create mode 100644 src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java create mode 100644 src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java diff --git a/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java b/src/main/java/com/fanruan/api/design/work/ReportletPane.java similarity index 66% rename from src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java rename to src/main/java/com/fanruan/api/design/work/ReportletPane.java index 4337dcd..4671429 100644 --- a/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java +++ b/src/main/java/com/fanruan/api/design/work/ReportletPane.java @@ -1,4 +1,4 @@ -package com.fanruan.api.design.ui.container; +package com.fanruan.api.design.work; public class ReportletPane extends com.fr.design.gui.itree.filetree.ReportletPane { } diff --git a/src/main/java/com/fanruan/api/err/ValidationException.java b/src/main/java/com/fanruan/api/err/ValidationException.java index 1d8fcad..7da52c4 100644 --- a/src/main/java/com/fanruan/api/err/ValidationException.java +++ b/src/main/java/com/fanruan/api/err/ValidationException.java @@ -1,4 +1,7 @@ package com.fanruan.api.err; -public abstract class ValidationException extends com.fr.design.Exception.ValidationException { +/** + * 验证异常 + */ +public class ValidationException extends com.fr.design.Exception.ValidationException { } diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index adb5419..3aa6971 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -78,6 +78,7 @@ public class FunctionKit { return new NameAndDescription[0]; } + /** * 得到函数管理器实例 * @return 函数管理器 @@ -86,8 +87,12 @@ public class FunctionKit { return com.fr.file.FunctionManager.getInstance(); } - public static int generateFunctionID(String var0) { - return FunctionHelper.generateFunctionID(var0); + /** + * 得到函数标识 + * @return 函数标识 + */ + public static int generateFunctionID(String string) { + return FunctionHelper.generateFunctionID(string); } } \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/newer/NodeVisitor.java b/src/main/java/com/fanruan/api/newer/NodeVisitor.java deleted file mode 100644 index 3abc52c..0000000 --- a/src/main/java/com/fanruan/api/newer/NodeVisitor.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.newer; - -public abstract class NodeVisitor extends com.fr.stable.core.NodeVisitor { -} diff --git a/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java b/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java deleted file mode 100644 index 374e5cf..0000000 --- a/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.newer; - -public abstract class RHFunctionProcessor extends com.fr.plugin.form.widget.monitor.RHFunctionProcessor { -} diff --git a/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java deleted file mode 100644 index 160fdcd..0000000 --- a/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.newer; - -public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo { -} diff --git a/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java new file mode 100644 index 0000000..0a8e8cd --- /dev/null +++ b/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java @@ -0,0 +1,9 @@ +package com.fanruan.api.report; + +/** + * @author Palin + * @version 10.0 + * Created by Palin on 2019/9/9 0009 + */ +public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo{ +} diff --git a/src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java b/src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java new file mode 100644 index 0000000..4029665 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java @@ -0,0 +1,4 @@ +package com.fanruan.api.report.analy.data; + +public abstract class NodeVisitor extends com.fr.stable.core.NodeVisitor { +} diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index cf5311c..653aab7 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -23,13 +23,13 @@ public class RenderKit { /** * 根据参数, 来计算文档字符串 - * @param var0 待渲染的文本模板 - * @param var1 参数集合 + * @param string 待渲染的文本模板 + * @param calculator 参数集合 * @return 返回渲染后的文本 * @throws Exception 渲染过程中出现错误则抛出此异常 */ - public static String render(String var0, Calculator var1) throws Exception { - return TemplateUtils.render(var0, var1); + public static String render(String string, Calculator calculator) throws Exception { + return TemplateUtils.render(string, calculator); } } diff --git a/src/test/java/com/fanruan/api/util/RenderKitTest.java b/src/test/java/com/fanruan/api/util/RenderKitTest.java index 4c53c41..78b498b 100644 --- a/src/test/java/com/fanruan/api/util/RenderKitTest.java +++ b/src/test/java/com/fanruan/api/util/RenderKitTest.java @@ -25,4 +25,12 @@ public class RenderKitTest extends Prepare { String text = "${name} is ${age} years old, he earned ${salary} dollars per month."; Assert.assertEquals("Alex is 20 years old, he earned 100 dollars per month.", RenderKit.renderParameter4Tpl(text, map)); } -} \ No newline at end of file + + @Test + public void render() throws Exception{ + String string = new String("a"); + Calculator calculator = new Calculator("b"); + Assert.assertEquals("a", RenderKit.render(string)); + Assert.assertEquals("b", RenderKit.render(calculator)); + } +} From 6d87a273a4c12a14cbbaa3e87d356418ee80ce6d Mon Sep 17 00:00:00 2001 From: Palin Date: Tue, 10 Sep 2019 14:10:27 +0800 Subject: [PATCH 12/30] =?UTF-8?q?=E5=86=8D=E6=AC=A1=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/function/FunctionKit.java | 9 --------- src/main/java/com/fanruan/api/util/RenderKit.java | 10 ++++++---- .../java/com/fanruan/api/util/RenderKitTest.java | 13 ++++++------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index 3aa6971..f9fccef 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -7,7 +7,6 @@ import com.fr.file.FunctionManager; import com.fr.file.FunctionManagerProvider; import com.fr.script.Calculator; import com.fr.stable.StringUtils; -import com.fr.stable.fun.FunctionHelper; import com.fr.stable.script.FunctionDef; import java.util.ArrayList; @@ -87,12 +86,4 @@ public class FunctionKit { return com.fr.file.FunctionManager.getInstance(); } - /** - * 得到函数标识 - * @return 函数标识 - */ - public static int generateFunctionID(String string) { - return FunctionHelper.generateFunctionID(string); - } - } \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index 653aab7..bd5d003 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -2,7 +2,9 @@ package com.fanruan.api.util; import com.fr.base.TemplateUtils; import com.fr.script.Calculator; +import com.fr.stable.script.CalculatorProvider; +import java.util.Collections; import java.util.Map; /** @@ -23,13 +25,13 @@ public class RenderKit { /** * 根据参数, 来计算文档字符串 - * @param string 待渲染的文本模板 - * @param calculator 参数集合 + * @param s 待渲染的文本模板 + * @param c 参数集合 * @return 返回渲染后的文本 * @throws Exception 渲染过程中出现错误则抛出此异常 */ - public static String render(String string, Calculator calculator) throws Exception { - return TemplateUtils.render(string, calculator); + public static String render(String s, Calculator c) throws Exception { + return TemplateUtils.render(s, c); } } diff --git a/src/test/java/com/fanruan/api/util/RenderKitTest.java b/src/test/java/com/fanruan/api/util/RenderKitTest.java index 78b498b..6946f6a 100644 --- a/src/test/java/com/fanruan/api/util/RenderKitTest.java +++ b/src/test/java/com/fanruan/api/util/RenderKitTest.java @@ -1,13 +1,12 @@ package com.fanruan.api.util; import com.fanruan.api.Prepare; +import com.fr.script.Calculator; import org.junit.Assert; import org.junit.Test; - import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.*; /** * @author richie @@ -28,9 +27,9 @@ public class RenderKitTest extends Prepare { @Test public void render() throws Exception{ - String string = new String("a"); - Calculator calculator = new Calculator("b"); - Assert.assertEquals("a", RenderKit.render(string)); - Assert.assertEquals("b", RenderKit.render(calculator)); - } + Calculator c = Calculator.createCalculator(); + String s = "abc${p1}xyz${p2}"; + Assert.assertEquals("abc1xyz2", RenderKit.render(s,c)); +} + } From 6cb16987e524cb05388d46b72f4de29c42efffe2 Mon Sep 17 00:00:00 2001 From: Palin Date: Wed, 11 Sep 2019 13:46:10 +0800 Subject: [PATCH 13/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/function/FunctionKit.java | 1 - src/test/java/com/fanruan/api/util/RenderKitTest.java | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index f9fccef..227cb25 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -77,7 +77,6 @@ public class FunctionKit { return new NameAndDescription[0]; } - /** * 得到函数管理器实例 * @return 函数管理器 diff --git a/src/test/java/com/fanruan/api/util/RenderKitTest.java b/src/test/java/com/fanruan/api/util/RenderKitTest.java index 6946f6a..a705166 100644 --- a/src/test/java/com/fanruan/api/util/RenderKitTest.java +++ b/src/test/java/com/fanruan/api/util/RenderKitTest.java @@ -28,8 +28,11 @@ public class RenderKitTest extends Prepare { @Test public void render() throws Exception{ Calculator c = Calculator.createCalculator(); - String s = "abc${p1}xyz${p2}"; - Assert.assertEquals("abc1xyz2", RenderKit.render(s,c)); -} + Map map = new HashMap<>(); + map.put("p1",1); + map.put("p2",2); + String s = "abc${p1}xyz${p2}"; + Assert.assertEquals("abcxyz", RenderKit.render(s,c)); + } } From b70cb2aa5336a84eb6289ab15fdf35ceef5ae707 Mon Sep 17 00:00:00 2001 From: Palin Date: Wed, 11 Sep 2019 14:48:47 +0800 Subject: [PATCH 14/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/function/FunctionKit.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index 227cb25..7c5d03e 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -7,6 +7,7 @@ import com.fr.file.FunctionManager; import com.fr.file.FunctionManagerProvider; import com.fr.script.Calculator; import com.fr.stable.StringUtils; +import com.fr.stable.fun.FunctionHelper; import com.fr.stable.script.FunctionDef; import java.util.ArrayList; @@ -85,4 +86,12 @@ public class FunctionKit { return com.fr.file.FunctionManager.getInstance(); } + /** + * 根据插件ID生成整数类型的标识符 + * @param stringID + * @return + */ + public static int generateFunctionID(String stringID) { + return FunctionHelper.generateFunctionID(stringID); + } } \ No newline at end of file From 4e4a3250a5a3e90a89f0b1860346028e60fd98d2 Mon Sep 17 00:00:00 2001 From: Palin Date: Thu, 12 Sep 2019 09:11:39 +0800 Subject: [PATCH 15/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0jar=E9=87=8D=E8=BD=BD?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/report/TemplateSessionIDInfo.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java diff --git a/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java deleted file mode 100644 index 0a8e8cd..0000000 --- a/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fanruan.api.report; - -/** - * @author Palin - * @version 10.0 - * Created by Palin on 2019/9/9 0009 - */ -public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo{ -} From 007b31f99233cdfa46c5e8f9eec4b2fd348c0eed Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 12 Sep 2019 12:42:59 +0800 Subject: [PATCH 16/30] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/report/form/BaseWidget.java | 30 +++++++ .../form/CustomWriteAbleRepeatEditor.java | 10 --- .../api/report/form/category/TextWidget.java | 64 ++++++++++++++ .../form/describer/EditTextDescriber.java | 78 +++++++++++++++++ .../form/describer/RepeatDescriber.java | 51 ++++++++++++ .../report/form/describer/TextDescriber.java | 83 +++++++++++++++++++ 6 files changed, 306 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/fanruan/api/report/form/BaseWidget.java delete mode 100644 src/main/java/com/fanruan/api/report/form/CustomWriteAbleRepeatEditor.java create mode 100644 src/main/java/com/fanruan/api/report/form/category/TextWidget.java create mode 100644 src/main/java/com/fanruan/api/report/form/describer/EditTextDescriber.java create mode 100644 src/main/java/com/fanruan/api/report/form/describer/RepeatDescriber.java create mode 100644 src/main/java/com/fanruan/api/report/form/describer/TextDescriber.java diff --git a/src/main/java/com/fanruan/api/report/form/BaseWidget.java b/src/main/java/com/fanruan/api/report/form/BaseWidget.java new file mode 100644 index 0000000..c9100c2 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/form/BaseWidget.java @@ -0,0 +1,30 @@ +package com.fanruan.api.report.form; + +import com.fr.data.act.Describer; +import com.fr.form.ui.Widget; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.script.Calculator; +import com.fr.stable.core.NodeVisitor; +import com.fr.stable.web.Repository; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + * 控件的插件接口 + */ +public abstract class BaseWidget extends Widget implements Describer { + + @Override + public boolean isEditor() { + return false; + } + + @Override + public JSONObject createJSONConfig(Repository repository, Calculator calculator, NodeVisitor nodeVisitor) throws JSONException { + JSONObject jo = super.createJSONConfig(repository, calculator, nodeVisitor); + mixinJSON(repository, calculator, jo); + return jo; + } +} diff --git a/src/main/java/com/fanruan/api/report/form/CustomWriteAbleRepeatEditor.java b/src/main/java/com/fanruan/api/report/form/CustomWriteAbleRepeatEditor.java deleted file mode 100644 index 42de2d0..0000000 --- a/src/main/java/com/fanruan/api/report/form/CustomWriteAbleRepeatEditor.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.fanruan.api.report.form; - -/** - * 允许自定义值的、允许直接编辑的、带重复的 --- 下拉框 下拉复选框 下拉树 - * @author Kalven - * @version 10.0 - * Created by Kalven on 2019/9/4 - */ -public abstract class CustomWriteAbleRepeatEditor extends com.fr.form.ui.CustomWriteAbleRepeatEditor { -} diff --git a/src/main/java/com/fanruan/api/report/form/category/TextWidget.java b/src/main/java/com/fanruan/api/report/form/category/TextWidget.java new file mode 100644 index 0000000..4caab03 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/form/category/TextWidget.java @@ -0,0 +1,64 @@ +package com.fanruan.api.report.form.category; + +import com.fanruan.api.report.form.BaseWidget; +import com.fanruan.api.report.form.describer.TextDescriber; +import com.fanruan.api.util.ArrayKit; +import com.fanruan.api.xml.XmlKit; +import com.fr.stable.script.CalculatorProvider; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + */ +public abstract class TextWidget extends BaseWidget { + + private TextDescriber textDescriber; + + /** + * 获取联动参数 + * + * @param c 当前算子 + * @return 放回当前控件依赖的参数 + */ + public String[] dependence(CalculatorProvider c) { + return ArrayKit.EMPTY_STRING_ARRAY; + } + + /** + * 获取支持的事件 + * + * @return 当前控件支持的事件 + */ + public String[] supportedEvents() { + return new String[]{AFTERINIT, BEFOREEDIT, AFTEREDIT, STOPEDIT}; + } + + @Override + public void readXML(XMLableReader reader) { + if (reader.isChildNode()) { + String tagName = reader.getTagName(); + if (TextDescriber.XML_TAG.equals(tagName)) { + textDescriber = (TextDescriber) XmlKit.readXMLable(reader); + } + } + } + + @Override + public void writeXML(XMLPrintWriter writer) { + if (textDescriber != null) { + XmlKit.writeXMLable(writer, textDescriber, TextDescriber.XML_TAG); + } + } + + @Override + public Object clone() throws CloneNotSupportedException { + TextWidget cloned = (TextWidget) super.clone(); + if (textDescriber != null) { + cloned.textDescriber = (TextDescriber) textDescriber.clone(); + } + return cloned; + } +} diff --git a/src/main/java/com/fanruan/api/report/form/describer/EditTextDescriber.java b/src/main/java/com/fanruan/api/report/form/describer/EditTextDescriber.java new file mode 100644 index 0000000..1b01cfb --- /dev/null +++ b/src/main/java/com/fanruan/api/report/form/describer/EditTextDescriber.java @@ -0,0 +1,78 @@ +package com.fanruan.api.report.form.describer; + +import com.fanruan.api.cal.FormulaKit; +import com.fanruan.api.log.LogKit; +import com.fanruan.api.util.GeneralKit; +import com.fanruan.api.util.StringKit; +import com.fr.data.act.Describer; +import com.fr.json.JSONObject; +import com.fr.stable.script.CalculatorProvider; +import com.fr.stable.web.Repository; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLable; +import com.fr.stable.xml.XMLableReader; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + */ +public class EditTextDescriber implements Describer, XMLable { + + public static final String XML_TAG = "EditTextDescriber"; + + private boolean directEdit = true; + + private String waterMark; + + public EditTextDescriber() { + + } + + public boolean isDirectEdit() { + return this.directEdit; + } + + public void setDirectEdit(boolean directEdit) { + this.directEdit = directEdit; + } + + public void setWaterMark(String waterMark) { + this.waterMark = waterMark; + } + + public String getWaterMark() { + return waterMark; + } + + @Override + public void mixinJSON(Repository repo, CalculatorProvider c, JSONObject jo) { + jo.put("directEdit", directEdit); + if (StringKit.isNotBlank(waterMark)) { + if (FormulaKit.canBeFormula(waterMark)) { + try { + jo.put("watermark", GeneralKit.objectToString(FormulaKit.newFormula(waterMark).eval(c))); + } catch (Exception e) { + LogKit.error(e.getMessage(), e); + } + } else { + jo.put("watermark", waterMark); + } + } + } + + @Override + public void readXML(XMLableReader xmLableReader) { + + } + + @Override + public void writeXML(XMLPrintWriter xmlPrintWriter) { + + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } +} diff --git a/src/main/java/com/fanruan/api/report/form/describer/RepeatDescriber.java b/src/main/java/com/fanruan/api/report/form/describer/RepeatDescriber.java new file mode 100644 index 0000000..89ebee4 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/form/describer/RepeatDescriber.java @@ -0,0 +1,51 @@ +package com.fanruan.api.report.form.describer; + +import com.fr.data.act.Describer; +import com.fr.json.JSONObject; +import com.fr.stable.script.CalculatorProvider; +import com.fr.stable.web.Repository; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLable; +import com.fr.stable.xml.XMLableReader; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + */ +public class RepeatDescriber implements Describer, XMLable { + + public static final String XML_TAG = "RepeatDescriber"; + + private boolean removeRepeat = true; + + public boolean isRemoveRepeat() { + return this.removeRepeat; + } + + public void setRemoveRepeat(boolean removeRepeat) { + this.removeRepeat = removeRepeat; + } + + @Override + public void mixinJSON(Repository repo, CalculatorProvider c, JSONObject jo) { + if (removeRepeat) { + jo.put("norepeat", true); + } + } + + @Override + public void readXML(XMLableReader xmLableReader) { + + } + + @Override + public void writeXML(XMLPrintWriter xmlPrintWriter) { + + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } +} diff --git a/src/main/java/com/fanruan/api/report/form/describer/TextDescriber.java b/src/main/java/com/fanruan/api/report/form/describer/TextDescriber.java new file mode 100644 index 0000000..2a817e1 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/form/describer/TextDescriber.java @@ -0,0 +1,83 @@ +package com.fanruan.api.report.form.describer; + +import com.fanruan.api.util.StringKit; +import com.fr.data.act.Describer; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; +import com.fr.stable.script.CalculatorProvider; +import com.fr.stable.web.Repository; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLable; +import com.fr.stable.xml.XMLableReader; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + */ +public class TextDescriber implements Describer, XMLable { + + public static final String XML_TAG = "TextDescriber"; + + private boolean allowBlank = true; + private String errorMessage; + private int fontSize = 12; + + public TextDescriber() { + + } + + public TextDescriber(boolean allowBlank) { + this.allowBlank = allowBlank; + } + + public boolean isAllowBlank() { + return this.allowBlank; + } + + public void setAllowBlank(boolean allowBlank) { + this.allowBlank = allowBlank; + } + + public int getFontSize() { + return this.fontSize; + } + + public void setFontSize(int size) { + this.fontSize = size; + } + + public String getErrorMessage() { + return errorMessage == null ? StringUtils.EMPTY : errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public void readXML(XMLableReader xmLableReader) { + + } + + @Override + public void writeXML(XMLPrintWriter xmlPrintWriter) { + + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + @Override + public void mixinJSON(Repository repo, CalculatorProvider c, JSONObject jo) { + if (!allowBlank) { + jo.put("allowBlank", true); + } + if (StringKit.isNotEmpty(errorMessage)) { + jo.put("errorMessage", errorMessage); + } + jo.put("fontSize", this.fontSize); + } +} From f5b7cd4b48e0f12de400161f37f707534db31f13 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 12 Sep 2019 17:22:47 +0800 Subject: [PATCH 17/30] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/work/form/creator/Attribute.java | 75 ++++++++++++ .../work/form/creator/OpacityButton.java | 80 ++++++++++++ .../work/form/creator/XFieldEditor.java | 38 ++++-- .../work/form/creator/XOpenCreator.java | 114 ++++++++++++++++++ 4 files changed, 300 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/fanruan/api/design/work/form/creator/Attribute.java create mode 100644 src/main/java/com/fanruan/api/design/work/form/creator/OpacityButton.java create mode 100644 src/main/java/com/fanruan/api/design/work/form/creator/XOpenCreator.java diff --git a/src/main/java/com/fanruan/api/design/work/form/creator/Attribute.java b/src/main/java/com/fanruan/api/design/work/form/creator/Attribute.java new file mode 100644 index 0000000..9c8d7bc --- /dev/null +++ b/src/main/java/com/fanruan/api/design/work/form/creator/Attribute.java @@ -0,0 +1,75 @@ +package com.fanruan.api.design.work.form.creator; + +import com.fanruan.api.log.LogKit; +import com.fr.design.designer.creator.CRPropertyDescriptor; + +import java.beans.IntrospectionException; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + */ +public class Attribute { + + private CRPropertyDescriptor descriptor; + + public static Attribute newAttribute(String name, Class beanClass) { + return new Attribute(name, beanClass); + } + + public static Attribute newAttribute(String name, Class beanClass, String readMethod, String writeMethod) { + return new Attribute(name, beanClass, readMethod, writeMethod); + } + + private Attribute(String name, Class beanClass) { + try { + descriptor = new CRPropertyDescriptor(name, beanClass); + } catch (IntrospectionException e) { + LogKit.error(e.getMessage(), e); + } + } + + private Attribute(String name, Class beanClass, String readMethod, String writeMethod) { + try { + descriptor = new CRPropertyDescriptor(name, beanClass, readMethod, writeMethod); + } catch (IntrospectionException e) { + LogKit.error(e.getMessage(), e); + } + } + + public Attribute keyValue(String name, Object value) { + if (descriptor != null) { + descriptor.putKeyValue(name, value); + } + return this; + } + + public Attribute i18n(String i18nName) { + if (descriptor != null) { + descriptor.setI18NName(i18nName); + } + return this; + } + + public Attribute editorClass(Class clazz) { + if (descriptor != null) { + descriptor.setEditorClass(clazz); + } + return this; + } + + public Attribute rendererClass(Class clazz) { + if (descriptor != null) { + descriptor.setRendererClass(clazz); + } + return this; + } + + /** + * 这个属于内部调用的方法,外部不应该调用 + */ + protected CRPropertyDescriptor toPropertyDescriptor() { + return descriptor; + } +} diff --git a/src/main/java/com/fanruan/api/design/work/form/creator/OpacityButton.java b/src/main/java/com/fanruan/api/design/work/form/creator/OpacityButton.java new file mode 100644 index 0000000..0ea17f5 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/work/form/creator/OpacityButton.java @@ -0,0 +1,80 @@ +package com.fanruan.api.design.work.form.creator; + +import com.fanruan.api.util.IOKit; + +import javax.swing.*; +import java.awt.*; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + */ +public class OpacityButton extends JButton { + + private static final float FULL_OPACITY = 1.0F; + private static final float HALF_OPACITY = 0.4F; + + private String name; + private String imagePath; + private float opacity; + + public OpacityButton(String name, String imagePath, float opacity) { + this.name = name; + this.imagePath = imagePath; + this.opacity = opacity; + this.draw(); + } + + private void draw() { + ImageIcon imageIcon = (ImageIcon) IOKit.readIcon(imagePath); + Image img = imageIcon.getImage(); + MediaTracker mt = new MediaTracker(this); + int w = 21; + int h = 21; + mt.addImage(img, 0); + try { + mt.waitForAll(); + } catch (InterruptedException ignore) { + return; + } + + GraphicsConfiguration gc = new JFrame().getGraphicsConfiguration(); // 本地图形设备 + Image image = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);//建立透明画布 + Graphics2D g = (Graphics2D) image.getGraphics(); //在画布上创建画笔 + + Composite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f); //指定透明度为半透明90% + g.setComposite(alpha); + g.drawImage(img, 0, 0, this); //注意是,将image画到g画笔所在的画布上 + g.setColor(Color.black);//设置颜色为黑色 + g.drawString(name, 25, 20);//写字 + g.dispose(); //释放内存 + + Composite alpha2 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity); + Image image1 = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT); + g = (Graphics2D) image1.getGraphics(); + g.setComposite(alpha2); + g.drawImage(img, 2, 2, this); //改变图像起始位置,产生动态效果 + g.setColor(Color.black); + g.drawString(name, 25, 20); + g.dispose(); + + this.setIgnoreRepaint(true); + this.setFocusable(false);//设置没有焦点 + this.setBorder(null);//设置不画按钮边框 + this.setContentAreaFilled(false);//设置不画按钮背景 + this.setIcon(new ImageIcon(image1)); //把刚才生成的半透明image变成ImageIcon,贴到按钮上去 + this.setRolloverIcon(new ImageIcon(image1)); + this.setPressedIcon(new ImageIcon(image));//按下去的图标 + } + + /** + * 更改组件的可见性 + * + * @param visible 设置为true表示可见,设置为false表示不可见 + */ + public void makeVisible(boolean visible) { + this.opacity = visible ? FULL_OPACITY : HALF_OPACITY; + this.draw(); + } +} diff --git a/src/main/java/com/fanruan/api/design/work/form/creator/XFieldEditor.java b/src/main/java/com/fanruan/api/design/work/form/creator/XFieldEditor.java index 53afb63..8c13bb5 100644 --- a/src/main/java/com/fanruan/api/design/work/form/creator/XFieldEditor.java +++ b/src/main/java/com/fanruan/api/design/work/form/creator/XFieldEditor.java @@ -1,17 +1,41 @@ package com.fanruan.api.design.work.form.creator; -import com.fr.form.ui.FieldEditor; +import com.fanruan.api.design.DesignKit; +import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; +import com.fr.form.ui.Widget; import java.awt.*; /** - * 控件树 - * @author Kalven + * @author richie * @version 10.0 - * Created by Kalven on 2019/9/3 + * Created by richie on 2019-09-10 + * 控件的UI展示和设计类 */ -public abstract class XFieldEditor extends com.fr.design.designer.creator.XFieldEditor { - public XFieldEditor(FieldEditor widget, Dimension initSize) { - super(widget, initSize); +public abstract class XFieldEditor extends XOpenCreator { + + public XFieldEditor(Widget fieldEditor, Dimension dimension) { + super(fieldEditor, dimension); + } + + @Override + public Attribute[] attributes() { + + Attribute allowBlank = Attribute.newAttribute("allowBlank", this.data.getClass()).i18n( + DesignKit.i18nText("Fine-Design_Form_Allow_Blank")) + .editorClass(InChangeBooleanEditor.class).keyValue( + XCreatorConstants.PROPERTY_VALIDATE, "Fine-Design_Basic_Validate"); + Attribute blankErrorMsg = Attribute.newAttribute("errorMessage", this.data.getClass()).i18n( + DesignKit.i18nText("Fine-Design_Report_Engine_Verify_Message")) + .keyValue(XCreatorConstants.PROPERTY_VALIDATE, "Fine-Design_Basic_Validate"); + Attribute fontSize = Attribute.newAttribute("fontSize", this.data.getClass(), "getFontSize", "setFontSize") + .i18n(DesignKit.i18nText("Fine-Design_Form_Font_Size")) + .keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Report_Advanced"); + + return new Attribute[]{ + allowBlank, blankErrorMsg, fontSize + }; } + } diff --git a/src/main/java/com/fanruan/api/design/work/form/creator/XOpenCreator.java b/src/main/java/com/fanruan/api/design/work/form/creator/XOpenCreator.java new file mode 100644 index 0000000..66ba00d --- /dev/null +++ b/src/main/java/com/fanruan/api/design/work/form/creator/XOpenCreator.java @@ -0,0 +1,114 @@ +package com.fanruan.api.design.work.form.creator; + +import com.fanruan.api.design.DesignKit; +import com.fanruan.api.design.work.form.macro.XCreatorConstants; +import com.fanruan.api.util.ArrayKit; +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWidgetCreator; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.Widget; +import com.fr.stable.core.PropertyChangeAdapter; + +import javax.swing.*; +import java.awt.*; +import java.beans.IntrospectionException; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-10 + */ +public abstract class XOpenCreator extends XWidgetCreator { + + public XOpenCreator(Widget widget, Dimension size) { + super(widget, size); + } + + final public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] basic = new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(DesignKit.i18nText("Fine-Design_Form_Form_Widget_Name")), + new CRPropertyDescriptor("enabled", this.data.getClass()).setI18NName(DesignKit.i18nText("Fine-Design_Report_Enabled")) + .setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + setEnabled(toData().isEnabled()); + } + }), + new CRPropertyDescriptor("visible", this.data.getClass()).setI18NName( + DesignKit.i18nText("Fine-Design_Form_Widget_Visible")).setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + makeVisible(toData().isVisible()); + } + }), + new CRPropertyDescriptor("labelName", this.data.getClass(), "getLabelName", "setLabelName") + .setI18NName(DesignKit.i18nText("Fine-Design_Form_Label_Name")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + }; + Attribute[] attributes = attributes(); + CRPropertyDescriptor[] current = new CRPropertyDescriptor[attributes.length]; + for (int i = 0, len = attributes.length; i < len; i++) { + current[i] = attributes[i].toPropertyDescriptor(); + } + return ArrayKit.addAll(basic, current); + } + + /** + * 控件支持的属性以及操作设置这些属性的方法,使用反射调用属性的设置方法。 + * 示例:如果不显示的传入读取和写入方法,则默认调用"get+属性名"或者"set+属性名"的方法。 + * + * @return 控件支持的属性以及操作设置这些属性的方法集合 + */ + public abstract Attribute[] attributes(); + + /** + * 待说明 + * + * @return 待说明 + */ + public Widget toData() { + return this.data; + } + + /** + * 根据Widget的属性值初始化XCreator的属性值 + */ + @Override + protected void initXCreatorProperties() { + this.setEnabled(toData().isEnabled()); + } + + /** + * 待说明 + */ + public void recalculateChildrenSize() { + } + + + protected void makeVisible(boolean visible) { + + } + + public void paint(Graphics g) { + AlphaComposite composite = this.data.isVisible() ? (AlphaComposite) ((Graphics2D) g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER, HALF_OPACITY); + ((Graphics2D) g).setComposite(composite); + super.paint(g); + } + + /** + * 重命名 + * + * @param designer 表单设计器 + * @param creator 当前组件 + */ + public void ChangeCreatorName(FormDesigner designer, XCreator creator) { + String oldName = creator.toData().getWidgetName(); + String value = JOptionPane.showInputDialog(designer, DesignKit.i18nText("Fine-Design_Form_Change_Widget_Name_Discription"), oldName); + if (value != null) { + designer.renameCreator(creator, value); + } + } +} From fe1260db0f250d4f1218d2ab0ed3d25717c564ef Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 12 Sep 2019 17:26:14 +0800 Subject: [PATCH 18/30] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{XFieldEditor.java => XFieldCreator.java} | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) rename src/main/java/com/fanruan/api/design/work/form/creator/{XFieldEditor.java => XFieldCreator.java} (76%) diff --git a/src/main/java/com/fanruan/api/design/work/form/creator/XFieldEditor.java b/src/main/java/com/fanruan/api/design/work/form/creator/XFieldCreator.java similarity index 76% rename from src/main/java/com/fanruan/api/design/work/form/creator/XFieldEditor.java rename to src/main/java/com/fanruan/api/design/work/form/creator/XFieldCreator.java index 8c13bb5..7f48514 100644 --- a/src/main/java/com/fanruan/api/design/work/form/creator/XFieldEditor.java +++ b/src/main/java/com/fanruan/api/design/work/form/creator/XFieldCreator.java @@ -4,6 +4,7 @@ import com.fanruan.api.design.DesignKit; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; import com.fr.form.ui.Widget; +import com.fr.form.ui.concept.Blankable; import java.awt.*; @@ -13,9 +14,9 @@ import java.awt.*; * Created by richie on 2019-09-10 * 控件的UI展示和设计类 */ -public abstract class XFieldEditor extends XOpenCreator { +public abstract class XFieldCreator extends XOpenCreator { - public XFieldEditor(Widget fieldEditor, Dimension dimension) { + public XFieldCreator(Widget fieldEditor, Dimension dimension) { super(fieldEditor, dimension); } @@ -33,9 +34,16 @@ public abstract class XFieldEditor extends XOpenCreator { .i18n(DesignKit.i18nText("Fine-Design_Form_Font_Size")) .keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Report_Advanced"); + Widget widget = toData(); + if (widget instanceof Blankable && ((Blankable) widget).isAllowBlank()) { + return new Attribute[]{ + allowBlank, blankErrorMsg, fontSize + }; + } return new Attribute[]{ - allowBlank, blankErrorMsg, fontSize + allowBlank, fontSize }; + } } From ce28dac9c20c53d88f8a8f727e8ec3a393ca4654 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 12 Sep 2019 17:28:15 +0800 Subject: [PATCH 19/30] =?UTF-8?q?=E4=B8=80=E7=82=B9=E5=B0=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/design/work/form/creator/XFieldCreator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/fanruan/api/design/work/form/creator/XFieldCreator.java b/src/main/java/com/fanruan/api/design/work/form/creator/XFieldCreator.java index 7f48514..783386d 100644 --- a/src/main/java/com/fanruan/api/design/work/form/creator/XFieldCreator.java +++ b/src/main/java/com/fanruan/api/design/work/form/creator/XFieldCreator.java @@ -35,7 +35,8 @@ public abstract class XFieldCreator extends XOpenCreator { .keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Report_Advanced"); Widget widget = toData(); - if (widget instanceof Blankable && ((Blankable) widget).isAllowBlank()) { + // 控件类型允许值为空,但是设置了不允许为空,就要设置为空时的提示信息 + if (widget instanceof Blankable && !((Blankable) widget).isAllowBlank()) { return new Attribute[]{ allowBlank, blankErrorMsg, fontSize }; From 80679d363422359b0bd28d585208d7a45176fc89 Mon Sep 17 00:00:00 2001 From: Palin Date: Mon, 16 Sep 2019 10:34:16 +0800 Subject: [PATCH 20/30] =?UTF-8?q?=E6=8C=89=E8=A6=81=E6=B1=82=E5=A2=9E?= =?UTF-8?q?=E6=B7=BB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/Formula/BaseFormula.java | 12 ++++++ .../design/ui/layout/FRGUIPaneFactoryKit.java | 40 +++++++++++++++++++ .../fanruan/api/macro/XCreatorConstants.java | 12 ++++++ .../fanruan/api/report/form/WidgetName.java | 9 +++++ .../java/com/fanruan/api/util/CodeKit.java | 10 +++++ src/main/java/com/fanruan/api/xml/XmlKit.java | 13 +++++- .../com/fanruan/api/util/CodeKitTest.java | 11 +++++ 7 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/fanruan/api/Formula/BaseFormula.java create mode 100644 src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java create mode 100644 src/main/java/com/fanruan/api/macro/XCreatorConstants.java create mode 100644 src/main/java/com/fanruan/api/report/form/WidgetName.java diff --git a/src/main/java/com/fanruan/api/Formula/BaseFormula.java b/src/main/java/com/fanruan/api/Formula/BaseFormula.java new file mode 100644 index 0000000..a97da3a --- /dev/null +++ b/src/main/java/com/fanruan/api/Formula/BaseFormula.java @@ -0,0 +1,12 @@ +package com.fanruan.api.Formula; + +/** + * @author Palin + * @version 10.0 + * Created by Palin on 2019/9/16 0016 + */ +public abstract class BaseFormula extends com.fr.base.BaseFormula{ + public BaseFormula(String var1) { + this.content = var1; + } +} diff --git a/src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java b/src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java new file mode 100644 index 0000000..3a657d7 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java @@ -0,0 +1,40 @@ +package com.fanruan.api.design.ui.layout; + +import com.fr.design.layout.FRGUIPaneFactory; +import javax.swing.JPanel; +import java.awt.LayoutManager; +import java.awt.FlowLayout; +import java.awt.BorderLayout; + +/** + * @author Palin + * @version 10.0 + * Created by Palin on 2019/9/16 0016 + */ +public class FRGUIPaneFactoryKit { + + /** + * 创建边框 + */ + public static LayoutManager createBorderLayout() { + return new BorderLayout(); + } + + /** + * 创建边框布局框格 + */ + public static JPanel createBorderLayout_S_Pane() { + JPanel var0 = new JPanel(); + var0.setLayout(createBorderLayout()); + return var0; + } + + /** + * 创建普通流内部容器框格 + */ + public static JPanel createNormalFlowInnerContainer_S_Pane() { + JPanel var0 = new JPanel(); + var0.setLayout(new FlowLayout(0)); + return var0; + } +} diff --git a/src/main/java/com/fanruan/api/macro/XCreatorConstants.java b/src/main/java/com/fanruan/api/macro/XCreatorConstants.java new file mode 100644 index 0000000..242b24c --- /dev/null +++ b/src/main/java/com/fanruan/api/macro/XCreatorConstants.java @@ -0,0 +1,12 @@ +package com.fanruan.api.macro; + +/** + * @author Palin + * @version 10.0 + * Created by Palin on 2019/9/16 0016 + * 常量 + */ +public class XCreatorConstants { + public static final String PROPERTY_CATEGORY = "category"; + +} diff --git a/src/main/java/com/fanruan/api/report/form/WidgetName.java b/src/main/java/com/fanruan/api/report/form/WidgetName.java new file mode 100644 index 0000000..5881e70 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/form/WidgetName.java @@ -0,0 +1,9 @@ +package com.fanruan.api.report.form; + +/** + * @author Palin + * @version 10.0 + * Created by Palin on 2019/9/13 0013 + */ +public class WidgetName extends com.fr.stable.js.WidgetName{ +} diff --git a/src/main/java/com/fanruan/api/util/CodeKit.java b/src/main/java/com/fanruan/api/util/CodeKit.java index 5c89421..0e1b128 100644 --- a/src/main/java/com/fanruan/api/util/CodeKit.java +++ b/src/main/java/com/fanruan/api/util/CodeKit.java @@ -22,4 +22,14 @@ public class CodeKit { public static String cjkDecode(String text) throws Exception { return CodeUtils.cjkDecode(text); } + + /** + * 将经过处理的中日韩文字符串解码成原先的中日韩文 + * @param text 经过处理的中日韩文字 + * @return 中日韩文字 + * @throws Exception + */ + public static String encodeURIComponent(String text) { + return CommonCodeUtils.encodeURIComponent(text); + } } diff --git a/src/main/java/com/fanruan/api/xml/XmlKit.java b/src/main/java/com/fanruan/api/xml/XmlKit.java index dc2cfc1..8b04292 100644 --- a/src/main/java/com/fanruan/api/xml/XmlKit.java +++ b/src/main/java/com/fanruan/api/xml/XmlKit.java @@ -61,6 +61,7 @@ public class XmlKit { /** * 从xml中读取数据连接对象 + * * @param reader xml读取器 * @return 数据连接对象 */ @@ -79,7 +80,8 @@ public class XmlKit { } /** - *读出xml参数 + * 读出xml参数 + * * @param reader xml读出对象 * @return 返回保存参数数组 */ @@ -87,4 +89,13 @@ public class XmlKit { return StableXMLUtils.readParameter(reader); } + /** + * 读出xml参数 + * + * @param writer xml读出对象 + * @return 返回保存参数数组 + */ + public static void writeParameters(XMLPrintWriter writer, ParameterProvider[] parameter) { + writer.startTAG("Parameters"); + } } diff --git a/src/test/java/com/fanruan/api/util/CodeKitTest.java b/src/test/java/com/fanruan/api/util/CodeKitTest.java index 5224324..5c07d12 100644 --- a/src/test/java/com/fanruan/api/util/CodeKitTest.java +++ b/src/test/java/com/fanruan/api/util/CodeKitTest.java @@ -21,6 +21,17 @@ public class CodeKitTest { Assert.assertTrue(s.equals(decode)); } catch (Exception e) { + } + } + public void encodeURIComponent() { + String s = "中文 한글 日本語"; + String encode = CodeUtils.encodeURIComponent(s); + + try { + String decode = CodeKit.encodeURIComponent(encode); + Assert.assertTrue(s.equals(decode)); + } catch (Exception e) { + } } } From 9a3d0aed7dc703579892d6d27b88744187e7c5be Mon Sep 17 00:00:00 2001 From: Palin Date: Mon, 16 Sep 2019 10:54:32 +0800 Subject: [PATCH 21/30] =?UTF-8?q?=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/com/fanruan/api/util/CodeKitTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/fanruan/api/util/CodeKitTest.java b/src/test/java/com/fanruan/api/util/CodeKitTest.java index 5c07d12..af99858 100644 --- a/src/test/java/com/fanruan/api/util/CodeKitTest.java +++ b/src/test/java/com/fanruan/api/util/CodeKitTest.java @@ -23,8 +23,10 @@ public class CodeKitTest { } } + + @Test public void encodeURIComponent() { - String s = "中文 한글 日本語"; + String s = "123"; String encode = CodeUtils.encodeURIComponent(s); try { From 755cc2909d2353ff012e1ebc86f94aa9d6389f23 Mon Sep 17 00:00:00 2001 From: Palin Date: Mon, 16 Sep 2019 10:57:42 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/util/CodeKit.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/fanruan/api/util/CodeKit.java b/src/main/java/com/fanruan/api/util/CodeKit.java index 0e1b128..84f6e45 100644 --- a/src/main/java/com/fanruan/api/util/CodeKit.java +++ b/src/main/java/com/fanruan/api/util/CodeKit.java @@ -24,9 +24,9 @@ public class CodeKit { } /** - * 将经过处理的中日韩文字符串解码成原先的中日韩文 - * @param text 经过处理的中日韩文字 - * @return 中日韩文字 + * 将经过处理字符串解码成原先字符串 + * @param text 经过处理的字符串 + * @return 字符串 * @throws Exception */ public static String encodeURIComponent(String text) { From e76d14bd1d6674a48cfd8e5bab5c0214888e5833 Mon Sep 17 00:00:00 2001 From: Palin Date: Mon, 16 Sep 2019 15:35:19 +0800 Subject: [PATCH 23/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/Formula/BaseFormula.java | 12 ------ .../design/ui/layout/FRGUIPaneFactoryKit.java | 40 ------------------- .../fanruan/api/report/form/WidgetName.java | 9 ----- src/main/java/com/fanruan/api/xml/XmlKit.java | 4 +- 4 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/Formula/BaseFormula.java delete mode 100644 src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java delete mode 100644 src/main/java/com/fanruan/api/report/form/WidgetName.java diff --git a/src/main/java/com/fanruan/api/Formula/BaseFormula.java b/src/main/java/com/fanruan/api/Formula/BaseFormula.java deleted file mode 100644 index a97da3a..0000000 --- a/src/main/java/com/fanruan/api/Formula/BaseFormula.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fanruan.api.Formula; - -/** - * @author Palin - * @version 10.0 - * Created by Palin on 2019/9/16 0016 - */ -public abstract class BaseFormula extends com.fr.base.BaseFormula{ - public BaseFormula(String var1) { - this.content = var1; - } -} diff --git a/src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java b/src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java deleted file mode 100644 index 3a657d7..0000000 --- a/src/main/java/com/fanruan/api/design/ui/layout/FRGUIPaneFactoryKit.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fanruan.api.design.ui.layout; - -import com.fr.design.layout.FRGUIPaneFactory; -import javax.swing.JPanel; -import java.awt.LayoutManager; -import java.awt.FlowLayout; -import java.awt.BorderLayout; - -/** - * @author Palin - * @version 10.0 - * Created by Palin on 2019/9/16 0016 - */ -public class FRGUIPaneFactoryKit { - - /** - * 创建边框 - */ - public static LayoutManager createBorderLayout() { - return new BorderLayout(); - } - - /** - * 创建边框布局框格 - */ - public static JPanel createBorderLayout_S_Pane() { - JPanel var0 = new JPanel(); - var0.setLayout(createBorderLayout()); - return var0; - } - - /** - * 创建普通流内部容器框格 - */ - public static JPanel createNormalFlowInnerContainer_S_Pane() { - JPanel var0 = new JPanel(); - var0.setLayout(new FlowLayout(0)); - return var0; - } -} diff --git a/src/main/java/com/fanruan/api/report/form/WidgetName.java b/src/main/java/com/fanruan/api/report/form/WidgetName.java deleted file mode 100644 index 5881e70..0000000 --- a/src/main/java/com/fanruan/api/report/form/WidgetName.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fanruan.api.report.form; - -/** - * @author Palin - * @version 10.0 - * Created by Palin on 2019/9/13 0013 - */ -public class WidgetName extends com.fr.stable.js.WidgetName{ -} diff --git a/src/main/java/com/fanruan/api/xml/XmlKit.java b/src/main/java/com/fanruan/api/xml/XmlKit.java index 8b04292..9d74d58 100644 --- a/src/main/java/com/fanruan/api/xml/XmlKit.java +++ b/src/main/java/com/fanruan/api/xml/XmlKit.java @@ -91,11 +91,9 @@ public class XmlKit { /** * 读出xml参数 - * * @param writer xml读出对象 - * @return 返回保存参数数组 */ public static void writeParameters(XMLPrintWriter writer, ParameterProvider[] parameter) { - writer.startTAG("Parameters"); + StableXMLUtils.writeParameters(writer,parameter); } } From 1076d141f5336629a997f5fd7c7b3387d232bc59 Mon Sep 17 00:00:00 2001 From: Palin Date: Mon, 16 Sep 2019 15:39:30 +0800 Subject: [PATCH 24/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/macro/XCreatorConstants.java | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/macro/XCreatorConstants.java diff --git a/src/main/java/com/fanruan/api/macro/XCreatorConstants.java b/src/main/java/com/fanruan/api/macro/XCreatorConstants.java deleted file mode 100644 index 242b24c..0000000 --- a/src/main/java/com/fanruan/api/macro/XCreatorConstants.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fanruan.api.macro; - -/** - * @author Palin - * @version 10.0 - * Created by Palin on 2019/9/16 0016 - * 常量 - */ -public class XCreatorConstants { - public static final String PROPERTY_CATEGORY = "category"; - -} From c739fc314d923730384b56a35c99fdc65e38a052 Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 16 Sep 2019 17:13:21 +0800 Subject: [PATCH 25/30] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/com/fanruan/api/xml/XmlKitTest.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/test/java/com/fanruan/api/xml/XmlKitTest.java b/src/test/java/com/fanruan/api/xml/XmlKitTest.java index 2c33d4d..641078c 100644 --- a/src/test/java/com/fanruan/api/xml/XmlKitTest.java +++ b/src/test/java/com/fanruan/api/xml/XmlKitTest.java @@ -1,20 +1,12 @@ package com.fanruan.api.xml; import com.fr.base.Parameter; -import com.fr.base.TableData; -import com.fr.plugin.db.json.core.JSONTableData; -import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; -import com.fr.stable.xml.StableXMLUtils; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLUtils; import com.fr.stable.xml.XMLableReader; import com.fr.third.javax.xml.stream.XMLStreamException; import org.junit.Assert; import org.junit.Test; -import static org.junit.Assert.*; - public class XmlKitTest { @Test From b93860d213cfcdee1471db0f88a7b8d1729b2c69 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 17 Sep 2019 12:52:51 +0800 Subject: [PATCH 26/30] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/report/form/BaseWidget.java | 3 +- .../api/report/form/value/InitializerKit.java | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/fanruan/api/report/form/value/InitializerKit.java diff --git a/src/main/java/com/fanruan/api/report/form/BaseWidget.java b/src/main/java/com/fanruan/api/report/form/BaseWidget.java index c9100c2..703fad3 100644 --- a/src/main/java/com/fanruan/api/report/form/BaseWidget.java +++ b/src/main/java/com/fanruan/api/report/form/BaseWidget.java @@ -1,6 +1,7 @@ package com.fanruan.api.report.form; import com.fr.data.act.Describer; +import com.fr.data.act.Producer; import com.fr.form.ui.Widget; import com.fr.json.JSONException; import com.fr.json.JSONObject; @@ -14,7 +15,7 @@ import com.fr.stable.web.Repository; * Created by richie on 2019-09-10 * 控件的插件接口 */ -public abstract class BaseWidget extends Widget implements Describer { +public abstract class BaseWidget extends Widget implements Describer, Producer { @Override public boolean isEditor() { diff --git a/src/main/java/com/fanruan/api/report/form/value/InitializerKit.java b/src/main/java/com/fanruan/api/report/form/value/InitializerKit.java new file mode 100644 index 0000000..50b3bf7 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/form/value/InitializerKit.java @@ -0,0 +1,32 @@ +package com.fanruan.api.report.form.value; + +import com.fr.form.ui.WidgetValue; +import com.fr.form.ui.concept.data.ValueInitializer; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019/9/17 + * 初始化工具类 + */ +public class InitializerKit { + + /** + * 初始化化一个控件值对象 + * + * @return 控件值 + */ + public static ValueInitializer newValue() { + return new WidgetValue(); + } + + /** + * 初始化一个控件值对象 + * + * @param value 控件值的值 + * @return 控件值 + */ + public static ValueInitializer newValue(Object value) { + return new WidgetValue(value); + } +} From 0391259abfbb9b2d2ec49b051bf830a08ddb982c Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 17 Sep 2019 12:55:18 +0800 Subject: [PATCH 27/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E4=BD=BF=E7=94=A8FineKit=E7=9A=84=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 7931b23..51a76d4 100644 --- a/readme.md +++ b/readme.md @@ -47,9 +47,11 @@ SessionKit#getSession(@NotNull String sessionID); |插件名|源码| |-----|----| |redis数据集插件|https://git.fanruan.com/fanruan/demo-tabledata-redis| -|增强公式编辑器插件|https://git.fanruan.com/fanruan/demo-formula-script +|增强公式编辑器插件|https://git.fanruan.com/fanruan/demo-formula-script| |条件属性之文本对齐插件|https://git.fanruan.com/fanruan/demo-highlight-align| |评分形态插件|https://git.fanruan.com/fanruan/demo-show-present| +|急速下拉树插件|https://git.fanruan.com/fanruan/demo-widget-ztree| +|网页框插件|https://git.fanruan.com/fanruan/demo-widget-iframe| ## 如何判断插件中调用的API需要增加到FineKit中 From e8fff9d7c300d1e7d59b8e8223b4ac795cdb50cf Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 17 Sep 2019 17:16:05 +0800 Subject: [PATCH 28/30] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=9B=91=E5=90=AC+?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E6=8F=92=E4=BB=B6=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/conf/ConfigurationKit.java | 61 +++++++++++++++++++ .../java/com/fanruan/api/generic/Matcher.java | 11 ++++ .../fanruan/api/{conf => generic}/Runner.java | 2 +- .../com/fanruan/api/runtime/PluginKit.java | 20 ------ .../com/fanruan/api/plugin/PluginKitTest.java | 13 ---- 5 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 src/main/java/com/fanruan/api/conf/ConfigurationKit.java create mode 100644 src/main/java/com/fanruan/api/generic/Matcher.java rename src/main/java/com/fanruan/api/{conf => generic}/Runner.java (78%) delete mode 100644 src/main/java/com/fanruan/api/runtime/PluginKit.java delete mode 100644 src/test/java/com/fanruan/api/plugin/PluginKitTest.java diff --git a/src/main/java/com/fanruan/api/conf/ConfigurationKit.java b/src/main/java/com/fanruan/api/conf/ConfigurationKit.java new file mode 100644 index 0000000..86cebc0 --- /dev/null +++ b/src/main/java/com/fanruan/api/conf/ConfigurationKit.java @@ -0,0 +1,61 @@ +package com.fanruan.api.conf; + +import com.fanruan.api.generic.Matcher; +import com.fanruan.api.generic.Runner; +import com.fr.config.Configuration; +import com.fr.config.holder.ConfigChangeListener; +import com.fr.transaction.Configurations; +import com.fr.transaction.ValidateProxy; +import com.fr.transaction.WorkerFacade; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-17 + * 配置管理工具类 + */ +public class ConfigurationKit { + + /** + * 兼容配置缓存失效 + * + * @param matcher 匹配器 + * @param runner 匹配后执行的动作 + */ + public static void listenCacheChange(final Matcher> matcher, final Runner runner) { + ValidateProxy.getInstance().getValidateManager().registerListener(new ConfigChangeListener() { + + @Override + public boolean accept(Class clazz) { + if (matcher == null) { + return true; + } + return matcher.match(clazz); + } + + @Override + public void change() { + if (matcher != null) { + runner.run(); + } + } + }); + } + + /** + * 在一个事务中修改配置 + * + * @param configType 配置类 + * @param runner 执行器 + */ + public static void modify(Class configType, Runner runner) { + Configurations.modify(new WorkerFacade(configType) { + @Override + public void run() { + if (runner != null) { + runner.run(); + } + } + }); + } +} diff --git a/src/main/java/com/fanruan/api/generic/Matcher.java b/src/main/java/com/fanruan/api/generic/Matcher.java new file mode 100644 index 0000000..33f8188 --- /dev/null +++ b/src/main/java/com/fanruan/api/generic/Matcher.java @@ -0,0 +1,11 @@ +package com.fanruan.api.generic; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-09-17 + */ +public interface Matcher { + + boolean match(T t); +} diff --git a/src/main/java/com/fanruan/api/conf/Runner.java b/src/main/java/com/fanruan/api/generic/Runner.java similarity index 78% rename from src/main/java/com/fanruan/api/conf/Runner.java rename to src/main/java/com/fanruan/api/generic/Runner.java index b80c76e..c959dd0 100644 --- a/src/main/java/com/fanruan/api/conf/Runner.java +++ b/src/main/java/com/fanruan/api/generic/Runner.java @@ -1,4 +1,4 @@ -package com.fanruan.api.conf; +package com.fanruan.api.generic; /** * @author richie diff --git a/src/main/java/com/fanruan/api/runtime/PluginKit.java b/src/main/java/com/fanruan/api/runtime/PluginKit.java deleted file mode 100644 index c6f126b..0000000 --- a/src/main/java/com/fanruan/api/runtime/PluginKit.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fanruan.api.runtime; - -import com.fr.plugin.context.PluginContexts; - -/** - * @author richie - * @version 10.0 - * Created by richie on 2019-08-30 - * 插件相关的工具类 - */ -public class PluginKit { - - /** - * 当前插件是否可用(例如:插件授权文件过期时,该犯法会返回false) - * @return 插件可用则返回true,不可用则返回false - */ - public static boolean isCurrentPluginAvailable() { - return PluginContexts.currentContext().isAvailable(); - } -} diff --git a/src/test/java/com/fanruan/api/plugin/PluginKitTest.java b/src/test/java/com/fanruan/api/plugin/PluginKitTest.java deleted file mode 100644 index 7d5f9a5..0000000 --- a/src/test/java/com/fanruan/api/plugin/PluginKitTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fanruan.api.plugin; - -import com.fanruan.api.runtime.PluginKit; -import org.junit.Assert; -import org.junit.Test; - -public class PluginKitTest { - @Test - public void getArray() { - Assert.assertFalse(PluginKit.isCurrentPluginAvailable()); - - } -} From ffe52018f2e3939f1cec85d3e2902281ec094e05 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 17 Sep 2019 19:25:49 +0800 Subject: [PATCH 29/30] =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 51a76d4..f89ecf8 100644 --- a/readme.md +++ b/readme.md @@ -55,7 +55,13 @@ SessionKit#getSession(@NotNull String sessionID); ## 如何判断插件中调用的API需要增加到FineKit中 -最简单的原则:除了JDK自带的类、插件接口(包括抽象类)、枚举、以及使用了@Open注解标记的类之外,是否还使用了com.fanruan.api(com.fr.third除外)之外的类,如果有则需要修改。 +最简单的原则: + +1、插件只使用了JDK自带的类、插件接口(包括抽象类)、枚举、以及使用了@Open注解标记的类; +2、插件只使用了包名前缀为com.fr.third的类; +3、插件只使用了包名前缀为com.fanruan.api之外的类; + +如果违背了上述三个原则,则需要考虑将使用类加入FineKit中。 ## 如何提交新的API From 09a7df14d724c0e77a8b6c03f8a00a52d58582f2 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 17 Sep 2019 19:26:15 +0800 Subject: [PATCH 30/30] =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index f89ecf8..2b6cbfa 100644 --- a/readme.md +++ b/readme.md @@ -58,7 +58,9 @@ SessionKit#getSession(@NotNull String sessionID); 最简单的原则: 1、插件只使用了JDK自带的类、插件接口(包括抽象类)、枚举、以及使用了@Open注解标记的类; + 2、插件只使用了包名前缀为com.fr.third的类; + 3、插件只使用了包名前缀为com.fanruan.api之外的类; 如果违背了上述三个原则,则需要考虑将使用类加入FineKit中。