Browse Source

Merge branch 'master' of https://cloud.finedevelop.com/scm/tc/finekit

* 'master' of https://cloud.finedevelop.com/scm/tc/finekit:
  KERNEL-1117 修改函数名和参数名
  KERNEL-1117 加入单元测试,更改名称
  KERNEL-1117 避免Parameter接口暴露
  KERNEL-1117 再次修改
  KERNEL-1117 加上注释
  KERNEL-1117 根据要求再次修改
  KERNEL-1117 按要求进行更改
  KERNEL-1117 根据要求进行修改
  KERNEL-1117 再次进行修改
  KERNEL-1117 发现之前遗漏的地方,进行补充
  KERNEL-1117 根据要求进行了修改
  KERNEL-1117 根据插件增加了fineKit的部分文件,其中单例模式返回单例的方法没有进行单元测试
  KERNEL-1117 根据插件增加了fineKit的部分文件,其中单例模式返回单例的方法没有进行单元测试

# Conflicts:
#	src/main/java/com/fanruan/api/cal/ParameterKit.java
#	src/main/java/com/fanruan/api/util/GeneralKit.java
#	src/test/java/com/fanruan/api/util/GeneralKitTest.java
master
zjz1993 5 years ago
parent
commit
42b6f17080
  1. 9
      src/main/java/com/fanruan/api/cal/ParameterKit.java
  2. 20
      src/main/java/com/fanruan/api/design/DesignKit.java
  3. 12
      src/main/java/com/fanruan/api/design/ui/component/UIQuickList.java
  4. 10
      src/main/java/com/fanruan/api/design/ui/component/UIRadioPane.java
  5. 8
      src/main/java/com/fanruan/api/design/ui/container/DialogActionAdapter.java
  6. 16
      src/main/java/com/fanruan/api/design/work/ParameterInputPane.java
  7. 29
      src/main/java/com/fanruan/api/function/FunctionKit.java
  8. 1
      src/main/java/com/fanruan/api/log/LogKit.java
  9. 46
      src/main/java/com/fanruan/api/macro/OperatingSystem.java
  10. 19
      src/main/java/com/fanruan/api/macro/ProductConstants.java
  11. 10
      src/main/java/com/fanruan/api/util/GeneralKit.java
  12. 7
      src/test/java/com/fanruan/api/cal/ParameterKitTest.java
  13. 10
      src/test/java/com/fanruan/api/util/GeneralKitTest.java

9
src/main/java/com/fanruan/api/cal/ParameterKit.java

@ -37,6 +37,15 @@ public class ParameterKit {
return new Parameter(name, value);
}
/**
* 根据参数名创建新的参数对象
* @param name 参数名
* @return 参数对象
*/
public static @NotNull ParameterProvider newParameter(String name) {
return new Parameter(name);
}
/**
* 从字符串中分析中有哪些需要的参数
*

20
src/main/java/com/fanruan/api/design/DesignKit.java

@ -2,7 +2,11 @@ package com.fanruan.api.design;
import com.fr.base.TableData;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate;
public class DesignKit {
/**
@ -31,4 +35,20 @@ public class DesignKit {
public static String i18nText(String key, Object... args) {
return Toolkit.i18nText(key, args);
}
/**
* 单例模式返回DesignerFrame对象
* @return DesignerFrame对象
*/
public static DesignerFrame getDesignerFrame() {
return DesignerContext.getDesignerFrame();
}
/**
* 得到当前在修改的模板
* @return 返回当前正在编辑的模板
*/
public static JTemplate<?, ?> getCurrentEditingTemplate(){
return HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
}
}

12
src/main/java/com/fanruan/api/design/ui/component/UIQuickList.java

@ -0,0 +1,12 @@
package com.fanruan.api.design.ui.component;
import javax.swing.*;
/**
* 支持键盘输入快速查找项的JList
*/
public class UIQuickList extends com.fr.design.gui.ilist.QuickList {
public UIQuickList(ListModel listModel) {
super(listModel);
}
}

10
src/main/java/com/fanruan/api/design/ui/component/UIRadioPane.java

@ -0,0 +1,10 @@
package com.fanruan.api.design.ui.component;
/**
* 可以存放按钮组件的容器
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/8/30
*/
public abstract class UIRadioPane<T> extends com.fr.design.gui.frpane.UIRadioPane<T> {
}

8
src/main/java/com/fanruan/api/design/ui/container/DialogActionAdapter.java

@ -1,8 +0,0 @@
package com.fanruan.api.design.ui.container;
public class DialogActionAdapter extends com.fr.design.dialog.DialogActionAdapter {
public DialogActionAdapter() {
}
}

16
src/main/java/com/fanruan/api/design/work/ParameterInputPane.java

@ -0,0 +1,16 @@
package com.fanruan.api.design.work;
import com.fr.stable.ParameterProvider;
/**
* 用于输入参数的容器
*/
public class ParameterInputPane extends com.fr.design.parameter.ParameterInputPane {
public ParameterInputPane(ParameterProvider[] parameters) {
super(parameters);
}
public ParameterInputPane(ParameterProvider[] parameters, boolean allowBlank) {
super(parameters, allowBlank);
}
}

