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 Scan extends ScriptProcessor { public Scan() { 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 args) throws Exception{ } @Override protected void onFinishedExecution(Map 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 ("DemoScan"); } @Override public Map getArgs(){ Map 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") // //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(); jLabel3 = new javax.swing.JLabel(); plot = new ch.psi.pshell.plot.LinePlotJFree(); jLabel1.setText("Start:"); spStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -10.0d, 10.0d, 1.0d)); spEnd.setModel(new javax.swing.SpinnerNumberModel(0.5d, -10.0d, 10.0d, 1.0d)); jLabel2.setText("End:"); spSteps.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 1)); jLabel3.setText("Steps"); plot.setTitle(""); 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(54, 54, 54) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(spSteps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(spEnd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(spStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(47, 47, 47) .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .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)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(spSteps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(7, 7, 7) .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; 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 }