Compare commits

..

2 Commits
V3 ... master

  1. 1
      Readme.md
  2. 4
      build.gradle
  3. BIN
      lib/report/fine-plugin-data-factory-2.3.3.jar
  4. BIN
      lib/report/fine-plugin-data-factory-2.5.13.jar
  5. 12
      plugin.xml
  6. 29
      src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoFilter.java
  7. 26
      src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoFormatter.java
  8. 31
      src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoPreprocessor.java
  9. 62
      src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/TextTable.java

1
Readme.md

@ -2,3 +2,4 @@
#### 效果图 #### 效果图
![](image.png) ![](image.png)

4
build.gradle

@ -1,7 +1,9 @@
apply plugin: 'java' apply plugin: 'java'
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
ext { ext {
/** /**
* jar的路径 * jar的路径

BIN
lib/report/fine-plugin-data-factory-2.3.3.jar

Binary file not shown.

BIN
lib/report/fine-plugin-data-factory-2.5.13.jar

Binary file not shown.

12
plugin.xml

@ -3,8 +3,8 @@
<id>com.fr.plugin.jee.tabledata.factory.demo</id> <id>com.fr.plugin.jee.tabledata.factory.demo</id>
<name><![CDATA[数据工厂demo]]></name> <name><![CDATA[数据工厂demo]]></name>
<active>yes</active> <active>yes</active>
<version>1.0</version> <version>1.2</version>
<env-version>10.0</env-version> <env-version>10.0~11.0</env-version>
<jartime>2018-07-31</jartime> <jartime>2018-07-31</jartime>
<vendor>jee</vendor> <vendor>jee</vendor>
<description><![CDATA[ <description><![CDATA[
@ -18,10 +18,14 @@
<extra-core> <extra-core>
<TableDataLoader class="com.fr.plugin.tptj.tabledata.factory.demo.DemoLoader"/> <TableDataLoader class="com.fr.plugin.tptj.tabledata.factory.demo.DemoLoader"/>
<TableDataResolver class="com.fr.plugin.tptj.tabledata.factory.demo.DemoResolver"/> <TableDataResolver class="com.fr.plugin.tptj.tabledata.factory.demo.DemoResolver"/>
<TableDataPreprocessor class="com.fr.plugin.tptj.tabledata.factory.demo.DemoPreprocessor"/>
<TableDataFormatter class="com.fr.plugin.tptj.tabledata.factory.demo.DemoFormatter"/>
<TableDataFilter class="com.fr.plugin.tptj.tabledata.factory.demo.DemoFilter"/>
<TableDataConfigTable class="com.fr.plugin.tptj.tabledata.factory.demo.TextTable"/>
</extra-core> </extra-core>
<function-recorder class="com.fr.plugin.tptj.tabledata.factory.demo.DemoLoader"/> <function-recorder class="com.fr.plugin.tptj.tabledata.factory.demo.DemoLoader"/>
<dependence> <dependence>
<Item key="com.tptj.plugin.hg.tabledata.factory.v10" type="plugin"/> <!-- 依赖于数据工厂主框架 --> <Item key="com.tptj.plugin.hg.tabledata.factory.v11" type="plugin"/> <!-- 依赖于数据工厂主框架 -->
</dependence> </dependence>
</plugin> </plugin>

29
src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoFilter.java

@ -0,0 +1,29 @@
package com.fr.plugin.tptj.tabledata.factory.demo;
import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.tptj.plugin.hg.impl.AbstractFilter;
import com.tptj.plugin.hg.stable.SimpleDataModel;
public class DemoFilter extends AbstractFilter {
@Override
public SimpleDataModel doAction(SimpleDataModel simpleDataModel, String s) {
try {
simpleDataModel.removeColumn(simpleDataModel.getColumnCount() - 1);
} catch (TableDataException e) {
FineLoggerFactory.getLogger().error(e, "{}", e.getMessage());
}
return simpleDataModel;
}
@Override
public String getName() {
return "Demo_Filter";
}
@Override
public String getDefaultConfig() {
return StringUtils.EMPTY;
}
}

26
src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoFormatter.java

@ -0,0 +1,26 @@
package com.fr.plugin.tptj.tabledata.factory.demo;
import com.tptj.plugin.hg.impl.AbstractFormatter;
public class DemoFormatter extends AbstractFormatter {
@Override
public Object format(Object o, String s) {
String data = (String) o;
String[] lines = data.split("\n");
StringBuilder result = new StringBuilder();
for (int i = 1; i < lines.length; i++) {
result.append(lines[i]).append("\n");
}
return result.toString();
}
@Override
public String getName() {
return "Demo_Formatter";
}
@Override
public String getDefaultConfig() {
return "";
}
}

31
src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/DemoPreprocessor.java

@ -0,0 +1,31 @@
package com.fr.plugin.tptj.tabledata.factory.demo;
import com.fr.base.Parameter;
import com.fr.json.JSONObject;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.tptj.plugin.hg.impl.AbstractPreprocessor;
public class DemoPreprocessor extends AbstractPreprocessor {
@Override
public ParameterProvider[] process(Calculator calculator, String s) {
JSONObject jo = new JSONObject(s);
ParameterProvider[] results = new ParameterProvider[1];
results[0] = new Parameter("token", jo.get("token"));
//jo.get("token");
return results;
}
@Override
public String getName() {
return "Demo_PreProcess";
}
@Override
public String getDefaultConfig() {
return "{\n" +
" token:token\n" +
"}";
}
}

62
src/main/java/com/fr/plugin/tptj/tabledata/factory/demo/TextTable.java

@ -0,0 +1,62 @@
package com.fr.plugin.tptj.tabledata.factory.demo;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.tptj.plugin.hg.fun.ParameterRefreshAction;
import com.tptj.plugin.hg.impl.AbstractConfigTable;
import javax.swing.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
public class TextTable extends AbstractConfigTable<DemoLoader> {
private final static double P = TableLayout.PREFERRED;
private final static double F = TableLayout.FILL;
JTextArea textArea;
public TextTable() {
}
@Override
public JPanel getTable(ParameterRefreshAction action) {
textArea = new UITextArea();
textArea.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
action.doAction();
}
});
//textArea.setPreferredSize(new Dimension(350,216));
UIScrollPane scrollPane = new UIScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(350,216));
return TableLayoutHelper.createTableLayoutPane(
new Component[][] {{
scrollPane
}},
new double[] { F },
new double[] { F }
);
}
@Override
public void setValue(String text) {
textArea.setText(text);
}
@Override
public String getValue() {
return textArea.getText();
}
}
Loading…
Cancel
Save