Browse Source

Merge pull request #27 in TC/finekit from ~KALVEN/finekit:master to master

* commit '67db510afb14fad2c7648860115138650137f83c':
  KERNEL-1161 根据要求修改
  KERNEL-1161 更改fineKit,GeneralKit中的方法暂时没有测试
pull/19/head
superman 5 years ago
parent
commit
07e3c81259
  1. 10
      src/main/java/com/fanruan/api/cal/CalculatorKit.java
  2. 11
      src/main/java/com/fanruan/api/design/macro/XCreatorConstants.java
  3. 26
      src/main/java/com/fanruan/api/design/ui/component/UIList.java
  4. 10
      src/main/java/com/fanruan/api/design/ui/container/AbstractDataModify.java
  5. 10
      src/main/java/com/fanruan/api/design/ui/container/DictionaryPane.java
  6. 20
      src/main/java/com/fanruan/api/design/ui/container/XLayoutContainer.java
  7. 15
      src/main/java/com/fanruan/api/design/ui/editor/AccessiblePropertyEditor.java
  8. 10
      src/main/java/com/fanruan/api/design/ui/editor/CustomWriteAbleRepeatEditor.java
  9. 15
      src/main/java/com/fanruan/api/design/ui/editor/ItemCellEditor.java
  10. 15
      src/main/java/com/fanruan/api/design/ui/editor/UneditableAccessibleEditor.java
  11. 18
      src/main/java/com/fanruan/api/design/ui/editor/WidgetValueEditor.java
  12. 17
      src/main/java/com/fanruan/api/design/ui/editor/XFieldEditor.java
  13. 15
      src/main/java/com/fanruan/api/design/work/EncoderCellRenderer.java
  14. 12
      src/main/java/com/fanruan/api/design/work/Item.java
  15. 10
      src/main/java/com/fanruan/api/function/FunctionKit.java
  16. 9
      src/main/java/com/fanruan/api/util/ArrayKit.java
  17. 5
      src/main/java/com/fanruan/api/util/GeneralKit.java
  18. 4
      src/test/java/com/fanruan/api/function/FunctionKitTest.java
  19. 8
      src/test/java/com/fanruan/api/util/ArrayKitTest.java
  20. 2
      src/test/java/com/fanruan/api/util/GeneralKitTest.java

10
src/main/java/com/fanruan/api/cal/CalculatorKit.java

@ -8,6 +8,7 @@ import com.fr.data.TableDataSource;
import com.fr.report.core.namespace.SimpleCellValueNameSpace; import com.fr.report.core.namespace.SimpleCellValueNameSpace;
import com.fr.report.report.Report; import com.fr.report.report.Report;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.script.TreeLayerNameSpace;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.script.CalculatorProvider; import com.fr.stable.script.CalculatorProvider;
import com.fr.stable.script.NameSpace; import com.fr.stable.script.NameSpace;
@ -95,4 +96,13 @@ public class CalculatorKit {
public static NameSpace createSimpleCellValueNameSpace() { public static NameSpace createSimpleCellValueNameSpace() {
return SimpleCellValueNameSpace.getInstance(); return SimpleCellValueNameSpace.getInstance();
} }
/**
* 创建一个计算树状组件的命名空间
* @param layIndexMap 树状组件中的值
* @return 树状组件的命名空间
*/
public static NameSpace createTreeLayerNameSpace(Map layIndexMap) {
return new TreeLayerNameSpace(layIndexMap);
}
} }

11
src/main/java/com/fanruan/api/design/macro/XCreatorConstants.java

@ -0,0 +1,11 @@
package com.fanruan.api.design.macro;
/**
* 存放XCreator的常量
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/3
*/
public class XCreatorConstants {
public static final String PROPERTY_CATEGORY = com.fr.design.form.util.XCreatorConstants.PROPERTY_CATEGORY;
}

26
src/main/java/com/fanruan/api/design/ui/component/UIList.java

