From ca1ecef2380f94e34294c5c87a7921bff63de076 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Fri, 6 Sep 2019 13:41:45 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=20feat:=20=E6=96=B0=E5=A2=9EcreateBorderLa?= =?UTF-8?q?yout=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/design/util/GUICoreKit.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/fanruan/api/design/util/GUICoreKit.java b/src/main/java/com/fanruan/api/design/util/GUICoreKit.java index 1ff5155..9e4ded5 100644 --- a/src/main/java/com/fanruan/api/design/util/GUICoreKit.java +++ b/src/main/java/com/fanruan/api/design/util/GUICoreKit.java @@ -119,6 +119,14 @@ public class GUICoreKit { return FRGUIPaneFactory.createBorderLayout_S_Pane(); } + /** + * 创建一个边框布局 + * @return 返回BorderLayout对象 + * */ + public static LayoutManager createBorderLayout() { + return FRGUIPaneFactory.createBorderLayout(); + } + /** * 设置一个窗口居中 */ From 1e8dd0e3d9bc1eccfb70f0eb6702b47c76434da5 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Fri, 6 Sep 2019 15:35:37 +0800 Subject: [PATCH 2/7] =?UTF-8?q?update:=20=E6=96=B0=E5=A2=9E=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/conf/HolderKit.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/fanruan/api/conf/HolderKit.java b/src/main/java/com/fanruan/api/conf/HolderKit.java index 6268e47..6e9c709 100644 --- a/src/main/java/com/fanruan/api/conf/HolderKit.java +++ b/src/main/java/com/fanruan/api/conf/HolderKit.java @@ -5,6 +5,8 @@ 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.factory.Holders; +import com.fr.config.holder.impl.ColConf; import java.util.Collection; import java.util.Map; @@ -88,4 +90,14 @@ public class HolderKit { public static ObjectMapConf> objMap(Map map, Class keyType, Class valueType, boolean order) { return new ObjectMapConf<>(map, keyType, valueType, order); } + + /** + * 创建一个collection类型的holder + * @param collection 值Collection类型 + * @param valueType 值class类型 + * @return collection类型的holder + * */ + public static ColConf> collection(Collection collection, Class valueType) { + return Holders.collection(collection, valueType); + } } From fc7917be498ece8bd29410f8f34bbc5bbd82e63a Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Fri, 6 Sep 2019 15:44:05 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=88=A0=E5=8E=BB=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/design/util/GUICoreKit.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/com/fanruan/api/design/util/GUICoreKit.java b/src/main/java/com/fanruan/api/design/util/GUICoreKit.java index 9e4ded5..af8661c 100644 --- a/src/main/java/com/fanruan/api/design/util/GUICoreKit.java +++ b/src/main/java/com/fanruan/api/design/util/GUICoreKit.java @@ -118,15 +118,6 @@ public class GUICoreKit { public static JPanel createBorderLayoutPane() { return FRGUIPaneFactory.createBorderLayout_S_Pane(); } - - /** - * 创建一个边框布局 - * @return 返回BorderLayout对象 - * */ - public static LayoutManager createBorderLayout() { - return FRGUIPaneFactory.createBorderLayout(); - } - /** * 设置一个窗口居中 */ From fd8d12543af687fb8ae8931f0a158e22a6b960fc Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 18 Sep 2019 16:07:15 +0800 Subject: [PATCH 4/7] =?UTF-8?q?update:=20finekit=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E8=A1=A5=E5=85=85=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/attachment/Attachment.java | 20 +++++++++++ .../com/fanruan/api/cal/namespace/FArray.java | 23 +++++++++++++ .../java/com/fanruan/api/i18n/I18nKit.java | 10 ++++++ .../java/com/fanruan/api/util/ArrayKit.java | 2 +- .../java/com/fanruan/api/util/CodeKit.java | 8 +++++ .../java/com/fanruan/api/util/GeneralKit.java | 9 ++++- src/main/java/com/fanruan/api/xml/XmlKit.java | 10 +++++- .../com/fanruan/api/xml/component/FRFile.java | 13 ++++++++ .../com/fanruan/api/util/ArrayKitTest.java | 33 ++++++++++++++++++- .../com/fanruan/api/util/CodeKitTest.java | 4 +-- .../com/fanruan/api/util/GeneralKitTest.java | 6 ++++ 11 files changed, 132 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/fanruan/api/attachment/Attachment.java create mode 100644 src/main/java/com/fanruan/api/cal/namespace/FArray.java create mode 100644 src/main/java/com/fanruan/api/xml/component/FRFile.java diff --git a/src/main/java/com/fanruan/api/attachment/Attachment.java b/src/main/java/com/fanruan/api/attachment/Attachment.java new file mode 100644 index 0000000..e3e1e61 --- /dev/null +++ b/src/main/java/com/fanruan/api/attachment/Attachment.java @@ -0,0 +1,20 @@ +package com.fanruan.api.attachment; + +import com.fr.cache.AttachmentFileBase; +/** + * 附件信息类,用来存储FR中的各种附件 + * */ +public class Attachment extends com.fr.cache.Attachment{ + /** + * 根据给定的编号、类型、文件名和二进制数组创建一个附件对象 + * */ + public Attachment(String id, String type, String filename, AttachmentFileBase attachmentFileBase){ + super(id, type, filename, attachmentFileBase); + } + /** + * 根据给定的编号、类型、文件名、二进制数组、宽度和高度创建一个附件对象 + * */ + public Attachment(String id, String type, String filename, AttachmentFileBase attachmentFileBase, int width, int height){ + super(id, type, filename, attachmentFileBase, width, height); + } +} diff --git a/src/main/java/com/fanruan/api/cal/namespace/FArray.java b/src/main/java/com/fanruan/api/cal/namespace/FArray.java new file mode 100644 index 0000000..51c59b8 --- /dev/null +++ b/src/main/java/com/fanruan/api/cal/namespace/FArray.java @@ -0,0 +1,23 @@ +package com.fanruan.api.cal.namespace; +import java.util.Collection; + +/** + * 生成一个链表类 + * */ +public class FArray extends com.fr.general.FArray{ + public FArray(){ + + } + /** + * 通过使用一个无需集合生成的链表类 + * */ + public FArray(Collection collection) { + super(collection); + } + /** + * 通过使用一个数组生成的链表类 + * */ + public FArray(T[] array) { + super(array); + } +} diff --git a/src/main/java/com/fanruan/api/i18n/I18nKit.java b/src/main/java/com/fanruan/api/i18n/I18nKit.java index a2f3cb1..e4e56d1 100644 --- a/src/main/java/com/fanruan/api/i18n/I18nKit.java +++ b/src/main/java/com/fanruan/api/i18n/I18nKit.java @@ -11,4 +11,14 @@ public class I18nKit { public static String getLocText(String string) { return InterProviderFactory.getProvider().getLocText(string); } + /** + * 获取国际化文本 + * + * @param string 需要国际化的值对应的键 + * @param args 变量 + * @return 返回国际化文本 + */ + public static String getLocText(String string,String... args) { + return InterProviderFactory.getProvider().getLocText(string,args); + } } diff --git a/src/main/java/com/fanruan/api/util/ArrayKit.java b/src/main/java/com/fanruan/api/util/ArrayKit.java index 5df74b7..ed5b319 100644 --- a/src/main/java/com/fanruan/api/util/ArrayKit.java +++ b/src/main/java/com/fanruan/api/util/ArrayKit.java @@ -55,7 +55,7 @@ public class ArrayKit { * @param array 源数组 * @return 返回数组判断为空的结果 */ - public static boolean isEmpty(Object[] array) { + public static boolean isEmpty(T[] array) { return ArrayUtils.isEmpty(array); } /** diff --git a/src/main/java/com/fanruan/api/util/CodeKit.java b/src/main/java/com/fanruan/api/util/CodeKit.java index b819eb4..f59227f 100644 --- a/src/main/java/com/fanruan/api/util/CodeKit.java +++ b/src/main/java/com/fanruan/api/util/CodeKit.java @@ -12,4 +12,12 @@ public class CodeKit { public static String passwordDecode(String passwordText) { return CodeUtils.passwordDecode(passwordText); } + /** + * 将普通的java字符串编码成javascript代码 + * @param string4javascript 待编码的字符串 + * @return 编码后的代码 + * */ + public static String javascriptEncode(String string4javascript) { + return CommonCodeUtils.javascriptEncode(string4javascript); + } } diff --git a/src/main/java/com/fanruan/api/util/GeneralKit.java b/src/main/java/com/fanruan/api/util/GeneralKit.java index 60d642b..9c6dc15 100644 --- a/src/main/java/com/fanruan/api/util/GeneralKit.java +++ b/src/main/java/com/fanruan/api/util/GeneralKit.java @@ -96,6 +96,13 @@ public class GeneralKit { public static Locale getLocale() { return FRContext.getLocale(); } - + /** + * 将路径节点数组用路径分隔符"/"连接起来 + * @param nodes 路径节点数组 + * @return 连接后的路径 + * */ + public static String pathJoin(String... nodes) { + return StableUtils.pathJoin(nodes); + } } diff --git a/src/main/java/com/fanruan/api/xml/XmlKit.java b/src/main/java/com/fanruan/api/xml/XmlKit.java index 89de42a..b497b7e 100644 --- a/src/main/java/com/fanruan/api/xml/XmlKit.java +++ b/src/main/java/com/fanruan/api/xml/XmlKit.java @@ -8,6 +8,7 @@ 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.XMLWriter; import java.io.InputStream; @@ -75,5 +76,12 @@ public class XmlKit { public static void writeXMLConnection(XMLPrintWriter writer, Connection connection) { DataCoreXmlUtils.writeXMLConnection(writer, connection); } - + /** + * 把一个XMLable写成字符串 + * @param xmlable xml文件 + * @return 返回字符串 + * */ + public static String writeXMLableAsString(XMLWriter xmlable){ + return GeneralXMLTools.writeXMLableAsString(xmlable); + } } diff --git a/src/main/java/com/fanruan/api/xml/component/FRFile.java b/src/main/java/com/fanruan/api/xml/component/FRFile.java new file mode 100644 index 0000000..e62b732 --- /dev/null +++ b/src/main/java/com/fanruan/api/xml/component/FRFile.java @@ -0,0 +1,13 @@ +package com.fanruan.api.xml.component; + +/** +* FR文件类,用于表示具有指定名字、类型和内容的文件 +* */ +public class FRFile extends com.fr.stable.xml.FRFile{ + /** + * 根据指定的文件类型,文件名以及文件内容生成一个文件 + * */ + public FRFile(String type, String filename, byte[] bytes){ + super(type, filename, bytes); + } +} diff --git a/src/test/java/com/fanruan/api/util/ArrayKitTest.java b/src/test/java/com/fanruan/api/util/ArrayKitTest.java index 45c6096..4803a7c 100644 --- a/src/test/java/com/fanruan/api/util/ArrayKitTest.java +++ b/src/test/java/com/fanruan/api/util/ArrayKitTest.java @@ -11,9 +11,40 @@ public class ArrayKitTest extends Prepare { public void isEmpty() throws Exception{ Object[] emptyArray = new Object[0]; Object[] notEmptyArray = new Object[1]; + Boolean[] booleanEmptyArray = new Boolean[0]; + Boolean[] booleanNotEmptyArray = new Boolean[1]; + Byte[] byteEmptyArray = new Byte[0]; + Byte[] byteNotEmptyArray = new Byte[1]; + Character[] charEmptyArray = new Character[0]; + Character[] charNotEmptyArray = new Character[1]; + Double[] doubleEmptyArray = new Double[0]; + Double[] doubleNotEmptyArray = new Double[1]; + Float[] floatEmptyArray = new Float[0]; + Float[] floatNotEmptyArray = new Float[1]; + Integer[] intEmptyArray = new Integer[0]; + Integer[] intNotEmptyArray = new Integer[1]; + Long[] longEmptyArray = new Long[0]; + Long[] longNotEmptyArray = new Long[1]; + Short[] shortEmptyArray = new Short[0]; + Short[] shortNotEmptyArray = new Short[1]; Assert.assertTrue(ArrayKit.isEmpty(emptyArray)); Assert.assertFalse(ArrayKit.isEmpty(notEmptyArray)); - + Assert.assertTrue(ArrayKit.isEmpty(booleanEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(booleanNotEmptyArray)); + Assert.assertTrue(ArrayKit.isEmpty(byteEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(byteNotEmptyArray)); + Assert.assertTrue(ArrayKit.isEmpty(charEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(charNotEmptyArray)); + Assert.assertTrue(ArrayKit.isEmpty(doubleEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(doubleNotEmptyArray)); + Assert.assertTrue(ArrayKit.isEmpty(floatEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(floatNotEmptyArray)); + Assert.assertTrue(ArrayKit.isEmpty(intEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(intNotEmptyArray)); + Assert.assertTrue(ArrayKit.isEmpty(longEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(longNotEmptyArray)); + Assert.assertTrue(ArrayKit.isEmpty(shortEmptyArray)); + Assert.assertFalse(ArrayKit.isEmpty(shortNotEmptyArray)); } @Test diff --git a/src/test/java/com/fanruan/api/util/CodeKitTest.java b/src/test/java/com/fanruan/api/util/CodeKitTest.java index 10853e6..4b11e3b 100644 --- a/src/test/java/com/fanruan/api/util/CodeKitTest.java +++ b/src/test/java/com/fanruan/api/util/CodeKitTest.java @@ -6,7 +6,7 @@ import org.junit.Test; public class CodeKitTest { @Test - public void passwordDecode(String passwordText) { - Assert.assertEquals(CodeKit.passwordDecode(passwordText), 123); + public void javascriptEncode() { + Assert.assertEquals(CodeKit.javascriptEncode("console.log(123)"), "console.log(123)"); } } diff --git a/src/test/java/com/fanruan/api/util/GeneralKitTest.java b/src/test/java/com/fanruan/api/util/GeneralKitTest.java index 6ba3bf6..12882ee 100644 --- a/src/test/java/com/fanruan/api/util/GeneralKitTest.java +++ b/src/test/java/com/fanruan/api/util/GeneralKitTest.java @@ -55,4 +55,10 @@ public class GeneralKitTest extends Prepare { Assert.assertEquals(GeneralKit.getLocale(), Locale.CHINA); } + @Test + public void pathJoin(){ + String strArray[] = {"abc", "def"}; + Assert.assertEquals(GeneralKit.pathJoin(strArray), "abc/def"); + } + } \ No newline at end of file From 5b96b8ce3a18156bb595954ed89d5b8530643172 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 18 Sep 2019 17:14:18 +0800 Subject: [PATCH 5/7] =?UTF-8?q?update:=20=E5=88=A0=E5=8E=BBFRFile=E5=92=8C?= =?UTF-8?q?attachment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/attachment/Attachment.java | 20 ------------------- .../com/fanruan/api/xml/component/FRFile.java | 13 ------------ 2 files changed, 33 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/attachment/Attachment.java delete mode 100644 src/main/java/com/fanruan/api/xml/component/FRFile.java diff --git a/src/main/java/com/fanruan/api/attachment/Attachment.java b/src/main/java/com/fanruan/api/attachment/Attachment.java deleted file mode 100644 index e3e1e61..0000000 --- a/src/main/java/com/fanruan/api/attachment/Attachment.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fanruan.api.attachment; - -import com.fr.cache.AttachmentFileBase; -/** - * 附件信息类,用来存储FR中的各种附件 - * */ -public class Attachment extends com.fr.cache.Attachment{ - /** - * 根据给定的编号、类型、文件名和二进制数组创建一个附件对象 - * */ - public Attachment(String id, String type, String filename, AttachmentFileBase attachmentFileBase){ - super(id, type, filename, attachmentFileBase); - } - /** - * 根据给定的编号、类型、文件名、二进制数组、宽度和高度创建一个附件对象 - * */ - public Attachment(String id, String type, String filename, AttachmentFileBase attachmentFileBase, int width, int height){ - super(id, type, filename, attachmentFileBase, width, height); - } -} diff --git a/src/main/java/com/fanruan/api/xml/component/FRFile.java b/src/main/java/com/fanruan/api/xml/component/FRFile.java deleted file mode 100644 index e62b732..0000000 --- a/src/main/java/com/fanruan/api/xml/component/FRFile.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fanruan.api.xml.component; - -/** -* FR文件类,用于表示具有指定名字、类型和内容的文件 -* */ -public class FRFile extends com.fr.stable.xml.FRFile{ - /** - * 根据指定的文件类型,文件名以及文件内容生成一个文件 - * */ - public FRFile(String type, String filename, byte[] bytes){ - super(type, filename, bytes); - } -} From 2706950e44dd0afc7bab134abfeb7843707d0202 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 18 Sep 2019 17:29:59 +0800 Subject: [PATCH 6/7] =?UTF-8?q?update:=20=E4=BF=AE=E6=94=B9=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/conf/HolderKit.java | 1 - src/main/java/com/fanruan/api/i18n/I18nKit.java | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fanruan/api/conf/HolderKit.java b/src/main/java/com/fanruan/api/conf/HolderKit.java index 3f3e878..3e1f5b3 100644 --- a/src/main/java/com/fanruan/api/conf/HolderKit.java +++ b/src/main/java/com/fanruan/api/conf/HolderKit.java @@ -6,7 +6,6 @@ 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.factory.Holders; import java.util.Collection; diff --git a/src/main/java/com/fanruan/api/i18n/I18nKit.java b/src/main/java/com/fanruan/api/i18n/I18nKit.java index e4e56d1..74a95c9 100644 --- a/src/main/java/com/fanruan/api/i18n/I18nKit.java +++ b/src/main/java/com/fanruan/api/i18n/I18nKit.java @@ -1,4 +1,5 @@ package com.fanruan.api.i18n; + import com.fr.locale.InterProviderFactory; public class I18nKit { @@ -11,14 +12,15 @@ public class I18nKit { public static String getLocText(String string) { return InterProviderFactory.getProvider().getLocText(string); } + /** * 获取国际化文本 * * @param string 需要国际化的值对应的键 - * @param args 变量 + * @param args 变量 * @return 返回国际化文本 */ - public static String getLocText(String string,String... args) { - return InterProviderFactory.getProvider().getLocText(string,args); + public static String getLocText(String string, String... args) { + return InterProviderFactory.getProvider().getLocText(string, args); } } From df637a7ef8725123462a09fe7e53ddd55573e781 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 18 Sep 2019 18:09:09 +0800 Subject: [PATCH 7/7] =?UTF-8?q?update:=20=E5=88=A0=E5=8E=BBFarray?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/cal/namespace/FArray.java | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/cal/namespace/FArray.java diff --git a/src/main/java/com/fanruan/api/cal/namespace/FArray.java b/src/main/java/com/fanruan/api/cal/namespace/FArray.java deleted file mode 100644 index 51c59b8..0000000 --- a/src/main/java/com/fanruan/api/cal/namespace/FArray.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fanruan.api.cal.namespace; -import java.util.Collection; - -/** - * 生成一个链表类 - * */ -public class FArray extends com.fr.general.FArray{ - public FArray(){ - - } - /** - * 通过使用一个无需集合生成的链表类 - * */ - public FArray(Collection collection) { - super(collection); - } - /** - * 通过使用一个数组生成的链表类 - * */ - public FArray(T[] array) { - super(array); - } -}