Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Nicholas.Jee | 21911f7d59 | 2 years ago |
Nicholas.Jee | 7898be45f9 | 3 years ago |
9 changed files with 160 additions and 5 deletions
Binary file not shown.
Binary file not shown.
@ -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; |
||||
} |
||||
} |
@ -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 ""; |
||||
} |
||||
} |
@ -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" + |
||||
"}"; |
||||
} |
||||
} |
@ -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…
Reference in new issue