Update User Panels
This commit is contained in:
@@ -0,0 +1,567 @@
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.swing.DeviceValuePanel;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.Arr;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class Beamline extends Panel {
|
||||
|
||||
public enum ID {
|
||||
ID1,
|
||||
ID2,
|
||||
ID1_ID2
|
||||
}
|
||||
|
||||
public enum Polarization {
|
||||
Circ_Plus,
|
||||
Circ_Minus,
|
||||
Lin_Hor,
|
||||
Lin_Ver,
|
||||
Lin
|
||||
}
|
||||
|
||||
final Component[] parameterControls;
|
||||
|
||||
public Beamline() {
|
||||
initComponents();
|
||||
|
||||
((JSpinner.ListEditor) spinnerHar1.getEditor()).getTextField().setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
((JSpinner.ListEditor) spinnerHar2.getEditor()).getTextField().setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
SwingUtils.setEnumCombo(comboID, Beamline.ID.class, true);
|
||||
SwingUtils.setEnumCombo(comboPol1, Beamline.Polarization.class, true);
|
||||
SwingUtils.setEnumCombo(comboPol2, Beamline.Polarization.class, true);
|
||||
|
||||
Component[] parameterControls = new Component[0];
|
||||
for (JPanel panel : new JPanel[]{panelBeamline}) {
|
||||
for (Class cls : new Class[]{JComboBox.class, JSpinner.class, JToggleButton.class}) {
|
||||
parameterControls = Arr.append(parameterControls, SwingUtils.getComponentsByType(panel, cls));
|
||||
}
|
||||
}
|
||||
|
||||
Font devValueFont = deviceValuePanel1.getFont().deriveFont(8.0f);
|
||||
for (Component panel : SwingUtils.getComponentsByType(panelBeamline, DeviceValuePanel.class)){
|
||||
((DeviceValuePanel)panel).getLabel().setFont(devValueFont);
|
||||
((DeviceValuePanel)panel).getLabel().setVerticalAlignment(SwingConstants.TOP);
|
||||
((DeviceValuePanel)panel).getLabel().setVerticalTextPosition(SwingConstants.TOP);
|
||||
}
|
||||
|
||||
deviceValuePanel1.getLabel().setVerticalAlignment(SwingConstants.TOP);
|
||||
deviceValuePanel1.getLabel().setFont(deviceValuePanel1.getFont().deriveFont(8.0f));
|
||||
|
||||
|
||||
|
||||
this.parameterControls = parameterControls;
|
||||
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
try {
|
||||
String id = getSetting("ID");
|
||||
Double en = Double.valueOf(getSetting("ENERGY"));
|
||||
String pol1 = getSetting("POL_ID_1");
|
||||
Double alp1 = Double.valueOf(getSetting("ALPHA_ID_1"));
|
||||
String har1 = getSetting("HARMONIC_ID_1");
|
||||
Double off1 = Double.valueOf(getSetting("OFFSET_ID_1"));
|
||||
String pol2 = getSetting("POL_ID_2");
|
||||
Double alp2 = Double.valueOf(getSetting("ALPHA_ID_2"));
|
||||
String har2 = getSetting("HARMONIC_ID_2");
|
||||
Double off2 = Double.valueOf(getSetting("OFFSET_ID_2"));
|
||||
comboID.setSelectedItem(id);
|
||||
spinnerImgEng.setValue(en);
|
||||
comboPol1.setSelectedItem(pol1);
|
||||
spinnerAlp1.setValue(alp1);
|
||||
spinnerHar1.setValue(har1);
|
||||
spinnerOff1.setValue(off1);
|
||||
comboPol2.setSelectedItem(pol2);
|
||||
spinnerAlp2.setValue(alp2);
|
||||
spinnerHar2.setValue(har2);
|
||||
spinnerOff2.setValue(off2);
|
||||
|
||||
checkAutoValve.setSelected(String.valueOf(getSetting("AUTO_SWITCH_VALVE")).equalsIgnoreCase("true"));
|
||||
} catch (IOException ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
updateControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecutedFile(String fileName, Object result) {
|
||||
}
|
||||
|
||||
|
||||
//Callback to perform update - in event thread
|
||||
@Override
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
void updateControls() {
|
||||
boolean editable = getState().isInitialized() && !getState().isProcessing();
|
||||
boolean is_id1 = comboID.getSelectedIndex() != 1;
|
||||
boolean is_id2 = comboID.getSelectedIndex() != 0;
|
||||
buttonApply.setEnabled(editable);
|
||||
|
||||
for (Component c : parameterControls) {
|
||||
c.setEnabled(editable);
|
||||
}
|
||||
|
||||
if (editable) {
|
||||
spinnerAlp1.setEnabled(is_id1 && (comboPol1.getSelectedItem() == Beamline.Polarization.Lin.toString()));
|
||||
spinnerAlp2.setEnabled(is_id2 & (comboPol2.getSelectedItem() == Beamline.Polarization.Lin.toString()));
|
||||
spinnerHar1.setEnabled(is_id1 );
|
||||
spinnerHar2.setEnabled(is_id2 );
|
||||
spinnerOff1.setEnabled(is_id1 );
|
||||
spinnerOff2.setEnabled(is_id2 );
|
||||
comboPol1.setEnabled(is_id1 );
|
||||
comboPol2.setEnabled(is_id2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setBeamlineArgs(HashMap args) {
|
||||
args.put("ID", comboID.getSelectedItem());
|
||||
args.put("ENERGY", spinnerImgEng.getValue());
|
||||
args.put("POL_ID_1", comboPol1.getSelectedItem());
|
||||
args.put("ALPHA_ID_1", spinnerAlp1.getValue());
|
||||
args.put("HARMONIC_ID_1", spinnerHar1.getValue());
|
||||
args.put("OFFSET_ID_1", spinnerOff1.getValue());
|
||||
args.put("POL_ID_2", comboPol2.getSelectedItem());
|
||||
args.put("ALPHA_ID_2", spinnerAlp2.getValue());
|
||||
args.put("HARMONIC_ID_2", spinnerHar2.getValue());
|
||||
args.put("OFFSET_ID_2", spinnerOff2.getValue());
|
||||
}
|
||||
|
||||
void applyBeamline() throws Context.ContextStateException {
|
||||
|
||||
HashMap args = new HashMap();
|
||||
setBeamlineArgs(args);
|
||||
|
||||
runAsync("templates/SetupBeamline", args).handle((ret, t) -> {
|
||||
if ((t != null) && (!getContext().isAborted())) {
|
||||
showException((Exception) t);
|
||||
}
|
||||
return t;
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
panelBeamline = new javax.swing.JPanel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
comboID = new javax.swing.JComboBox<>();
|
||||
jPanel7 = new javax.swing.JPanel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
comboPol1 = new javax.swing.JComboBox<>();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
spinnerAlp1 = new javax.swing.JSpinner();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
spinnerHar1 = new javax.swing.JSpinner();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
spinnerOff1 = new javax.swing.JSpinner();
|
||||
deviceValuePanel2 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel3 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel4 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel5 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
jPanel9 = new javax.swing.JPanel();
|
||||
jLabel13 = new javax.swing.JLabel();
|
||||
comboPol2 = new javax.swing.JComboBox<>();
|
||||
jLabel14 = new javax.swing.JLabel();
|
||||
spinnerAlp2 = new javax.swing.JSpinner();
|
||||
jLabel15 = new javax.swing.JLabel();
|
||||
spinnerHar2 = new javax.swing.JSpinner();
|
||||
jLabel16 = new javax.swing.JLabel();
|
||||
spinnerOff2 = new javax.swing.JSpinner();
|
||||
deviceValuePanel6 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel7 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel8 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel9 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
buttonApply = new javax.swing.JButton();
|
||||
jLabel27 = new javax.swing.JLabel();
|
||||
spinnerImgEng = new javax.swing.JSpinner();
|
||||
checkAutoValve = new javax.swing.JCheckBox();
|
||||
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel10 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
|
||||
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel3.setText("ID:");
|
||||
|
||||
comboID.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
comboID.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboIDActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("ID1"));
|
||||
|
||||
jLabel5.setText("Mode:");
|
||||
|
||||
comboPol1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
comboPol1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboPol1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel6.setText("Alpha:");
|
||||
|
||||
spinnerAlp1.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
|
||||
|
||||
jLabel7.setText("Harmonic:");
|
||||
|
||||
spinnerHar1.setModel(new javax.swing.SpinnerListModel(new String[] {"1", "3"}));
|
||||
|
||||
jLabel8.setText("Offset:");
|
||||
|
||||
spinnerOff1.setModel(new javax.swing.SpinnerNumberModel(0.0d, -10.0d, 10.0d, 1.0d));
|
||||
|
||||
deviceValuePanel2.setDeviceName("id1_alpha");
|
||||
|
||||
deviceValuePanel3.setDeviceName("id1_pol");
|
||||
|
||||
deviceValuePanel4.setDeviceName("id1_harmonic");
|
||||
|
||||
deviceValuePanel5.setDeviceName("id1_offset");
|
||||
|
||||
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
|
||||
jPanel7.setLayout(jPanel7Layout);
|
||||
jPanel7Layout.setHorizontalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(spinnerAlp1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(spinnerHar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(comboPol1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(spinnerOff1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel5, jLabel6, jLabel7, jLabel8});
|
||||
|
||||
jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboPol1, spinnerAlp1, spinnerHar1, spinnerOff1});
|
||||
|
||||
jPanel7Layout.setVerticalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(comboPol1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel5))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(spinnerAlp1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(spinnerHar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(spinnerOff1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(deviceValuePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel7Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, deviceValuePanel5, spinnerAlp1, spinnerHar1, spinnerOff1});
|
||||
|
||||
jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("ID2"));
|
||||
|
||||
jLabel13.setText("Mode:");
|
||||
|
||||
comboPol2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
comboPol2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboPol2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel14.setText("Alpha:");
|
||||
|
||||
spinnerAlp2.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
|
||||
|
||||
jLabel15.setText("Harmonic:");
|
||||
|
||||
spinnerHar2.setModel(new javax.swing.SpinnerListModel(new String[] {"1", "3"}));
|
||||
|
||||
jLabel16.setText("Offset:");
|
||||
|
||||
spinnerOff2.setModel(new javax.swing.SpinnerNumberModel(0.0d, -10.0d, 10.0d, 1.0d));
|
||||
|
||||
deviceValuePanel6.setDeviceName("id2_pol");
|
||||
|
||||
deviceValuePanel7.setDeviceName("id2_alpha");
|
||||
|
||||
deviceValuePanel8.setDeviceName("id2_harmonic");
|
||||
|
||||
deviceValuePanel9.setDeviceName("id2_offset");
|
||||
|
||||
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
|
||||
jPanel9.setLayout(jPanel9Layout);
|
||||
jPanel9Layout.setHorizontalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(spinnerOff2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spinnerHar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spinnerAlp2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(comboPol2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(deviceValuePanel6, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
|
||||
.addComponent(deviceValuePanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addComponent(deviceValuePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addComponent(deviceValuePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel9Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel13, jLabel14, jLabel15, jLabel16});
|
||||
|
||||
jPanel9Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboPol2, spinnerAlp2, spinnerHar2, spinnerOff2});
|
||||
|
||||
jPanel9Layout.setVerticalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(deviceValuePanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(comboPol2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel13))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(deviceValuePanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spinnerAlp2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel14))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel15)
|
||||
.addComponent(spinnerHar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(deviceValuePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel16)
|
||||
.addComponent(spinnerOff2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(deviceValuePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel9Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deviceValuePanel6, deviceValuePanel7, deviceValuePanel8, deviceValuePanel9, spinnerAlp2, spinnerHar2, spinnerOff2});
|
||||
|
||||
buttonApply.setText("Apply");
|
||||
buttonApply.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonApplyActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel27.setText("Energy:");
|
||||
|
||||
spinnerImgEng.setModel(new javax.swing.SpinnerNumberModel(1000.0d, 90.0d, 2520.0d, 1.0d));
|
||||
|
||||
checkAutoValve.setText("Auto Switch Valve");
|
||||
checkAutoValve.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
checkAutoValveActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
deviceValuePanel1.setDeviceName("energy");
|
||||
|
||||
deviceValuePanel10.setDeviceName("energy_opt_desc");
|
||||
|
||||
javax.swing.GroupLayout panelBeamlineLayout = new javax.swing.GroupLayout(panelBeamline);
|
||||
panelBeamline.setLayout(panelBeamlineLayout);
|
||||
panelBeamlineLayout.setHorizontalGroup(
|
||||
panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelBeamlineLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(checkAutoValve)
|
||||
.addGroup(panelBeamlineLayout.createSequentialGroup()
|
||||
.addComponent(jLabel27)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addComponent(spinnerImgEng)))
|
||||
.addGroup(panelBeamlineLayout.createSequentialGroup()
|
||||
.addComponent(jLabel3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(comboID, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(deviceValuePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addGap(18, 18, Short.MAX_VALUE)
|
||||
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(panelBeamlineLayout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
panelBeamlineLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel27, jLabel3});
|
||||
|
||||
panelBeamlineLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboID, deviceValuePanel1, deviceValuePanel10, spinnerImgEng});
|
||||
|
||||
panelBeamlineLayout.setVerticalGroup(
|
||||
panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelBeamlineLayout.createSequentialGroup()
|
||||
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelBeamlineLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(panelBeamlineLayout.createSequentialGroup()
|
||||
.addGap(30, 30, 30)
|
||||
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(comboID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel27)
|
||||
.addComponent(spinnerImgEng, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(checkAutoValve)))
|
||||
.addGap(18, 18, Short.MAX_VALUE)
|
||||
.addComponent(buttonApply)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelBeamlineLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboID, deviceValuePanel1, deviceValuePanel10, spinnerImgEng});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(panelBeamline, 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()
|
||||
.addContainerGap()
|
||||
.addComponent(panelBeamline, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap(24, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void comboIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboIDActionPerformed
|
||||
updateControls();
|
||||
}//GEN-LAST:event_comboIDActionPerformed
|
||||
|
||||
private void comboPol1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboPol1ActionPerformed
|
||||
updateControls();
|
||||
}//GEN-LAST:event_comboPol1ActionPerformed
|
||||
|
||||
private void comboPol2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboPol2ActionPerformed
|
||||
updateControls();
|
||||
}//GEN-LAST:event_comboPol2ActionPerformed
|
||||
|
||||
private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
|
||||
try {
|
||||
applyBeamline();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonApplyActionPerformed
|
||||
|
||||
private void checkAutoValveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAutoValveActionPerformed
|
||||
try{
|
||||
setSetting("AUTO_SWITCH_VALVE", checkAutoValve.isSelected());
|
||||
} catch (Exception ex){
|
||||
showException (ex);
|
||||
}
|
||||
}//GEN-LAST:event_checkAutoValveActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonApply;
|
||||
private javax.swing.JCheckBox checkAutoValve;
|
||||
private javax.swing.JComboBox<String> comboID;
|
||||
private javax.swing.JComboBox<String> comboPol1;
|
||||
private javax.swing.JComboBox<String> comboPol2;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel10;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel2;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel3;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel4;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel5;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel6;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel7;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel8;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel9;
|
||||
private javax.swing.JLabel jLabel13;
|
||||
private javax.swing.JLabel jLabel14;
|
||||
private javax.swing.JLabel jLabel15;
|
||||
private javax.swing.JLabel jLabel16;
|
||||
private javax.swing.JLabel jLabel27;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JPanel jPanel7;
|
||||
private javax.swing.JPanel jPanel9;
|
||||
private javax.swing.JPanel panelBeamline;
|
||||
private javax.swing.JSpinner spinnerAlp1;
|
||||
private javax.swing.JSpinner spinnerAlp2;
|
||||
private javax.swing.JSpinner spinnerHar1;
|
||||
private javax.swing.JSpinner spinnerHar2;
|
||||
private javax.swing.JSpinner spinnerImgEng;
|
||||
private javax.swing.JSpinner spinnerOff1;
|
||||
private javax.swing.JSpinner spinnerOff2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
Reference in New Issue
Block a user