diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..0f444d2 --- /dev/null +++ b/Readme.md @@ -0,0 +1,4 @@ +## 数据工厂二次开发DEMO + +#### 效果图 +![](image.png) diff --git a/image.png b/image.png new file mode 100644 index 0000000..0a561c4 Binary files /dev/null and b/image.png differ diff --git a/plugin.xml b/plugin.xml index a2ad36a..8b0ec9b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ - com.fr.plugin.jee.tabledata.factory.combo - + com.fr.plugin.jee.tabledata.factory.demo + yes 1.0 10.0 @@ -17,7 +17,6 @@ - diff --git a/src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoLoader.java b/src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoLoader.java index be85256..a59ca88 100644 --- a/src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoLoader.java +++ b/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 diff --git a/src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoResolver.java b/src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoResolver.java index 5f45419..d91f074 100644 --- a/src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoResolver.java +++ b/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"; } }