Browse Source

1.0.0 init

V3
Nicholas.Jee 3 years ago
parent
commit
0258b29e5e
  1. 4
      Readme.md
  2. BIN
      image.png
  3. 5
      plugin.xml
  4. 19
      src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoLoader.java
  5. 24
      src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoResolver.java

4
Readme.md

@ -0,0 +1,4 @@
## 数据工厂二次开发DEMO
#### 效果图
![](image.png)

BIN
image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

5
plugin.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>com.fr.plugin.jee.tabledata.factory.combo</id>
<name><![CDATA[数据工厂soap]]></name>
<id>com.fr.plugin.jee.tabledata.factory.demo</id>
<name><![CDATA[数据工厂demo]]></name>
<active>yes</active>
<version>1.0</version>
<env-version>10.0</env-version>
@ -17,7 +17,6 @@
<extra-core>
<TableDataLoader class="com.fr.plugin.tptj.tabledata.factory.demo.DemoLoader"/>
<TableDataResolver class="com.fr.plugin.tptj.tabledata.factory.demo.DemoResolver"/>
</extra-core>
<function-recorder class="com.fr.plugin.tptj.tabledata.factory.demo.DemoLoader"/>

19
src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoLoader.java

@ -1,19 +1,28 @@
package com.fr.plugin.tptj.tabledata.factory.demo;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.tptj.plugin.hg.impl.AbstractLoader;
@FunctionRecorder
public class DemoLoader extends AbstractLoader {
/**
*
* @param calculator 模板算子负责各种计算
* @param parameterProviders 额外参数others里没匹配的部分可以用来实现一些额外逻辑
* @param others 装载器面板内容已自动匹配
* @return
*/
@Override
public Object load(Calculator calculator, ParameterProvider[] parameterProviders, String s) {
public Object load(Calculator calculator, ParameterProvider[] parameterProviders, String others) {
return s;
return others;
}
@ExecuteFunctionRecord
@Override
public String getName() {
return "DEMO";
return "DEMO_LOADER"; //有国际化需求的这里可以直接写i18n的key
}
@Override

24
src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoResolver.java

@ -1,22 +1,38 @@
package com.fr.plugin.tptj.tabledata.factory.demo;
import com.fr.log.FineLoggerFactory;
import com.tptj.plugin.hg.impl.AbstractLoader;
import com.tptj.plugin.hg.impl.AbstractResolver;
import com.tptj.plugin.hg.stable.SimpleDataModel;
public class DemoResolver extends AbstractResolver {
/**
*
* @param data 来自装载器传来的数据
* @param others 来自解析器面板参数已经自动匹配了
* @return
*/
@Override
public SimpleDataModel parse(Object o, String s) {
return null;
public SimpleDataModel parse(Object data, String others) {
SimpleDataModel dm = new SimpleDataModel();
dm.addColumn("data"); //添加一个列名
try {
dm.addRow(new String[]{(String) data}); //添加一列数据,这里把原始数据塞到了第一行
return dm;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
return new SimpleDataModel();
}
@Override
public String getName() {
return null;
return "DEMO_RESOLVER"; //有国际化需求的这里可以直接写i18n的key
}
@Override
public String getDefaultConfig() {
return null;
return "DefaultConfig";
}
}

Loading…
Cancel
Save