Jun 2024
This commit is contained in:
163
plugins/DemoScan.java
Normal file
163
plugins/DemoScan.java
Normal file
@@ -0,0 +1,163 @@
|
||||
|
||||
import ch.psi.pshell.ui.ScriptProcessor;
|
||||
import ch.psi.pshell.ui.Task;
|
||||
import ch.psi.utils.State;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class DemoScan extends ScriptProcessor {
|
||||
|
||||
public DemoScan() {
|
||||
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() {
|
||||
|
||||
}
|
||||
|
||||
@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(){
|
||||
//TODO
|
||||
return "DemoScan";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getArgs(){
|
||||
Map<String, Object> ret = new HashMap<>();
|
||||
ret.put("START", spStart.getValue());
|
||||
ret.put("END", spEnd.getValue());
|
||||
ret.put("STEPS", spSteps.getValue());
|
||||
ret.put("PLOT", plot);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
spStart = new javax.swing.JSpinner();
|
||||
spEnd = new javax.swing.JSpinner();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
spSteps = new javax.swing.JSpinner();
|
||||
Steps = new javax.swing.JLabel();
|
||||
plot = new ch.psi.pshell.plot.LinePlotJFree();
|
||||
|
||||
jLabel1.setText("Start:");
|
||||
|
||||
spStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 10.0d, 1.0d));
|
||||
|
||||
spEnd.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.0d, 10.0d, 1.0d));
|
||||
|
||||
jLabel2.setText("End:");
|
||||
|
||||
spSteps.setModel(new javax.swing.SpinnerNumberModel(10, 0, 10, 1));
|
||||
|
||||
Steps.setText("Steps:");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(25, 25, 25)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(spStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(spEnd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(Steps)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(spSteps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(21, 21, 21)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(spStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(21, 21, 21)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(spEnd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(21, 21, 21)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(Steps)
|
||||
.addComponent(spSteps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel Steps;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private ch.psi.pshell.plot.LinePlotJFree plot;
|
||||
private javax.swing.JSpinner spEnd;
|
||||
private javax.swing.JSpinner spStart;
|
||||
private javax.swing.JSpinner spSteps;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
Reference in New Issue
Block a user