@ -0,0 +1,26 @@
package com.fanruan.api.design.ui.component;
import javax.swing.*;
import java.util.Vector;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
* 列表组件
*/
public class UIList extends com.fr.design.gui.ilist.UIList {
public UIList(ListModel dataModel) {
super(dataModel);
}
public UIList(Object[] listData) {
super(listData);
}
public UIList(Vector<?> listData) {
super(listData);
}
}

10
src/main/java/com/fanruan/api/design/ui/container/AbstractDataModify.java

@ -0,0 +1,10 @@
package com.fanruan.api.design.ui.container;
/**
* 抽象数据定义实现数据可序列化
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/3
*/
public abstract class AbstractDataModify<T> extends com.fr.design.widget.ui.AbstractDataModify<T> {
}

10
src/main/java/com/fanruan/api/design/ui/container/DictionaryPane.java

@ -0,0 +1,10 @@
package com.fanruan.api.design.ui.container;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
* 数据字典容器获取数据字典
*/
public class DictionaryPane extends com.fr.design.present.dict.DictionaryPane {
}

20
src/main/java/com/fanruan/api/design/ui/container/XLayoutContainer.java

@ -0,0 +1,20 @@
package com.fanruan.api.design.ui.container;
import com.fr.form.ui.container.WLayout;
import java.awt.*;
/**
*
* 属性设置部分布局容器
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/3
*/
public abstract class XLayoutContainer extends com.fr.design.designer.creator.XLayoutContainer {
public XLayoutContainer(WLayout widget, Dimension initSize) {
super(widget, initSize);
this.addContainerListener(this);
}
}

15
src/main/java/com/fanruan/api/design/ui/editor/AccessiblePropertyEditor.java

@ -0,0 +1,15 @@
package com.fanruan.api.design.ui.editor;
import com.fr.design.mainframe.widget.accessibles.AccessibleEditor;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
* 可以通过按钮或其他方式进去编辑面板的编辑器
*/
public class AccessiblePropertyEditor extends com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor {
public AccessiblePropertyEditor(AccessibleEditor editor) {
super(editor);
}
}

10
src/main/java/com/fanruan/api/design/ui/editor/CustomWriteAbleRepeatEditor.java

@ -0,0 +1,10 @@
package com.fanruan.api.design.ui.editor;
/**
* 允许自定义值的允许直接编辑的带重复的 --- 下拉框 下拉复选框 下拉树
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
*/
public abstract class CustomWriteAbleRepeatEditor extends com.fr.form.ui.CustomWriteAbleRepeatEditor {
}

15
src/main/java/com/fanruan/api/design/ui/editor/ItemCellEditor.java

@ -0,0 +1,15 @@
package com.fanruan.api.design.ui.editor;
import com.fr.design.designer.properties.items.Item;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
* 用作左中右对齐设置的下拉框Editor
*/
public class ItemCellEditor extends com.fr.design.mainframe.widget.editors.ItemCellEditor {
public ItemCellEditor(Item[] items) {
super(items);
}
}

15
src/main/java/com/fanruan/api/design/ui/editor/UneditableAccessibleEditor.java

@ -0,0 +1,15 @@
package com.fanruan.api.design.ui.editor;
import com.fr.design.designer.properties.Encoder;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
* 无法修改的编辑器
*/
public abstract class UneditableAccessibleEditor extends com.fr.design.mainframe.widget.accessibles.UneditableAccessibleEditor {
public UneditableAccessibleEditor(Encoder enc) {
super(enc);
}
}

18
src/main/java/com/fanruan/api/design/ui/editor/WidgetValueEditor.java

@ -0,0 +1,18 @@
package com.fanruan.api.design.ui.editor;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
* 控件值的编辑器
*/
public class WidgetValueEditor extends com.fr.design.mainframe.widget.editors.WidgetValueEditor {
public WidgetValueEditor(Object o) {
super(o);
}
public WidgetValueEditor(Object o, boolean onlyServer) {
super(o, onlyServer);
}
}

17
src/main/java/com/fanruan/api/design/ui/editor/XFieldEditor.java

