Browse Source

KERNEL-1117 改变了basekit和GUICoreKit的位置,补充了之前的类文件

remotes/1611766341912730171/master
Kalven 5 years ago
parent
commit
0d7f2c59e5
  1. 24
      src/main/java/com/fanruan/api/design/util/GUICoreKit.java
  2. 10
      src/main/java/com/fanruan/api/util/ArrayKit.java
  3. 15
      src/main/java/com/fanruan/api/util/GeneralKit.java
  4. 16
      src/main/java/com/fanruan/api/util/StableKit.java
  5. 19
      src/main/java/com/fanruan/api/util/TemplateKit.java
  6. 15
      src/test/java/com/fanruan/api/util/GeneralKitTest.java
  7. 14
      src/test/java/com/fanruan/api/util/StableKitTest.java

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

@ -0,0 +1,24 @@
package com.fanruan.api.design.util;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
public class GUICoreKit {
public static JPanel createFlowPane(Object... var0) {
return GUICoreUtils.createFlowPane(var0);
}
/**
* 弹出菜单在坐标为x,y处弹出内容为component的菜单
* @param menu
* @param component
* @param x
* @param y
*/
public static void showPopupMenu(JPopupMenu menu, Component component, int x, int y) {
GUICoreUtils.showPopupMenu(menu, component, x, y);
}
}

10
src/main/java/com/fanruan/api/util/ArrayKit.java

@ -82,4 +82,14 @@ public class ArrayKit {
* @return 返回增加元素后的数组
*/
public static <T> T[] addAll(T[] array, T... element){return ArrayUtils.addAll(array, element);};
/**
* 判断数组是否为不空
* @param array
* @param <T>
* @return 若数组array不空返回true否则返回false
*/
public static <T> boolean isNotEmpty(T[] array) {
return ArrayUtils.isNotEmpty(array);
}
}

15
src/main/java/com/fanruan/api/util/GeneralKit.java

@ -1,5 +1,6 @@
package com.fanruan.api.util;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -50,7 +51,21 @@ public class GeneralKit {
return GeneralUtils.objectToNumber(obj, returnNull);
}
/**
* 读取jar的版本号
* @return 返回jar版本号
*/
public static @Nullable String readBuildNO() {
return GeneralUtils.readBuildNO();
}
/**
* 返回两个对象比较的大小
* @param obj1
* @param obj2
* @return 若相等返回0obj1小于obj2返回负数否则返回正数
*/
public static int compare(Object obj1, Object obj2) {
return ComparatorUtils.compare(obj1, obj2);
}
}

16
src/main/java/com/fanruan/api/util/StableKit.java

@ -0,0 +1,16 @@
package com.fanruan.api.util;
import com.fr.stable.StableUtils;
public class StableKit {
/**
* 判断class1是否是class2的子类实例化
* @param class1
* @param class2
* @return 返回判断结果
*/
public static boolean classInstanceOf(Class class1, Class class2) {
return StableUtils.classInstanceOf(class1, class2);
}
}

19
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 map
* @return 返回计算后的值
* @throws Exception
*/
public static String renderParameter4Tpl(String tpl, Map map) throws Exception {
return TemplateUtils.renderParameter4Tpl(tpl, map);
}
}

15
src/test/java/com/fanruan/api/util/GeneralKitTest.java

@ -1,6 +1,8 @@
package com.fanruan.api.util;
import com.fanruan.api.Prepare;
import com.fr.general.GeneralUtils;
import com.fr.third.javax.persistence.criteria.CriteriaBuilder;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,18 @@ public class GeneralKitTest extends Prepare {
@Test
public void readBuildNO() {
Assert.assertEquals(GeneralKit.readBuildNO(), com.fr.general.GeneralUtils.readBuildNO());
Assert.assertEquals(GeneralKit.readBuildNO(), GeneralUtils.readBuildNO());
}
@Test
public void compare() {
Integer s = new Integer(1);
Integer s3 = new Integer(1);
Integer s1 = new Integer(2);
Integer s2 = new Integer(0);
Assert.assertEquals(GeneralKit.compare(s,s1),-1);
Assert.assertEquals(GeneralKit.compare(s,s3),0);
Assert.assertEquals(GeneralKit.compare(s,s2),1);
}
}

14
src/test/java/com/fanruan/api/util/StableKitTest.java

@ -0,0 +1,14 @@
package com.fanruan.api.util;
import org.junit.Test;
import static org.junit.Assert.*;
public class StableKitTest {
@Test
public void classInstanceOf() {
assertEquals(StableKit.classInstanceOf(Integer.class,Object.class),true);
assertEquals(StableKit.classInstanceOf(Object.class,Integer.class),false);
}
}
Loading…
Cancel
Save