113 lines
3.2 KiB
Java
113 lines
3.2 KiB
Java
/*
|
|
* Copyright (c) 2014-2018 Paul Scherrer Institute. All rights reserved.
|
|
*/
|
|
|
|
import ch.psi.pshell.bs.ProviderConfig;
|
|
import ch.psi.pshell.ui.Console;
|
|
import ch.psi.pshell.ui.Panel;
|
|
import ch.psi.utils.Config;
|
|
import ch.psi.utils.State;
|
|
import java.io.IOException;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class Tomaz extends Panel {
|
|
|
|
final Console console;
|
|
|
|
public Tomaz() {
|
|
initComponents();
|
|
console = new Console() {
|
|
protected void onConsoleCommand(String name, String[] pars, String trimming) throws Exception {
|
|
switch (name) {
|
|
case "test":
|
|
System.out.println("OK");
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override
|
|
public void onStart() {
|
|
super.onStart();
|
|
console.start();
|
|
}
|
|
|
|
@Override
|
|
public void onStop() {
|
|
super.onStart();
|
|
console.stop();
|
|
}
|
|
|
|
//Overridable callbacks
|
|
@Override
|
|
public void onInitialize(int runCount) {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onStateChange(State state, State former) {
|
|
|
|
}
|
|
|
|
@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() {
|
|
|
|
jButton1 = new javax.swing.JButton();
|
|
|
|
jButton1.setText("jButton1");
|
|
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
jButton1ActionPerformed(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(133, 133, 133)
|
|
.addComponent(jButton1)
|
|
.addContainerGap(219, Short.MAX_VALUE))
|
|
);
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(38, 38, 38)
|
|
.addComponent(jButton1)
|
|
.addContainerGap(70, Short.MAX_VALUE))
|
|
);
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
|
//showSettingsEditor(false);
|
|
//showSettingsEditor(true);
|
|
Config cfg = new ProviderConfig();
|
|
try {
|
|
cfg.load("~/test.cfg");
|
|
} catch (IOException ex) {
|
|
Logger.getLogger(Tomaz.class.getName()).log(Level.SEVERE, null, ex);
|
|
}
|
|
showConfigEditor(cfg, true);
|
|
}//GEN-LAST:event_jButton1ActionPerformed
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JButton jButton1;
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|