@ -0,0 +1,17 @@
package com.fanruan.api.design.ui.editor;
import com.fr.form.ui.FieldEditor;
import java.awt.*;
/**
* 控件树
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/3
*/
public abstract class XFieldEditor extends com.fr.design.designer.creator.XFieldEditor {
public XFieldEditor(FieldEditor widget, Dimension initSize) {
super(widget, initSize);
}
}

15
src/main/java/com/fanruan/api/design/work/EncoderCellRenderer.java

@ -0,0 +1,15 @@
package com.fanruan.api.design.work;
import com.fr.design.designer.properties.Encoder;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
* 根据控件属性渲染单元格
*/
public class EncoderCellRenderer extends com.fr.design.mainframe.widget.renderer.EncoderCellRenderer {
public EncoderCellRenderer(Encoder encoder) {
super(encoder);
}
}

12
src/main/java/com/fanruan/api/design/work/Item.java

@ -0,0 +1,12 @@
package com.fanruan.api.design.work;
/**
* @author Kalven
* @version 10.0
* Created by Kalven on 2019/9/4
*/
public class Item extends com.fr.design.designer.properties.items.Item {
public Item(String name, Object value) {
super(name, value);
}
}

10
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.file.FunctionManagerProvider;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.fun.FunctionHelper;
import com.fr.stable.script.FunctionDef; import com.fr.stable.script.FunctionDef;
import java.util.ArrayList; import java.util.ArrayList;
@ -84,4 +85,13 @@ public class FunctionKit {
public static com.fr.file.FunctionManager getInstance() { public static com.fr.file.FunctionManager getInstance() {
return com.fr.file.FunctionManager.getInstance(); return com.fr.file.FunctionManager.getInstance();
} }
/**
* 根据插件ID生成整数类型的标识符
* @param stringID
* @return
*/
public static int generateFunctionID(String stringID) {
return FunctionHelper.generateFunctionID(stringID);
}
} }

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

@ -102,4 +102,13 @@ public class ArrayKit {
public static <T> List<T> toList(T[] array) { public static <T> List<T> toList(T[] array) {
return ArrayUtils.toList(array); return ArrayUtils.toList(array);
} }
/**
* 求数组长度
* @param array 数组
* @return 长度
*/
public static int getLength(Object array) {
return ArrayUtils.getLength(array);
}
} }

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

@ -3,8 +3,12 @@ package com.fanruan.api.util;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.guava.base.Objects; import com.fr.third.guava.base.Objects;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -93,4 +97,5 @@ public class GeneralKit {
return FRContext.getLocale(); return FRContext.getLocale();
} }
} }

4
src/test/java/com/fanruan/api/function/FunctionKitTest.java

@ -42,4 +42,8 @@ public class FunctionKitTest extends Prepare {
assertNotEquals("OK", result); assertNotEquals("OK", result);
} }
@Test
public void generateFunctionID() {
assertEquals(FunctionKit.generateFunctionID("com.fr.plugin.widget.ztree"),169608572);
}
} }

8
src/test/java/com/fanruan/api/util/ArrayKitTest.java

@ -110,4 +110,12 @@ public class ArrayKitTest extends Prepare {
Assert.assertEquals(ArrayKit.toList(array),result); Assert.assertEquals(ArrayKit.toList(array),result);
} }
@Test
public void getLength() {
int[] a = new int[0];
int[] b = new int[2];
Assert.assertEquals(ArrayKit.getLength(a),0);
Assert.assertEquals(ArrayKit.getLength(null),0);
Assert.assertEquals(ArrayKit.getLength(b),2);
}
} }

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

@ -3,6 +3,7 @@ package com.fanruan.api.util;
import com.fanruan.api.Prepare; import com.fanruan.api.Prepare;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.xml.XMLableReader;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -53,4 +54,5 @@ public class GeneralKitTest extends Prepare {
public void getLocale() { public void getLocale() {
Assert.assertEquals(GeneralKit.getLocale(), Locale.CHINA); Assert.assertEquals(GeneralKit.getLocale(), Locale.CHINA);
} }
} }
Loading…
Cancel
Save