180 lines
6.4 KiB
Java
180 lines
6.4 KiB
Java
|
|
import ch.psi.pshell.ui.Panel;
|
|
import ch.psi.utils.State;
|
|
import ch.psi.utils.swing.SwingUtils;
|
|
import java.awt.Component;
|
|
import javax.swing.JButton;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class XPEEM_Settings extends Panel {
|
|
|
|
public XPEEM_Settings() {
|
|
initComponents();
|
|
}
|
|
|
|
//Overridable callbacks
|
|
@Override
|
|
public void onInitialize(int runCount) {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onStateChange(State state, State former) {
|
|
for (Component c : SwingUtils.getComponentsByType(this, JButton.class)){
|
|
c.setEnabled(state==State.Ready);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onExecutedFile(String fileName, Object result) {
|
|
}
|
|
|
|
@Override
|
|
protected void onTimer() {
|
|
}
|
|
|
|
@Override
|
|
protected void onLoaded() {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void onUnloaded() {
|
|
|
|
}
|
|
|
|
//Invoked by 'update()' to update components in the event thread
|
|
@Override
|
|
protected void doUpdate() {
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents() {
|
|
|
|
ButtonDefaultXrays = new javax.swing.JButton();
|
|
ButtonDefaultOptics15kV = new javax.swing.JButton();
|
|
ButtonDefaultOptics10kV = new javax.swing.JButton();
|
|
ButtonNeutralizePosition = new javax.swing.JButton();
|
|
|
|
ButtonDefaultXrays.setText("X-rays (Default)");
|
|
ButtonDefaultXrays.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
ButtonDefaultXraysActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
ButtonDefaultOptics15kV.setText("PEEM Optics 15 kV (Default)");
|
|
ButtonDefaultOptics15kV.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
ButtonDefaultOptics15kVActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
ButtonDefaultOptics10kV.setText("PEEM Optics 10 kV (Default)");
|
|
ButtonDefaultOptics10kV.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
ButtonDefaultOptics10kVActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
ButtonNeutralizePosition.setText("Sample Position (Neutralize)");
|
|
ButtonNeutralizePosition.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
ButtonNeutralizePositionActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
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(79, 79, 79)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(ButtonNeutralizePosition)
|
|
.addComponent(ButtonDefaultOptics10kV)
|
|
.addComponent(ButtonDefaultOptics15kV)
|
|
.addComponent(ButtonDefaultXrays))
|
|
.addContainerGap(322, Short.MAX_VALUE))
|
|
);
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {ButtonDefaultOptics10kV, ButtonDefaultOptics15kV, ButtonDefaultXrays, ButtonNeutralizePosition});
|
|
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(46, 46, 46)
|
|
.addComponent(ButtonDefaultOptics15kV)
|
|
.addGap(36, 36, 36)
|
|
.addComponent(ButtonDefaultOptics10kV)
|
|
.addGap(36, 36, 36)
|
|
.addComponent(ButtonDefaultXrays)
|
|
.addGap(34, 34, 34)
|
|
.addComponent(ButtonNeutralizePosition)
|
|
.addContainerGap(115, Short.MAX_VALUE))
|
|
);
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
private void ButtonDefaultXraysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonDefaultXraysActionPerformed
|
|
try {
|
|
evalAsync("xrays_default()").handle((ret,ex)->{
|
|
if (ex!=null){
|
|
showException((Exception)ex);
|
|
}
|
|
return ret;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_ButtonDefaultXraysActionPerformed
|
|
|
|
private void ButtonDefaultOptics15kVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonDefaultOptics15kVActionPerformed
|
|
try {
|
|
evalAsync("peem_optics_default_15kV()").handle((ret,ex)->{
|
|
if (ex!=null){
|
|
showException((Exception)ex);
|
|
}
|
|
return ret;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_ButtonDefaultOptics15kVActionPerformed
|
|
|
|
private void ButtonDefaultOptics10kVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonDefaultOptics10kVActionPerformed
|
|
try {
|
|
evalAsync("peem_optics_default_10kV()").handle((ret,ex)->{
|
|
if (ex!=null){
|
|
showException((Exception)ex);
|
|
}
|
|
return ret;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_ButtonDefaultOptics10kVActionPerformed
|
|
|
|
private void ButtonNeutralizePositionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonNeutralizePositionActionPerformed
|
|
try {
|
|
evalAsync("neutralize_position()").handle((ret,ex)->{
|
|
if (ex!=null){
|
|
showException((Exception)ex);
|
|
}
|
|
return ret;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_ButtonNeutralizePositionActionPerformed
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JButton ButtonDefaultOptics10kV;
|
|
private javax.swing.JButton ButtonDefaultOptics15kV;
|
|
private javax.swing.JButton ButtonDefaultXrays;
|
|
private javax.swing.JButton ButtonNeutralizePosition;
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|