Files
dev/plugins/HarmonicScan.java
2020-06-18 09:40:29 +02:00

559 lines
27 KiB
Java

/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Context.ContextStateException;
import ch.psi.pshell.epics.Epics;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.Chrono;
import ch.psi.utils.State;
import ch.psi.utils.swing.DsvEditor;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.utils.swing.SwingUtils;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Properties;
import javax.swing.DefaultComboBoxModel;
/**
*
*/
public class HarmonicScan extends Panel {
public HarmonicScan() {
initComponents();
}
@Override
public void onInitialize(int runCount) {
super.onInitialize(runCount);
try {
setElement();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}
@Override
public void onStart() {
super.onStart();
loadConfig();
}
@Override
public void onStateChange(State state, State former) {
setEnabled(state == State.Ready);
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
Path getEnergyTableFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "harmonic_scan_energies.properties");
}
Path getOffsetTableFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "harmonic_scan_offsets.properties");
}
@Override
public void setEnabled(boolean value) {
buttonExecute.setEnabled(value);
comboElement.setEnabled(value);
comboPolarizarion.setEnabled(value);
buttonConfigure.setEnabled(value);
}
void loadConfig() {
DefaultComboBoxModel model = (DefaultComboBoxModel) comboElement.getModel();
model.removeAllElements();
try {
for (String line : Files.readAllLines(getEnergyTableFile())) {
if ((line != null) && (!line.trim().isEmpty())) {
String[] tokens = line.split("=");
if (tokens.length > 0) {
model.addElement(tokens[0].trim());
}
}
}
} catch (Exception ex) {
}
}
void setElement() throws IOException {
Properties prop = new Properties();
prop.load(new FileInputStream(getEnergyTableFile().toFile()));
String element = comboElement.getSelectedItem().toString();
String val = prop.getProperty(element);
String[] tokens = val.split(" ");
if (tokens.length != 1) {
throw new IOException("Invalid file format: " + tokens.length);
}
spinnerEnergy.setValue(Double.valueOf(tokens[0].trim()));
getOffsetTable();
}
void setPolarizarion() throws IOException {
getOffsetTable();
}
String getOffsetEntry() {
String element = comboElement.getSelectedItem().toString().trim();
String polarization = comboPolarizarion.getSelectedItem().toString().trim();
return element + "_" + polarization;
}
EditorDialog dlgConfig;
void editEnergyTable() throws IOException {
if ((dlgConfig == null) || (!dlgConfig.isShowing())) {
String[] columns = new String[]{"Element", "Energy"};
Class[] types = new Class[]{String.class, Double.class};
DsvEditor editor = new DsvEditor(columns, types, " ");
dlgConfig = editor.getDialog(getView(), false);
editor.load(getEnergyTableFile().toString());
editor.setTitle("Harmonic Scan Energy Table");
}
dlgConfig.setSize(640, 320);
showWindow(dlgConfig);
}
void getOffsetTable() throws IOException {
textLastOffset.setText("");
textTimestamp.setText("");
try {
Properties prop = new Properties();
prop.load(new FileInputStream(getOffsetTableFile().toFile()));
String val = prop.getProperty(getOffsetEntry());
if ((val != null) && !val.isEmpty()) {
String[] tokens = val.split(" ");
if (tokens.length != 3) {
throw new IOException("Invalid file format: " + tokens.length);
}
textLastOffset.setText(Double.valueOf(tokens[0].trim()).toString());
textTimestamp.setText(tokens[1].trim() + " " + tokens[2].trim());
}
} catch (FileNotFoundException ex) {
}
}
void setOffsetTable(double offset) throws IOException {
Properties prop = new Properties();
String timestamp = Chrono.getTimeStr(System.currentTimeMillis(), "dd.MM.YY HH:mm");
prop.setProperty(getOffsetEntry(), offset + " " + timestamp);
try ( FileOutputStream out = new FileOutputStream(getOffsetTableFile().toFile())) {
prop.store(out, null);
}
textLastOffset.setText(String.valueOf(offset));
textTimestamp.setText(timestamp);
}
void run() throws ContextStateException {
textScanReturn.setText("");
buttonApply.setEnabled(false);
HashMap args = new HashMap();
args.put("ID_ENERGY", (Double) spinnerEnergy.getValue());
args.put("HALFWIDTH", (Double) spinnerHalfwidth.getValue());
args.put("STEP", (Double) spinnerStep.getValue());
args.put("MODE ", comboPolarizarion.getSelectedItem().toString());
runAsync("HarmonicScan", args).handle((ret, ex) -> {
if ((ex == null) && (ret != null)) {
textScanReturn.setText(String.valueOf(ret));
try {
Double val = (Double) ret;
buttonApply.setEnabled(true);
} catch (Exception e) {
}
}
return ret;
});
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroupPlot = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
comboElement = new javax.swing.JComboBox();
buttonConfigure = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
comboPolarizarion = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
spinnerEnergy = new javax.swing.JSpinner();
jLabel2 = new javax.swing.JLabel();
spinnerHalfwidth = new javax.swing.JSpinner();
jLabel3 = new javax.swing.JLabel();
spinnerStep = new javax.swing.JSpinner();
jPanel3 = new javax.swing.JPanel();
buttonExecute = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
textLastOffset = new javax.swing.JTextField();
textTimestamp = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
buttonSet = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
valueOffset = new ch.psi.pshell.swing.DeviceValuePanel();
jLabel7 = new javax.swing.JLabel();
textScanReturn = new javax.swing.JTextField();
buttonApply = new javax.swing.JButton();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Setup"));
comboElement.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboElementActionPerformed(evt);
}
});
buttonConfigure.setText("Configure");
buttonConfigure.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonConfigureActionPerformed(evt);
}
});
jLabel10.setText("Element:");
jLabel11.setText("Polarization:");
comboPolarizarion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "C+", "C-", "LH", "LV" }));
comboPolarizarion.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboPolarizarionActionPerformed(evt);
}
});
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Energy");
spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(700.0d, 0.0d, 9999.0d, 1.0d));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Halfwidth:");
spinnerHalfwidth.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 9999.0d, 1.0d));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Step:");
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.0d, 9999.0d, 1.0d));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboElement, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboPolarizarion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonConfigure)
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerHalfwidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfigure, comboElement, comboPolarizarion});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerEnergy, spinnerHalfwidth, spinnerStep});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboElement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10)
.addComponent(jLabel1)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonConfigure))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(spinnerHalfwidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboPolarizarion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(9, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
buttonExecute.setText("Start");
buttonExecute.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonExecuteActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonExecute, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(buttonExecute)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAbort)
.addContainerGap())
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Offset"));
jLabel5.setText("Timestamp:");
textLastOffset.setEditable(false);
textLastOffset.setHorizontalAlignment(javax.swing.JTextField.CENTER);
textTimestamp.setEditable(false);
textTimestamp.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel4.setText("Persisted Value:");
buttonSet.setText("Set");
buttonSet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonSetActionPerformed(evt);
}
});
jLabel6.setText("Current Offset:");
valueOffset.setDeviceName("pol_offset");
jLabel7.setText("Scan Return:");
textScanReturn.setEditable(false);
textScanReturn.setHorizontalAlignment(javax.swing.JTextField.CENTER);
buttonApply.setText("Apply");
buttonApply.setEnabled(false);
buttonApply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonApplyActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel4)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(textLastOffset, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(textTimestamp))
.addGap(18, 18, 18)
.addComponent(buttonSet))
.addComponent(valueOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(textScanReturn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(buttonApply)))
.addContainerGap(132, Short.MAX_VALUE))
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonApply, buttonSet});
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textLastOffset, textScanReturn, textTimestamp, valueOffset});
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(valueOffset, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(textLastOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonSet))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(textTimestamp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textScanReturn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(buttonApply))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, 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()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
try {
run();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonExecuteActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
try {
abort();
} catch (InterruptedException ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void comboElementActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboElementActionPerformed
try {
setElement();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_comboElementActionPerformed
private void buttonConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigureActionPerformed
try {
editEnergyTable();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonConfigureActionPerformed
private void buttonSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetActionPerformed
try {
String ret = SwingUtils.getString(this, "Enter persisted value for " + getOffsetEntry(), textLastOffset.getText());
if ((ret != null) && (!ret.trim().isEmpty())) {
setOffsetTable(Double.valueOf(ret));
}
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonSetActionPerformed
private void comboPolarizarionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboPolarizarionActionPerformed
try {
setPolarizarion();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_comboPolarizarionActionPerformed
private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
try {
setOffsetTable(Double.valueOf(textScanReturn.getText()));
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonApplyActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonApply;
private javax.swing.JButton buttonConfigure;
private javax.swing.JButton buttonExecute;
private javax.swing.ButtonGroup buttonGroupPlot;
private javax.swing.JButton buttonSet;
private javax.swing.JComboBox comboElement;
private javax.swing.JComboBox comboPolarizarion;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JSpinner spinnerEnergy;
private javax.swing.JSpinner spinnerHalfwidth;
private javax.swing.JSpinner spinnerStep;
private javax.swing.JTextField textLastOffset;
private javax.swing.JTextField textScanReturn;
private javax.swing.JTextField textTimestamp;
private ch.psi.pshell.swing.DeviceValuePanel valueOffset;
// End of variables declaration//GEN-END:variables
}