125 lines
5.0 KiB
Java
Executable File
125 lines
5.0 KiB
Java
Executable File
/*
|
|
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
|
|
*/
|
|
|
|
import ch.psi.pshell.ui.Panel;
|
|
import ch.psi.utils.State;
|
|
import java.awt.Component;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class Nilson extends Panel {
|
|
|
|
public Nilson() {
|
|
initComponents();
|
|
this.setPersistedComponents(new Component[]{textSrvFile});
|
|
}
|
|
|
|
//Overridable callbacks
|
|
@Override
|
|
public void onInitialize(int runCount) {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onStateChange(State state, State former) {
|
|
buttonAbort.setEnabled(state == State.Busy);
|
|
buttonRun.setEnabled(state==State.Ready);
|
|
}
|
|
|
|
@Override
|
|
public void onExecutedFile(String fileName, Object result) {
|
|
}
|
|
|
|
|
|
//Callback to perform update - in event thread
|
|
@Override
|
|
protected void doUpdate() {
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents() {
|
|
|
|
buttonRun = new javax.swing.JButton();
|
|
buttonAbort = new javax.swing.JButton();
|
|
scrollFile1 = new javax.swing.JScrollPane();
|
|
textSrvFile = new javax.swing.JTextField();
|
|
|
|
buttonRun.setText("Run");
|
|
buttonRun.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonRunActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonAbort.setText("Abort");
|
|
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonAbortActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
scrollFile1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
|
|
scrollFile1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
|
scrollFile1.setViewportView(textSrvFile);
|
|
|
|
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(52, 52, 52)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonRun, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addContainerGap(467, Short.MAX_VALUE))
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(158, 158, 158)
|
|
.addComponent(scrollFile1, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addContainerGap(159, Short.MAX_VALUE)))
|
|
);
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(60, 60, 60)
|
|
.addComponent(buttonRun)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(buttonAbort)
|
|
.addContainerGap(151, Short.MAX_VALUE))
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(115, 115, 115)
|
|
.addComponent(scrollFile1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addContainerGap(115, Short.MAX_VALUE)))
|
|
);
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
|
try {
|
|
this.abort();
|
|
} catch (Exception ex) {
|
|
this.showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonAbortActionPerformed
|
|
|
|
private void buttonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRunActionPerformed
|
|
try {
|
|
this.runAsync("test1");
|
|
} catch (Exception ex) {
|
|
this.showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonRunActionPerformed
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JButton buttonAbort;
|
|
private javax.swing.JButton buttonRun;
|
|
private javax.swing.JScrollPane scrollFile1;
|
|
private javax.swing.JTextField textSrvFile;
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|