29
src/main/java/com/fanruan/api/function/FunctionKit.java

@ -1,7 +1,10 @@
package com.fanruan.api.function;
import com.fanruan.api.function.shell.FineFunc;
import com.fr.design.formula.FunctionDefNAD;
import com.fr.design.formula.NameAndDescription;
import com.fr.file.FunctionManager;
import com.fr.file.FunctionManagerProvider;
import com.fr.script.Calculator;
import com.fr.stable.StringUtils;
import com.fr.stable.script.FunctionDef;
@ -55,4 +58,30 @@ public class FunctionKit {
FunctionManager.getInstance().addFunctionDef(fun);
}
}
/**
* 得到描述函数管理器中所有的函数的名称描述
* @return 函数的名称描述数组
*/
public static NameAndDescription[] getDescription() {
FunctionManagerProvider funtionManager = FunctionKit.getInstance();
if (funtionManager != null) {
int functionDefCount = funtionManager.getFunctionDefCount();
FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount];
for (int i = 0; i < functionDefCount; i++) {
nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i));
}
return nads;
}
return new NameAndDescription[0];
}
/**
* 得到函数管理器实例
* @return 函数管理器
*/
public static com.fr.file.FunctionManager getInstance() {
return com.fr.file.FunctionManager.getInstance();
}
}

1
src/main/java/com/fanruan/api/log/LogKit.java

@ -160,4 +160,5 @@ public class LogKit {
public static void error(Throwable e, String format, Object... args) {
FineLoggerFactory.getLogger().error(e, format, args);
}
}

46
src/main/java/com/fanruan/api/macro/OperatingSystem.java

@ -0,0 +1,46 @@
package com.fanruan.api.macro;
import com.fr.stable.os.AbstractOperatingSystem;
/**
* 操作系统判断类判断操作系统种类
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/8/31
*/
public class OperatingSystem {
/**
* 得到当前操作系统信息
*/
private static final AbstractOperatingSystem myOS = com.fr.stable.os.OperatingSystem.getOperatingSystem();
private OperatingSystem() {
}
/**
* 判断系统是否是Windows
* @return 判断结果
*/
public static boolean isWindows() {
return myOS.getType() == com.fr.stable.os.OperatingSystem.WINDOWS;
}
/**
* 判断系统是否是Unix
* @return 判断结果
*/
public static boolean isUnix() {
return myOS.isUnix();
}
/**
* 判断系统是否是MacOS
* @return 判断结果
*/
public static boolean isMacOS() {
return myOS.getType() == com.fr.stable.os.OperatingSystem.MACOS;
}
}

19
src/main/java/com/fanruan/api/macro/ProductConstants.java

@ -0,0 +1,19 @@
package com.fanruan.api.macro;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/8/30
*/
public class ProductConstants {
/**
* 详细的产品名字
*/
public static final String PRODUCT_NAME = com.fr.stable.ProductConstants.PRODUCT_NAME;
/**
* 大的版本号
*/
public static final String MAIN_VERSION = com.fr.stable.ProductConstants.MAIN_VERSION;
}

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

@ -1,5 +1,6 @@
package com.fanruan.api.util;
import com.fr.base.FRContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.stable.CommonUtils;
@ -9,6 +10,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.Locale;
import java.util.Map;
/**
@ -81,4 +83,12 @@ public class GeneralKit {
public static String join(Object[] array, String se) {
return StableUtils.join(array, se);
}
/*
* 返回国际化区属
* @return 国际化后区域属性
*/
@Deprecated
public static Locale getLocale() {
return FRContext.getLocale();
}
}

7
src/test/java/com/fanruan/api/cal/ParameterKitTest.java

@ -107,4 +107,11 @@ public class ParameterKitTest extends Prepare {
Assert.assertEquals("p1", provider.getName());
Assert.assertEquals("124", provider.getValue());
}
@Test
public void newParameter2() {
ParameterProvider provider = ParameterKit.newParameter("p1");
Assert.assertEquals(provider.getName(),"p1");
Assert.assertEquals("", provider.getValue());
}
}

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

@ -5,6 +5,8 @@ import com.fr.general.GeneralUtils;
import org.junit.Assert;
import org.junit.Test;
import java.util.Locale;
/**
* @author richie
* @version 10.0
@ -42,8 +44,12 @@ public class GeneralKitTest extends Prepare {
@Test
public void join() {
Object obj [] = {1,2,3,4};
Object obj[] = {1, 2, 3, 4};
String result = "1-2-3-4";
Assert.assertEquals(GeneralKit.join(obj, "-"),result);
Assert.assertEquals(GeneralKit.join(obj, "-"), result);
}
@Test
public void getLocale() {
Assert.assertEquals(GeneralKit.getLocale(), Locale.CHINA);
}
}
Loading…
Cancel
Save