Browse Source

Merge pull request #32 in TC/finekit from ~ZHAOJUNZHE/finekit:master to master

* commit 'df637a7ef8725123462a09fe7e53ddd55573e781':
  update: 删去Farray
  update: 修改格式
  update: 删去FRFile和attachment
  update: finekit的一些补充。
  删去不必要的方法
  update: 新增方法
  feat: 新增createBorderLayout方法。
master
superman 5 years ago
parent
commit
9be25083ca
  1. 1
      src/main/java/com/fanruan/api/conf/HolderKit.java
  2. 1
      src/main/java/com/fanruan/api/design/util/GUICoreKit.java
  3. 12
      src/main/java/com/fanruan/api/i18n/I18nKit.java
  4. 2
      src/main/java/com/fanruan/api/util/ArrayKit.java
  5. 8
      src/main/java/com/fanruan/api/util/CodeKit.java
  6. 9
      src/main/java/com/fanruan/api/util/GeneralKit.java
  7. 10
      src/main/java/com/fanruan/api/xml/XmlKit.java
  8. 33
      src/test/java/com/fanruan/api/util/ArrayKitTest.java
  9. 4
      src/test/java/com/fanruan/api/util/CodeKitTest.java
  10. 6
      src/test/java/com/fanruan/api/util/GeneralKitTest.java

1
src/main/java/com/fanruan/api/conf/HolderKit.java

@ -7,6 +7,7 @@ import com.fanruan.api.conf.impl.ObjectMapConf;
import com.fanruan.api.conf.impl.SimConf;
import com.fr.config.holder.Conf;
import java.util.Collection;
import java.util.Map;

1
src/main/java/com/fanruan/api/design/util/GUICoreKit.java

@ -118,7 +118,6 @@ public class GUICoreKit {
public static JPanel createBorderLayoutPane() {
return FRGUIPaneFactory.createBorderLayout_S_Pane();
}
/**
* 设置一个窗口居中
*/

12
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,4 +12,15 @@ 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);
}
}

2
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 <T> boolean isEmpty(T[] array) {
return ArrayUtils.isEmpty(array);
}
/**

8
src/main/java/com/fanruan/api/util/CodeKit.java

@ -12,6 +12,14 @@ 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);
}
/**
* 将经过处理的中日韩文字符串解码成原先的中日韩文

9
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);
}
}

10
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 com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.StableXMLUtils;
@ -78,7 +79,14 @@ 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);
}
/**
* 读出xml参数
*

33
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

4
src/test/java/com/fanruan/api/util/CodeKitTest.java

@ -7,8 +7,8 @@ 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)");
}
@Test

6
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");
}
}
Loading…
Cancel
Save