This commit is contained in:
@@ -31,7 +31,6 @@ public class SchottkyScan extends Panel {
|
||||
public SchottkyScan() {
|
||||
initComponents();
|
||||
setPersistedComponents(SwingUtils.getComponentsByType(panelPars, JSpinner.class));
|
||||
buttonSet.setEnabled(false);
|
||||
plot.setStyle(LinePlot.Style.ErrorY);
|
||||
|
||||
}
|
||||
@@ -45,13 +44,11 @@ public class SchottkyScan extends Panel {
|
||||
public void onStateChange(State state, State former) {
|
||||
buttonAbort.setEnabled(state.isProcessing());
|
||||
buttonStart.setEnabled(state == State.Ready);
|
||||
//buttonSet.setEnabled(buttonStart.isEnabled());
|
||||
spinnerStart.setEnabled(buttonStart.isEnabled());
|
||||
spinnerStop.setEnabled(buttonStart.isEnabled());
|
||||
spinnerStep.setEnabled(buttonStart.isEnabled());
|
||||
spinnerSamples.setEnabled(buttonStart.isEnabled());
|
||||
spinnerLatency.setEnabled(buttonStart.isEnabled());
|
||||
//spinnerPhaseRef.setEnabled(buttonStart.isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,10 +78,6 @@ public class SchottkyScan extends Panel {
|
||||
labelSamples = new javax.swing.JLabel();
|
||||
spinnerStart = new javax.swing.JSpinner();
|
||||
plot = new ch.psi.pshell.plot.LinePlotJFree();
|
||||
panelOutput = new javax.swing.JPanel();
|
||||
labelRefPhase = new javax.swing.JLabel();
|
||||
spinnerPhaseRef = new javax.swing.JSpinner();
|
||||
buttonSet = new javax.swing.JButton();
|
||||
|
||||
buttonStart.setText("Start");
|
||||
buttonStart.addActionListener(new java.awt.event.ActionListener() {
|
||||
@@ -189,54 +182,6 @@ public class SchottkyScan extends Panel {
|
||||
|
||||
plot.setTitle("");
|
||||
|
||||
panelOutput.setBorder(javax.swing.BorderFactory.createTitledBorder("Output"));
|
||||
|
||||
labelRefPhase.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
labelRefPhase.setText("Ref Phase:");
|
||||
|
||||
spinnerPhaseRef.setModel(new javax.swing.SpinnerNumberModel(0.0d, -180.0d, 360.0d, 0.1d));
|
||||
spinnerPhaseRef.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spinnerPhaseRefStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonSet.setText("Set");
|
||||
buttonSet.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonSetActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout panelOutputLayout = new javax.swing.GroupLayout(panelOutput);
|
||||
panelOutput.setLayout(panelOutputLayout);
|
||||
panelOutputLayout.setHorizontalGroup(
|
||||
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelOutputLayout.createSequentialGroup()
|
||||
.addContainerGap(25, Short.MAX_VALUE)
|
||||
.addGroup(panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelOutputLayout.createSequentialGroup()
|
||||
.addComponent(labelRefPhase)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spinnerPhaseRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(buttonSet, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelOutputLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonSet, spinnerPhaseRef});
|
||||
|
||||
panelOutputLayout.setVerticalGroup(
|
||||
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelOutputLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(labelRefPhase)
|
||||
.addComponent(spinnerPhaseRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(buttonSet)
|
||||
.addContainerGap(79, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -248,10 +193,9 @@ public class SchottkyScan extends Panel {
|
||||
.addComponent(buttonStart)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonAbort))
|
||||
.addComponent(panelPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(panelPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE)
|
||||
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 522, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@@ -264,13 +208,11 @@ public class SchottkyScan extends Panel {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(panelPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonStart)
|
||||
.addComponent(buttonAbort)))
|
||||
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE))
|
||||
.addGap(17, 17, 17))
|
||||
);
|
||||
|
||||
@@ -280,7 +222,6 @@ public class SchottkyScan extends Panel {
|
||||
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
|
||||
//((Plugin)this).
|
||||
plot.removeMarker(null);
|
||||
spinnerPhaseRef.setValue(0.0);
|
||||
ArrayList parameters = new ArrayList();
|
||||
parameters.add(spinnerStart.getValue());
|
||||
parameters.add(spinnerStop.getValue());
|
||||
@@ -295,9 +236,8 @@ public class SchottkyScan extends Panel {
|
||||
getLogger().info("Exception executing scan: " + ex);
|
||||
} else {
|
||||
Double bph_ref = (Double) ((List)ret).get(0);
|
||||
spinnerPhaseRef.setValue(Convert.roundDouble(bph_ref, 1));
|
||||
buttonSet.setEnabled(true);
|
||||
spinnerPhaseRef.setEnabled(true);
|
||||
//spinnerPhaseRef.setValue(Convert.roundDouble(bph_ref, 1));
|
||||
//spinnerPhaseRef.setEnabled(true);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
@@ -316,50 +256,17 @@ public class SchottkyScan extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_buttonAbortActionPerformed
|
||||
|
||||
private void spinnerPhaseRefStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerPhaseRefStateChanged
|
||||
try {
|
||||
plot.removeMarker(null);
|
||||
plot.addMarker((Double) spinnerPhaseRef.getValue(), Plot.AxisId.X, "Ref Phase", Color.GREEN);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_spinnerPhaseRefStateChanged
|
||||
|
||||
private void buttonSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetActionPerformed
|
||||
ArrayList parameters = new ArrayList();
|
||||
parameters.add((Double) spinnerPhaseRef.getValue());
|
||||
parameters.add(plot);
|
||||
try {
|
||||
//How to get a callback on the end of execution
|
||||
runAsync("RFscan/SchottkyScanSet", parameters).handle((ret, ex) -> {
|
||||
if (ex != null) {
|
||||
getLogger().info("Exception executing scan: " + ex);
|
||||
showException((Exception) ex);
|
||||
}
|
||||
buttonSet.setEnabled(false);
|
||||
spinnerPhaseRef.setEnabled(false);
|
||||
return ret;
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonSetActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonSet;
|
||||
private javax.swing.JButton buttonStart;
|
||||
private javax.swing.JLabel labelLatency;
|
||||
private javax.swing.JLabel labelRefPhase;
|
||||
private javax.swing.JLabel labelSamples;
|
||||
private javax.swing.JLabel labelStart;
|
||||
private javax.swing.JLabel labelStep;
|
||||
private javax.swing.JLabel labelStop;
|
||||
private javax.swing.JPanel panelOutput;
|
||||
private javax.swing.JPanel panelPars;
|
||||
private ch.psi.pshell.plot.LinePlotJFree plot;
|
||||
private javax.swing.JSpinner spinnerLatency;
|
||||
private javax.swing.JSpinner spinnerPhaseRef;
|
||||
private javax.swing.JSpinner spinnerSamples;
|
||||
private javax.swing.JSpinner spinnerStart;
|
||||
private javax.swing.JSpinner spinnerStep;
|
||||
|
||||
Reference in New Issue
Block a user