Files
tst/plugins/TestScript.java
2026-03-13 15:28:30 +01:00

122 lines
3.5 KiB
Java

import ch.psi.pshell.framework.ScriptProcessor;
import ch.psi.pshell.framework.Task;
import ch.psi.pshell.utils.State;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class TestScript extends ScriptProcessor {
//TODO: set script name
public static final String SCRIPT_NAME = "TestScript";
public TestScript() {
initComponents();
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
@Override
public void onTaskFinished(Task task) {
}
@Override
protected void onTimer() {
}
@Override
protected void onLoaded() {
scanPlot.initialize();
scanPlot.setActive(true);
System.out.println("OK");
}
@Override
protected void onUnloaded() {
}
@Override
protected void onStartingExecution(Map<String, Object> args) throws Exception{
}
@Override
protected void onFinishedExecution(Map<String, Object> args, Object ret, Throwable t) throws Exception{
}
//Invoked by 'update()' to update components in the event thread
@Override
protected void doUpdate() {
}
@Override
public String getScript(){
return SCRIPT_NAME;
}
@Override
public Map<String, Object> getArgs(){
//TODO: add script arguments
Map<String, Object> ret = new HashMap<>();
return ret;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
scanPlot = new ch.psi.pshell.swing.PlotPanel();
javax.swing.GroupLayout scanPlotLayout = new javax.swing.GroupLayout(scanPlot);
scanPlot.setLayout(scanPlotLayout);
scanPlotLayout.setHorizontalGroup(
scanPlotLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 476, Short.MAX_VALUE)
);
scanPlotLayout.setVerticalGroup(
scanPlotLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 394, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 476, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scanPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 394, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scanPlot, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private ch.psi.pshell.swing.PlotPanel scanPlot;
// End of variables declaration//GEN-END:variables
}