Files
x09la/plugins/SIStem.java
gac-x09la 62474e0059
2022-04-25 14:26:36 +02:00

2400 lines
111 KiB
Java

import ch.psi.pshell.core.Context;
import ch.psi.pshell.core.JsonSerializer;
import ch.psi.pshell.core.Nameable;
import ch.psi.pshell.core.Plugin;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceListener;
import ch.psi.pshell.device.MasterPositioner;
import ch.psi.pshell.device.Motor;
import ch.psi.pshell.device.Positioner;
import ch.psi.pshell.device.PositionerBase;
import ch.psi.pshell.device.ProcessVariable;
import ch.psi.pshell.device.ReadonlyProcessVariable;
import ch.psi.pshell.device.Register;
import ch.psi.pshell.plot.MatrixPlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.swing.DataPanel;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.PanelProcessor;
import ch.psi.pshell.ui.Preferences;
import ch.psi.pshell.ui.Processor;
import ch.psi.pshell.ui.QueueProcessor;
import ch.psi.pshell.ui.View;
import ch.psi.pshell.swing.DiscretePositionerSelector;
import ch.psi.pshell.swing.RegisterPanel;
import ch.psi.utils.Arr;
import ch.psi.utils.Convert;
import ch.psi.utils.IO;
import ch.psi.utils.State;
import ch.psi.utils.Str;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.script.ScriptException;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DropMode;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.TransferHandler;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
/**
*
*/
public class SIStem extends PanelProcessor {
File currentFile;
final DefaultTableModel modelInactive;
final DefaultTableModel modelFixed;
final DefaultTableModel modelScanned;
final DefaultTableModel modelMaster;
QueueProcessor queueProcessor;
JDialog dataDialog;
public static final String FILE_EXTENSION = "json";
final RegisterPanel[] scientaPanels;
final DiscretePositionerSelector[] scientaCombos;
final JComboBox[] deviceCombos;
final JTextField[] scientaRangeFields;
String[] additionalPositioners ;
boolean intialized;
boolean startButtonPressed;
static{
QueueProcessor.DEFAULT_INFO_COLUMN = "Time";
View view = App.getInstance().getMainFrame();
if (view!=null){
List<QueueProcessor> queues =view.getQueues();
for (QueueProcessor qp : queues){
String filename = qp.getFileName();
if ((filename!=null)&&(!filename.isBlank())&&!qp.hasChanged()){
System.out.println("Reload: " + filename);
try {
view.getDocumentsTab().remove(qp.getPanel());
view.openProcessor(QueueProcessor.class, filename);
} catch (Exception ex) {
Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
}
}
}
}
}
public SIStem() {
initComponents();
modelInactive = (DefaultTableModel) tableInactive.getModel();
modelFixed = (DefaultTableModel) tableFixed.getModel();
modelScanned = (DefaultTableModel) tableScanned.getModel();
modelMaster = (DefaultTableModel) tableMaster.getModel();
abstract class PositinerTransferHandler extends TransferHandler {
@Override
public int getSourceActions(JComponent c) {
return DnDConstants.ACTION_COPY_OR_MOVE;
}
@Override
public Transferable createTransferable(JComponent comp) {
try {
JTable table = (JTable) comp;
return new StringSelection((String) table.getModel().getValueAt(table.getSelectedRow(), 0));
} catch (Exception ex) {
return null;
}
}
@Override
public boolean canImport(TransferHandler.TransferSupport support) {
return support.isDataFlavorSupported(DataFlavor.stringFlavor);
}
@Override
public boolean importData(TransferHandler.TransferSupport support) {
if (support.isDrop() && canImport(support)) {
try {
JTable.DropLocation dl = (JTable.DropLocation) support.getDropLocation();
String name = (String) support.getTransferable().getTransferData(DataFlavor.stringFlavor);
DefaultTableModel model = ((DefaultTableModel) ((JTable) support.getComponent()).getModel());
ProcessVariable pos = getContext().getDevicePool().getByName(name, ProcessVariable.class);
if (pos != null) {
addDevice(pos, model, dl.getRow(), getRowData(pos));
}
} catch (Exception ex) {
ex.printStackTrace();
return false;
}
}
return true;
}
abstract Object[] getRowData(ProcessVariable pos);
};
tableInactive.setDragEnabled(true);
tableInactive.setDropMode(DropMode.INSERT_ROWS);
tableInactive.setFillsViewportHeight(true);
tableInactive.setTransferHandler(new PositinerTransferHandler() {
@Override
Object[] getRowData(ProcessVariable dev) {
return new Object[]{dev.getName()};
}
});
tableFixed.setDragEnabled(true);
tableFixed.setDropMode(DropMode.INSERT_ROWS);
tableFixed.setFillsViewportHeight(true);
tableFixed.setTransferHandler(new PositinerTransferHandler() {
@Override
Object[] getRowData(ProcessVariable dev) {
return new Object[]{dev.getName(), Double.NaN, dev.getUnit()};
}
});
tableScanned.setDragEnabled(true);
tableScanned.setDropMode(DropMode.INSERT_ROWS);
tableScanned.setFillsViewportHeight(true);
tableScanned.setTransferHandler(new PositinerTransferHandler() {
@Override
Object[] getRowData(ProcessVariable dev) {
return new Object[]{dev.getName(), Double.NaN, Double.NaN, 0, dev.getUnit()};
}
});
scientaPanels = new RegisterPanel[]{textLowEnergy,textCenterEnergy, textHighEnergy, textStepEnergy,
textLowThetaY, textCenterThetaY, textHighThetaY, textStepThetaY, textCenterThetaX, textSlices, textChannels, textExposureDev};
scientaRangeFields = new JTextField[]{textXChannelMax, textXChannelMin, textYChannelMax, textYChannelMin};
scientaCombos = new DiscretePositionerSelector[]{comboPass, comboAcquisition, comboEnergy, comboLens, comboDetMode};
deviceCombos = new JComboBox[]{comboPol, comboGrating};
buttonData.setVisible(isDetached());
detectorPlot.getAxis(Plot.AxisId.X).setLabel("X-Scale (energy)");
detectorPlot.getAxis(Plot.AxisId.Y).setLabel("Y-Scale (distance or angle)");
comboLens.getComboBox().addActionListener((java.awt.event.ActionEvent evt) -> {
updateLens();
});
modelScanned.addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
updateTime();
}
});
clear();
//startTimer(1000, 1000);
}
void addDevice(ProcessVariable dev, DefaultTableModel model, int row, Object[] data) {
if (row < 0) {
row = model.getRowCount();
}
model.insertRow(row, data);
removeDevice(dev, modelInactive, (model == modelInactive) ? row : -1);
removeDevice(dev, modelFixed, (model == modelFixed) ? row : -1);
removeDevice(dev, modelScanned, (model == modelScanned) ? row : -1);
}
void removeDevice(ProcessVariable dev, DefaultTableModel model, int except) {
for (int i = 0; i < model.getRowCount(); i++) {
if ((except < 0) || (i != except)) {
if (model.getValueAt(i, 0).equals(dev.getName())) {
model.removeRow(i);
break;
}
}
}
}
boolean hasDevice(ProcessVariable dev) {
return (hasDevice(dev, modelInactive) || hasDevice(dev, modelFixed) || hasDevice(dev, modelScanned));
}
boolean hasDevice(ProcessVariable dev, DefaultTableModel model) {
for (int i = 0; i < model.getRowCount(); i++) {
if (model.getValueAt(i, 0).equals(dev.getName())) {
return true;
}
}
return false;
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
if (runCount == 0) {
if (getFileName()==null){
clear();
}
}
for (DiscretePositionerSelector combo:scientaCombos){
try {
combo.setDevice((Device) eval(combo.getName(), true));
} catch (Exception ex) {
showException(ex);
}
}
for (RegisterPanel panel:scientaPanels){
try {
panel.setDevice((Device) eval(panel.getName(), true));
} catch (Exception ex) {
showException(ex);
}
}
try {
Device curStep = (Device) eval("scienta.currentStep", true);
curStep.addListener(progressListener);
} catch (Exception ex) {
Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, ex);
}
try {
Device estTime = (Device) eval("scienta.estTime", true);
estTime.addListener(timeListener);
} catch (Exception ex) {
Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, ex);
}
if (!intialized) {
try {
String[] mode_position = (String[]) eval("id_mode.getPositions()", true);
String[] grating_position = (String[]) eval("grating.getPositions()", true);
List<Nameable> add_pos= (List<Nameable>) eval("get_additional_positioners()", true);
additionalPositioners = new String[add_pos.size()];
for (int i=0; i< add_pos.size(); i++){
additionalPositioners[i]=add_pos.get(i).getName();
}
SwingUtilities.invokeLater(() -> {
try {
comboPol.setModel(new DefaultComboBoxModel(mode_position));
SwingUtils.insertCombo(comboPol, "", 0);
comboPol.setSelectedIndex(0);
comboGrating.setModel(new DefaultComboBoxModel(grating_position));
SwingUtils.insertCombo(comboGrating, "", 0);
comboGrating.setSelectedIndex(0);
} catch (Exception ex) {
ex.printStackTrace();
Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, ex);
}
String filename = getFileName();
clear();
if (filename!=null){
try {
open(filename);
} catch (IOException ex) {
Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
intialized = true;
} catch (Exception ex) {
ex.printStackTrace();
Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, ex);
}
}
updateMaster();
updateTime();
}
@Override
public void onStateChange(State state, State former) {
updateControls();
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//@Override
//public void onTimer() {
// if (getState().isInitialized()){
// updateTime();
// }
//}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@Override
public String getFileName() {
return (currentFile == null) ? null : currentFile.toString();
}
@Override
public boolean isTabNameUpdated() {
return false;
}
@Override
public String getType() {
return "SIStem";
}
@Override
public boolean createMenuNew() {
return true;
}
@Override
public boolean createFilePanel() {
return true;
}
@Override
public String getDescription() {
return "SIStem Scan definition file (*." + FILE_EXTENSION + ")";
}
@Override
public String[] getExtensions() {
return new String[]{FILE_EXTENSION};
}
@Override
public String getHomePath() {
return "{script}/scans";
}
@Override
public void saveAs(String fileName) throws IOException {
currentFile = new File(fileName);
if (!intialized){
return;
}
Map preActions = new LinkedHashMap();
for (JComboBox combo : deviceCombos) {
if ((combo.isVisible()) && (combo.getSelectedIndex() > 0)) {
preActions.put(combo.getName(), String.valueOf(combo.getSelectedItem()));
}
}
for (DiscretePositionerSelector combo : scientaCombos) {
if (combo.isVisible()) {
preActions.put(combo.getName(), String.valueOf(combo.getText()));
}
}
for (RegisterPanel panel : scientaPanels) {
if ((panel.isVisible()) && (!panel.getText().isBlank())) {
Object value = panel.getDevice().take();
if (value!=null){
preActions.put(panel.getName(), value);
}
}
}
for (int i = 0; i < modelFixed.getRowCount(); i++) {
preActions.put(modelFixed.getValueAt(i, 0), modelFixed.getValueAt(i, 1));
}
String[] positioners = new String[modelScanned.getRowCount()];
Double[] start = new Double[modelScanned.getRowCount()];
Double[] stop = new Double[modelScanned.getRowCount()];
Integer[] steps = new Integer[modelScanned.getRowCount()];
for (int i = 0; i < modelScanned.getRowCount(); i++) {
positioners[i] = (String) modelScanned.getValueAt(i, 0);
start[i] = (Double) modelScanned.getValueAt(i, 1);
stop[i] = (Double) modelScanned.getValueAt(i, 2);
steps[i] = (Integer) modelScanned.getValueAt(i, 3) - 1;
}
Integer[] range = new Integer[4];
for (int i = 0; i < scientaRangeFields.length; i++) {
range[i] = scientaRangeFields[i].getText().isBlank() ? null : Integer.valueOf(scientaRangeFields[i].getText().trim());
}
Map config = new HashMap();
config.put("PRE_ACTIONS", preActions);
config.put("RANGE", range.equals(new Integer[]{null, null, null, null}) ? new ArrayList() : Arr.toList(range));
config.put("POSITIONERS", positioners);
config.put("START", start);
config.put("STOP", stop);
config.put("STEPS", steps);
config.put("SENSORS", getDevices(textSensors));
config.put("SNAPS", getDevices(textSnapshots));
config.put("DIAGS", getDevices(textDiagnostics));
config.put("MONITORS", getDevices(textMonitors));
config.put("SETTLING_TIME", spinnerLatency.getValue());
config.put("PASSES", spinnerPasses.getValue());
config.put("ZIGZAG", checkZigzag.isSelected());
config.put("COMPRESSION", checkCompression.isSelected());
if (privateMasterAxis!=null){
Map masterAxis = new HashMap();
masterAxis.put("NAME", privateMasterAxis.getName());
masterAxis.put("MASTER", privateMasterAxis.getMaster().getName());
List<String> slaves = new ArrayList<>();
for (Positioner p : privateMasterAxis.getSlaves()){
slaves.add(p.getName());
}
masterAxis.put("SLAVES", slaves);
masterAxis.put("CONFIG", privateMasterAxis.getConfig());
config.put("MASTER_AXIS", masterAxis);
}
String json = JsonSerializer.encode(config, true);
Files.write(currentFile.toPath(), json.getBytes());
updateControls();
}
//TODO: remove in next version (use getContext().getPlugin)
Plugin getPlugin(String name) {
for (Plugin p: getContext().getPlugins()) {
if (IO.getPrefix(getPluginName()).equals(name)){
return p;
}
}
return null;
}
@Override
public void open(String fileName) throws IOException {
if (!intialized){
//Called from queue, set filename and load file in the panel
currentFile = (fileName != null) ? new File(fileName) : null;
Plugin p = getPlugin(SIStem.class.getSimpleName());
if (p!=null){
((SIStem)p).open(fileName);
}
return;
}
clear();
try{
if (fileName != null) {
Path path = Paths.get(fileName);
String json = new String(Files.readAllBytes(path));
currentFile = path.toFile();
Map config = (Map) JsonSerializer.decode(json, Map.class);
Map<String, Object> masterAxis = (Map) config.get("MASTER_AXIS");
if (masterAxis!=null){
String name = (String) masterAxis.get("NAME");
String master = (String) masterAxis.get("MASTER");
List<String> slaves = (List<String>) masterAxis.get("SLAVES");
Map<String, Object> cfg = (Map<String, Object>) masterAxis.get("CONFIG");
Positioner[] slaveDevices = new PositionerBase[slaves.size()];
for (int i=0; i<slaves.size(); i++){
slaveDevices[i] = (Positioner)getDevice(slaves.get(i));
}
MasterPositioner dev = new MasterPositioner(name, (PositionerBase)getDevice(master), slaveDevices);
if (cfg!=null){
//TODO
}
if (getContext().getDevicePool().addDevice(dev, false, true)){
privateMasterAxis = dev;
updateMaster();
buttonPrivateMasterAxis.setSelected(true);
if (!hasDevice(privateMasterAxis)){
modelInactive.addRow(new Object[]{name});
}
}
}
Map<String, Double> preActions = (Map) config.get("PRE_ACTIONS");
List<Integer> range = (List) config.getOrDefault("RANGE", new ArrayList());
List<String> positioners = (List) config.get("POSITIONERS");
List<Double> start = (List) config.get("START");
List<Double> stop = (List) config.get("STOP");
List<Integer> steps = (List) config.get("STEPS");
for (String name : preActions.keySet()) {
for (JComboBox combo : deviceCombos) {
if (name.equals(combo.getName())) {
combo.setSelectedItem(String.valueOf(preActions.get(name)));
break;
}
}
for (DiscretePositionerSelector combo : scientaCombos) {
if (name.equals(combo.getName())) {
combo.write(String.valueOf(preActions.get(name)), true);
break;
}
}
for (RegisterPanel panel : scientaPanels) {
if (name.equals(panel.getName())) {
panel.write(preActions.get(name), true);
break;
}
}
for (int i = 0; i < range.size(); i++) {
if (range.get(i) != null) {
scientaRangeFields[i].setText(String.valueOf(range.get(i)).trim());
}
}
Positioner pos = getContext().getDevicePool().getByName(name, Positioner.class);
if (pos != null) {
addDevice(pos, modelFixed, -1, new Object[]{name, preActions.get(name), pos.getUnit()});
}
}
for (int i = 0; i < positioners.size(); i++) {
String name = positioners.get(i);
Positioner pos = getContext().getDevicePool().getByName(name, Positioner.class);
if (pos != null) {
addDevice(pos, modelScanned, -1, new Object[]{name, start.get(i), stop.get(i), steps.get(i) + 1, pos.getUnit()});
}
}
setDevices(textSensors, (List<String>) config.get("SENSORS"));
setDevices(textSnapshots, (List<String>) config.get("SNAPS"));
setDevices(textDiagnostics, (List<String>) config.get("DIAGS"));
setDevices(textMonitors, (List<String>) config.get("MONITORS"));
spinnerLatency.setValue(config.get("SETTLING_TIME"));
spinnerPasses.setValue(config.get("PASSES"));
checkZigzag.setSelected((Boolean) config.get("ZIGZAG"));
checkCompression.setSelected((Boolean) config.get("COMPRESSION"));
updateDetectorPlot();
}
} finally{
updateControls();
updateTime();
}
}
@Override
public void clear() {
currentFile = null;
deletePrivateMasterAxis();
for (JComboBox combo : deviceCombos) {
if (combo.getModel().getSize()>0){
combo.setSelectedIndex(0);
}
}
for (JTextField text : scientaRangeFields) {
text.setText("");
}
modelFixed.setRowCount(0);
modelScanned.setRowCount(0);
String[] DEFAULT_SENSORS = new String[]{"scienta.dataMatrix"};
//String[] DEFAULT_SNAPS = new String[]{"temp_cryostat", "temp_sample1", "temp_headmech", "temp_sample2",
// "temp_boot1", "temp_shield", "temp_boot2", "temp_cryopump",
// "acmi", "tcmp", "exit_slit", "fe_vert_width", "fe_horiz_width"};
//String[] DEFAULT_DIAGS = new String[]{"x", "y", "z", "phi", "theta", "tilt"};
String[] DEFAULT_DIAGS = getContext().getDevicePool().getAllNamesOrderedByName(Motor.class);
String[] DEFAULT_SNAPS = Arr.remove(getContext().getDevicePool().getAllNamesOrderedByName(ReadonlyProcessVariable.class), DEFAULT_DIAGS);
String[] DEFAULT_MONITORS = new String[]{"current"};
setDevices(textSensors, Arr.toList(DEFAULT_SENSORS));
setDevices(textSnapshots, Arr.toList(DEFAULT_SNAPS));
setDevices(textDiagnostics, Arr.toList(DEFAULT_DIAGS));
setDevices(textMonitors, Arr.toList(DEFAULT_MONITORS));
initInactive();
spinnerLatency.setValue(0.0);
spinnerPasses.setValue(1);
checkZigzag.setSelected(false);
checkCompression.setSelected(true);
updateControls();
if (isLoaded()) {
updateDetectorPlot();
updateLens();
}
textTime.setText("");
}
@Override
protected void onUnloaded() {
deletePrivateMasterAxis();
if (queueProcessor != null) {
getContext().getPluginManager().unloadPlugin(queueProcessor);
getApp().exit(this);
}
}
public List<String> getDevices(JTextArea text) {
String[] devices = text.getText().split("\n");
for (int i = 0; i < devices.length; i++) {
devices[i] = devices[i].trim();
}
return Arr.toList(Arr.removeEquals(devices, ""));
}
public void setDevices(JTextArea text, List<String> devices) {
text.setText(String.join("\n", devices));
}
void initInactive() {
modelInactive.setRowCount(0);
List<String> names = new ArrayList<>();
names.addAll(Arrays.asList(getContext().getDevicePool().getAllNamesOrderedByName(Motor.class)));
names.addAll(Arrays.asList(getContext().getDevicePool().getAllNamesOrderedByName(MasterPositioner.class)));
if (!names.isEmpty()){
if (additionalPositioners!=null){
for (String name:additionalPositioners){
names.add(name);
}
}
for (String name : names) {
modelInactive.addRow(new Object[]{name});
}
}
}
@Override
public void execute() throws Exception {
try{
if (intialized){
//Called from queue, don't update file contents
checkValues();
checkBeamline();
save();
}
if (currentFile == null) {
return;
}
Processor p = (getView()==null) ? null : getView().getRunningProcessor(true);
boolean showException = (getView()==null) ? startButtonPressed : getView().getPreferences().getScriptPopupDialog() != Preferences.ScriptPopupDialog.None;
HashMap args = new HashMap();
args.put("NAME", getScanName());
this.runAsync("templates/SIStem", args).handle((ret, ex) -> {
if (ex != null) {
if ((p==null)||!(p instanceof QueueProcessor)){
if (showException) {
if (!getContext().isAborted()) {
showException((Exception)ex);
}
}
}
}
return ret;
});
} finally{
startButtonPressed=false;
}
}
@Override
public Object getResult() {
return getContext().getLastScriptResult();
}
String getScanName() {
String scan = null;
if (currentFile != null) {
scan = IO.getPrefix(currentFile);
String home = getContext().getSetup().expandPath(getHomePath());
String path = IO.getRelativePath(currentFile.getParentFile().getPath(), home);
if ((path != null) && (!path.isBlank()) && !path.equals("/")) {
if (!path.endsWith("/")) {
path = path + "/";
}
scan = path + scan;
}
}
return scan;
}
void updateControls() {
State state = getState();
String fileName = getFileName();
if (fileName == null) {
textFile.setText("");
} else {
String home = getContext().getSetup().expandPath(getHomePath());
if (IO.isSubPath(fileName, home)) {
fileName = IO.getRelativePath(fileName, home);
}
textFile.setText(fileName);
}
buttonStart.setEnabled((state == State.Ready) && (currentFile != null));
buttonAddToQueue.setEnabled(((state == State.Ready) && (currentFile != null)) || isDetached());
buttonAbort.setEnabled(state.isProcessing());
buttonScienta.setEnabled(state.isInitialized());
boolean selected = tableMaster.getSelectedRow() >= 0;
boolean enabled = state.isInitialized();
buttonEditMaster.setEnabled(enabled && selected);
}
void updateMaster() {
modelMaster.setNumRows(0);
for (MasterPositioner dev : getContext().getDevicePool().getAllDevices(MasterPositioner.class)) {
try {
Positioner[] slaves = dev.getSlaves();
String[] names = new String[slaves.length];
for (int i = 0; i < slaves.length; i++) {
names[i] = slaves[i].getName();
}
modelMaster.addRow(new Object[]{dev.getName(), dev.getMaster().getName(), String.join(", ", names)});
} catch (Exception ex) {
Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, ex);
}
}
updateControls();
}
MasterPositioner privateMasterAxis;
void createPrivateMasterAxis() throws Exception{
deletePrivateMasterAxis();
String name = getString("Enter name of the device:", "");
if ((name!=null) && (!name.isBlank())){
name=name.trim();
if (getContext().getDevicePool().getByName(name)!=null){
throw new Exception("Device name in use");
}
String[] motorNames = getContext().getDevicePool().getAllNamesOrderedByName(Motor.class);
String master = getString("Enter master motor:", motorNames, null);
if (master!=null){
ArrayList<String> slaves = new ArrayList<>();
boolean finished = false;
motorNames=Arr.removeEquals(motorNames, master);
while (!finished){
String slave = getString("Enter slave motor " + (slaves.size()+1) +":", motorNames, null);
if (slave!=null){
motorNames=Arr.removeEquals(motorNames, slave);
slaves.add(slave);
}
if((slave==null)||(motorNames.length==0)){
if (slaves.size()<1){
return;
}
Positioner[] slaveDevices = new PositionerBase[slaves.size()];
for (int i=0; i<slaves.size(); i++){
slaveDevices[i] = (Positioner)getDevice(slaves.get(i));
}
MasterPositioner dev = new MasterPositioner(name, (PositionerBase)getDevice(master), slaveDevices);
if (getContext().getDevicePool().addDevice(dev, false, true)){
privateMasterAxis = dev;
updateMaster();
modelInactive.addRow(new Object[]{name});
}
return;
}
}
}
}
}
void deletePrivateMasterAxis(){
if (privateMasterAxis!=null){
getContext().getDevicePool().removeDevice(privateMasterAxis, true);
removeDevice(privateMasterAxis, modelInactive, -1);
removeDevice(privateMasterAxis, modelFixed, -1);
removeDevice(privateMasterAxis, modelScanned, -1);
privateMasterAxis= null;
updateMaster();
buttonPrivateMasterAxis.setSelected(false);
}
}
void updateLens() {
try {
String lens = (String) comboLens.getText();
boolean empty = ((lens == null) || (lens.isBlank()));
//if (empty){
//lens = (String) eval("str(scienta.lensMode)", true);
//}
boolean visibleX = empty || lens.startsWith("A") || lens.startsWith("D");
boolean visibleY = empty || lens.startsWith("D");
panelX.setVisible(visibleX);
for (Component c : SwingUtils.getComponentsByType(panelX, Component.class)) {
c.setVisible(visibleX);
}
panelY.setVisible(visibleY);
for (Component c : SwingUtils.getComponentsByType(panelY, Component.class)) {
c.setVisible(visibleY);
}
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
}
}
void checkValues() {
for (int i = 0; i < modelFixed.getRowCount(); i++) {
String positioner = (String) modelFixed.getValueAt(i, 0);
Double value = (Double) modelFixed.getValueAt(i, 1);
if (Double.isNaN(value)) {
throw new IllegalArgumentException("Invalid value for " + positioner);
}
Positioner dev = (Positioner) getDevice(positioner);
dev.assertValidValue(value);
}
for (int i = 0; i < modelScanned.getRowCount(); i++) {
Double start = (Double) modelScanned.getValueAt(i, 1);
Double end = (Double) modelScanned.getValueAt(i, 2);
Integer points = (Integer) modelScanned.getValueAt(i, 3);
String positioner = (String) modelScanned.getValueAt(i, 0);
/*
if ((start == null) || Double.isNaN(start)) {
throw new IllegalArgumentException("Invalid start for " + positioner);
}
if ((end == null) || Double.isNaN(end)) {
throw new IllegalArgumentException("Invalid stop for " + positioner);
}
*/
Positioner dev = (Positioner) getDevice(positioner);
dev.assertValidValue(start);
dev.assertValidValue(end);
/*
double min = Math.min(start, end);
double max = Math.max(start, end);
if ((min < dev.getMinValue()) || (max > dev.getMaxValue())) {
throw new IllegalArgumentException("Invalid scan range for " + positioner);
}
if ((points == null) || (points < 1)) {
throw new IllegalArgumentException("Invalid points for " + positioner);
}
*/
}
for (JTextArea text : new JTextArea[]{textSensors, textDiagnostics, textSnapshots, textMonitors}) {
for (String name : getDevices(text)) {
try {
eval(name + ".take()", true);
} catch (Exception ex) {
throw new IllegalArgumentException("Invalid device " + name + " in " + text.getName() + " table");
}
}
}
List<Boolean> defined = new ArrayList();
for (JTextField text : scientaRangeFields) {
if (!text.getText().isBlank()) {
try {
Integer.valueOf(text.getText().trim());
} catch (Exception ex) {
throw new IllegalArgumentException("Invalid value in " + text.getName());
}
}
defined.add(text.getText().isBlank() ? false : true);
}
if ((defined.get(0) != defined.get(1)) || (defined.get(2) != defined.get(3))) {
throw new IllegalArgumentException("Invalid detector range");
}
}
void checkBeamline() {
Register chamber = (Register) getDevice("chamber");
if (!chamber.isSimulated()) {
if (!"AC".equals(chamber.take())) {
throw new IllegalArgumentException("Manipulator not in AC");
}
}
}
void onTabChanged() {
}
void updateDetectorPlot() {
if (getState().isInitialized()) {
new Thread(() -> {
try {
int[] sensor = (int[]) eval("scienta.getSensorSize()", true);
int[] _roi = (int[]) eval("scienta.getROI()", true);
SwingUtilities.invokeAndWait(() -> {
int[] roi = _roi;
roi = new int[]{roi[0], roi[1], roi[2] + roi[0], roi[3] + roi[1]};//Change to xmin, ymin, xmax, ymax
try {
roi[0] = Integer.valueOf(textXChannelMin.getText());
} catch (Exception ex) {
}
try {
roi[1] = Integer.valueOf(textYChannelMin.getText());
} catch (Exception ex) {
}
try {
roi[2] = Integer.valueOf(textXChannelMax.getText());
} catch (Exception ex) {
}
try {
roi[3] = Integer.valueOf(textYChannelMax.getText());
} catch (Exception ex) {
}
detectorPlot.getAxis(Plot.AxisId.X).setRange(0, sensor[0] - 1);
detectorPlot.getAxis(Plot.AxisId.Y).setRange(0, sensor[1] - 1);
if (detectorPlot.getNumberOfSeries() == 0) {
double[][] arr = new double[][]{new double[]{Double.NaN}};
detectorPlot.addSeries(new MatrixPlotSeries(""));
detectorPlot.getSeries(0).setData(arr);
}
detectorPlot.removeMarker(null);
detectorPlot.addMarker(roi[0], Plot.AxisId.X, "", Color.GREEN);
detectorPlot.addMarker(roi[1], Plot.AxisId.Y, "", Color.GREEN);
detectorPlot.addMarker(roi[2], Plot.AxisId.X, "", Color.GREEN);
detectorPlot.addMarker(roi[3], Plot.AxisId.Y, "", Color.GREEN);
});
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
}
}).start();
}
}
/*
String getMastersFile(){
return getContext().getSetup().expandPath("{config}/masters.json");
}
void saveMasters() throws IOException{
Vector vector = modelMaster.getDataVector();
String json = JsonSerializer.encode(vector, true);
Files.write(Paths.get(getMastersFile()), json.getBytes());
}
void loadMasters() throws IOException{
String json = new String(Files.readAllBytes(Paths.get(getMastersFile())));
Vector vector = (Vector) JsonSerializer.decode(json, Vector.class);
Vector header = new Vector<>();
Collections.addAll(header, SwingUtils.getTableColumnNames(tableMaster));
modelMaster.setDataVector(vector, header);
}
*/
void plotImage() throws Exception {
double[][] arr = new double[][]{new double[]{Double.NaN}};
int[] sensor = (int[]) eval("scienta.getSensorSize()", true);
int[] roi = (int[]) eval("scienta.getROI()", true);
try {
Object data = eval("scienta.getDataMatrix().take()", true);
if (data != null) {
double[][] a = (double[][]) Convert.toDouble(data);
double scaleX = roi[2] / a[0].length;
double scaleY = roi[3] / a.length;
arr = new double[sensor[0]][sensor[1]];
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[0].length; j++) {
arr[(int) (scaleY * i) + roi[1]][(int) (scaleX * j) + roi[0]] = a[i][j];
}
}
}
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
}
detectorPlot.addSeries(new MatrixPlotSeries(""));
detectorPlot.getSeries(0).setData(arr);
}
void onPlotShow() {
detectorPlot.clear();
updateDetectorPlot();
}
void onPlotHide() {
detectorPlot.clear();
}
void updateTime(){
try{
int samples = 1;
for (int i = 0; i < modelScanned.getRowCount(); i++) {
Integer points = (Integer) modelScanned.getValueAt(i, 3);
samples*=points;
}
samples = Math.max(samples,1);
String time = (String) eval("scienta.estTime.take()", true);
String text = samples + " x " + time;
SwingUtilities.invokeLater(()->{
textTime.setText(text);
});
} catch (Exception ex){
SwingUtilities.invokeLater(()->{
textTime.setText("");
});
}
}
DeviceListener progressListener = new DeviceAdapter() {
@Override
public void onValueChanged(final Device device, final Object value, final Object former) {
try {
Double p = (Double) eval("scienta.getProgress()", true);
State state = (State) eval("scienta.getState()", true);
SwingUtilities.invokeLater(() -> {
progress.setValue((int) (p * 1000));
progress.setIndeterminate((p<=0) && (state==State.Busy));
});
} catch (Exception ex) {
Logger.getLogger(SIStem.class.getName()).log(Level.WARNING, null, ex);
}
}
};
DeviceListener timeListener = new DeviceAdapter() {
@Override
public void onValueChanged(final Device device, final Object value, final Object former) {
try {
updateTime();
} catch (Exception ex) {
Logger.getLogger(SIStem.class.getName()).log(Level.WARNING, null, ex);
}
}
};
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonScienta = new javax.swing.JButton();
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel4 = new javax.swing.JPanel();
panelEnergy = new javax.swing.JPanel();
jLabel14 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
textLowEnergy = new ch.psi.pshell.swing.RegisterPanel();
textCenterEnergy = new ch.psi.pshell.swing.RegisterPanel();
textHighEnergy = new ch.psi.pshell.swing.RegisterPanel();
textStepEnergy = new ch.psi.pshell.swing.RegisterPanel();
panelY = new javax.swing.JPanel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jLabel20 = new javax.swing.JLabel();
textLowThetaY = new ch.psi.pshell.swing.RegisterPanel();
textCenterThetaY = new ch.psi.pshell.swing.RegisterPanel();
textHighThetaY = new ch.psi.pshell.swing.RegisterPanel();
textStepThetaY = new ch.psi.pshell.swing.RegisterPanel();
panelX = new javax.swing.JPanel();
jLabel26 = new javax.swing.JLabel();
textCenterThetaX = new ch.psi.pshell.swing.RegisterPanel();
jPanel10 = new javax.swing.JPanel();
jLabel29 = new javax.swing.JLabel();
jLabel30 = new javax.swing.JLabel();
comboLens = new ch.psi.pshell.swing.DiscretePositionerSelector();
comboAcquisition = new ch.psi.pshell.swing.DiscretePositionerSelector();
comboEnergy = new ch.psi.pshell.swing.DiscretePositionerSelector();
comboPass = new ch.psi.pshell.swing.DiscretePositionerSelector();
jLabel24 = new javax.swing.JLabel();
jLabel28 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel16 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel25 = new javax.swing.JLabel();
jLabel27 = new javax.swing.JLabel();
textXChannelMin = new javax.swing.JTextField();
textXChannelMax = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
textYChannelMin = new javax.swing.JTextField();
textYChannelMax = new javax.swing.JTextField();
detectorPlot = new ch.psi.pshell.plot.MatrixPlotJFree(){
@Override
protected void onShow(){
super.onShow();
onPlotShow();
}
@Override
protected void onHide(){
super.onHide();
onPlotHide();
}
};
butonPlot = new javax.swing.JButton();
comboDetMode = new ch.psi.pshell.swing.DiscretePositionerSelector();
textChannels = new ch.psi.pshell.swing.RegisterPanel();
textSlices = new ch.psi.pshell.swing.RegisterPanel();
jLabel31 = new javax.swing.JLabel();
textExposureDev = new ch.psi.pshell.swing.RegisterPanel();
jPanel11 = new javax.swing.JPanel();
checkZigzag = new javax.swing.JCheckBox();
jLabel4 = new javax.swing.JLabel();
spinnerLatency = new javax.swing.JSpinner();
jLabel1 = new javax.swing.JLabel();
spinnerPasses = new javax.swing.JSpinner();
jLabel8 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
checkCompression = new javax.swing.JCheckBox();
jLabel21 = new javax.swing.JLabel();
jLabel23 = new javax.swing.JLabel();
comboPol = new javax.swing.JComboBox<>();
comboGrating = new javax.swing.JComboBox<>();
jPanel6 = new javax.swing.JPanel();
jScrollPane8 = new javax.swing.JScrollPane();
tableMaster = new javax.swing.JTable();
buttonEditMaster = new javax.swing.JButton();
buttonPrivateMasterAxis = new javax.swing.JCheckBox();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tableInactive = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
tableFixed = new javax.swing.JTable();
jScrollPane3 = new javax.swing.JScrollPane();
tableScanned = new javax.swing.JTable();
jPanel3 = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
textSensors = new javax.swing.JTextArea();
jScrollPane5 = new javax.swing.JScrollPane();
textSnapshots = new javax.swing.JTextArea();
jScrollPane6 = new javax.swing.JScrollPane();
textDiagnostics = new javax.swing.JTextArea();
jScrollPane7 = new javax.swing.JScrollPane();
textMonitors = new javax.swing.JTextArea();
buttonAddToQueue = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
textFile = new javax.swing.JTextField();
buttonOpen = new javax.swing.JButton();
buttonSave = new javax.swing.JButton();
buttonClear = new javax.swing.JButton();
buttonData = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
textTime = new javax.swing.JTextField();
progress = new javax.swing.JProgressBar();
buttonScienta.setText("Scienta Panel");
buttonScienta.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonScientaActionPerformed(evt);
}
});
buttonStart.setText("Start");
buttonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
jTabbedPane1StateChanged(evt);
}
});
panelEnergy.setBorder(javax.swing.BorderFactory.createTitledBorder("Energy Range (eV)"));
jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel14.setText("High:");
jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel13.setText("Center:");
jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel12.setText("Low:");
jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel15.setText("Step:");
textLowEnergy.setName("scienta.lowEnergy"); // NOI18N
textCenterEnergy.setName("scienta.centerEnergy"); // NOI18N
textHighEnergy.setName("scienta.highEnergy"); // NOI18N
textStepEnergy.setName("scienta.energyStepSize"); // NOI18N
javax.swing.GroupLayout panelEnergyLayout = new javax.swing.GroupLayout(panelEnergy);
panelEnergy.setLayout(panelEnergyLayout);
panelEnergyLayout.setHorizontalGroup(
panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelEnergyLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEnergyLayout.createSequentialGroup()
.addGroup(panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14)
.addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textLowEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addComponent(textCenterEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addComponent(textHighEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEnergyLayout.createSequentialGroup()
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textStepEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
.addContainerGap())
);
panelEnergyLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel12, jLabel13, jLabel14, jLabel15});
panelEnergyLayout.setVerticalGroup(
panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelEnergyLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel12)
.addComponent(textLowEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel13)
.addComponent(textCenterEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel14)
.addComponent(textHighEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelEnergyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel15)
.addComponent(textStepEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(38, Short.MAX_VALUE))
);
panelY.setBorder(javax.swing.BorderFactory.createTitledBorder("ThetaY "));
jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel17.setText("High:");
jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel18.setText("Center:");
jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel19.setText("Low:");
jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel20.setText("Step:");
textLowThetaY.setName("scienta.lowThetaY"); // NOI18N
textCenterThetaY.setName("scienta.centerThetaY"); // NOI18N
textHighThetaY.setName("scienta.highThetaY"); // NOI18N
textStepThetaY.setName("scienta.thetaYStepSize"); // NOI18N
javax.swing.GroupLayout panelYLayout = new javax.swing.GroupLayout(panelY);
panelY.setLayout(panelYLayout);
panelYLayout.setHorizontalGroup(
panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelYLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelYLayout.createSequentialGroup()
.addGroup(panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel17)
.addComponent(jLabel19, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textLowThetaY, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addComponent(textCenterThetaY, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addComponent(textHighThetaY, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelYLayout.createSequentialGroup()
.addComponent(jLabel20)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textStepThetaY, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
.addContainerGap())
);
panelYLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel17, jLabel18, jLabel19, jLabel20});
panelYLayout.setVerticalGroup(
panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelYLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel19)
.addComponent(textLowThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel18)
.addComponent(textCenterThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel17)
.addComponent(textHighThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel20)
.addComponent(textStepThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(38, Short.MAX_VALUE))
);
panelX.setBorder(javax.swing.BorderFactory.createTitledBorder("ThetaX"));
jLabel26.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel26.setText("Center:");
textCenterThetaX.setName("scienta.centerThetaX"); // NOI18N
javax.swing.GroupLayout panelXLayout = new javax.swing.GroupLayout(panelX);
panelX.setLayout(panelXLayout);
panelXLayout.setHorizontalGroup(
panelXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelXLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel26)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textCenterThetaX, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addContainerGap())
);
panelXLayout.setVerticalGroup(
panelXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelXLayout.createSequentialGroup()
.addGap(36, 36, 36)
.addGroup(panelXLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel26)
.addComponent(textCenterThetaX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(89, Short.MAX_VALUE))
);
jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
jLabel29.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel29.setText("Energy Mode:");
jLabel30.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel30.setText("Lens Mode:");
comboLens.setName("scienta.lensModeDev"); // NOI18N
comboAcquisition.setName("scienta.acquisitionModeDev"); // NOI18N
comboEnergy.setName("scienta.energyModeDev"); // NOI18N
comboPass.setName("scienta.passEnergyDev"); // NOI18N
jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel24.setText("Pass Energy:");
jLabel28.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel28.setText("Acquisition:");
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel24)
.addComponent(jLabel28)
.addComponent(jLabel29)
.addComponent(jLabel30))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboLens, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
.addComponent(comboEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
.addComponent(comboAcquisition, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
.addComponent(comboPass, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE))
.addContainerGap())
);
jPanel10Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel24, jLabel28, jLabel29, jLabel30});
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel24)
.addComponent(comboPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel28)
.addComponent(comboAcquisition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel29)
.addComponent(comboEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel30)
.addComponent(comboLens, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(18, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(12, 12, 12)
.addComponent(panelX, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelY, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelY, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelX, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(147, Short.MAX_VALUE))
);
jPanel4Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jPanel10, panelEnergy, panelX, panelY});
jTabbedPane1.addTab("Analyzer", jPanel4);
jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel16.setText("Mode:");
jLabel9.setText("X Channel Range:");
jLabel25.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel25.setText("Slices:");
jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel27.setText("Channels:");
textXChannelMin.setName("x_channel_min"); // NOI18N
textXChannelMin.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
roiChanged(evt);
}
});
textXChannelMax.setName("x_channel_max"); // NOI18N
textXChannelMax.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
roiChanged(evt);
}
});
jLabel10.setText("Y Channel Range:");
textYChannelMin.setName("y_channel_min"); // NOI18N
textYChannelMin.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
roiChanged(evt);
}
});
textYChannelMax.setName("y_channel_max"); // NOI18N
textYChannelMax.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
roiChanged(evt);
}
});
detectorPlot.setLegendVisible(false);
detectorPlot.setTitle("");
butonPlot.setText("Plot Image");
butonPlot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butonPlotActionPerformed(evt);
}
});
comboDetMode.setName("scienta.detectorModeDev"); // NOI18N
textChannels.setName("scienta.channels"); // NOI18N
textSlices.setName("scienta.slices"); // NOI18N
jLabel31.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel31.setText("Dwell Time (s):");
textExposureDev.setName("scienta.exposureDev"); // NOI18N
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap(13, Short.MAX_VALUE)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel16)
.addComponent(jLabel31)
.addComponent(jLabel9)
.addComponent(jLabel27)
.addComponent(jLabel10)
.addComponent(jLabel25))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textChannels, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(textYChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textYChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(textSlices, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(textXChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textXChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(comboDetMode, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)
.addComponent(textExposureDev, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE))
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(butonPlot)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(detectorPlot, javax.swing.GroupLayout.DEFAULT_SIZE, 542, Short.MAX_VALUE)
.addContainerGap())
);
jPanel5Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel16, jLabel25, jLabel27, jLabel31, jLabel9});
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel16)
.addComponent(comboDetMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textExposureDev, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel31))
.addGap(18, 18, 18)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel9)
.addComponent(textXChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textXChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel27)
.addComponent(textChannels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel10)
.addComponent(textYChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textYChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel25)
.addComponent(textSlices, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(butonPlot))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(detectorPlot, javax.swing.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)))
.addContainerGap())
);
jTabbedPane1.addTab("Detector", jPanel5);
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Settling Time:");
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 1000.0d, 1.0d));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Passes:");
spinnerPasses.setModel(new javax.swing.SpinnerNumberModel(1, 1, 1000, 1));
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel8.setText("Zigzag:");
jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel22.setText("Compression:");
jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel21.setText("Polarization:");
jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel23.setText("Grating:");
comboPol.setName("id_mode"); // NOI18N
comboGrating.setName("grating"); // NOI18N
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(151, 151, 151)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel22)
.addComponent(jLabel8)
.addComponent(jLabel4)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addComponent(spinnerPasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkCompression)
.addComponent(checkZigzag)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(139, 139, 139)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel21)
.addComponent(jLabel23))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(comboPol, 0, 150, Short.MAX_VALUE)
.addComponent(comboGrating, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(141, Short.MAX_VALUE))))
);
jPanel11Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerLatency, spinnerPasses});
jPanel11Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel22, jLabel4, jLabel8});
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(43, 43, 43)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel22)
.addComponent(checkCompression))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel8)
.addComponent(checkZigzag)))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(42, 42, 42)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel21)
.addComponent(comboPol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel23)
.addComponent(comboGrating, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(spinnerPasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(177, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Scan", jPanel11);
jScrollPane8.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
tableMaster.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Name", "Master", "Slaves"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tableMaster.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
tableMaster.getTableHeader().setReorderingAllowed(false);
tableMaster.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tableMasterMouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
tableMasterMousePressed(evt);
}
});
tableMaster.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
tableMasterKeyReleased(evt);
}
});
jScrollPane8.setViewportView(tableMaster);
buttonEditMaster.setText("Edit");
buttonEditMaster.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEditMasterActionPerformed(evt);
}
});
buttonPrivateMasterAxis.setText("Create private master axis");
buttonPrivateMasterAxis.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPrivateMasterAxisActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(buttonPrivateMasterAxis)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 732, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(buttonEditMaster, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE)
.addComponent(buttonEditMaster))
.addGap(13, 13, 13)
.addComponent(buttonPrivateMasterAxis)
.addContainerGap())
);
jTabbedPane1.addTab("Master Axis", jPanel6);
jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Inactive"));
tableInactive.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Name"
}
) {
Class[] types = new Class [] {
java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tableInactive.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
tableInactive.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(tableInactive);
jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("Fixed"));
tableFixed.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Name", "Value", "Units"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.Double.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, true, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tableFixed.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
tableFixed.getTableHeader().setReorderingAllowed(false);
jScrollPane2.setViewportView(tableFixed);
jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scanned"));
tableScanned.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Name", "Start", "Stop", "Points", "Units"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.Double.class, java.lang.Double.class, java.lang.Integer.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, true, true, true, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tableScanned.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
tableScanned.getTableHeader().setReorderingAllowed(false);
jScrollPane3.setViewportView(tableScanned);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addContainerGap())
);
jTabbedPane1.addTab("Positioners", jPanel1);
jScrollPane4.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors"));
textSensors.setColumns(12);
textSensors.setRows(5);
textSensors.setName("sensors"); // NOI18N
jScrollPane4.setViewportView(textSensors);
jScrollPane5.setBorder(javax.swing.BorderFactory.createTitledBorder("Snapshots"));
textSnapshots.setColumns(12);
textSnapshots.setRows(5);
textSnapshots.setName("snapshots"); // NOI18N
jScrollPane5.setViewportView(textSnapshots);
jScrollPane6.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagnostics"));
textDiagnostics.setColumns(12);
textDiagnostics.setRows(5);
textDiagnostics.setName("diagnostics"); // NOI18N
jScrollPane6.setViewportView(textDiagnostics);
jScrollPane7.setBorder(javax.swing.BorderFactory.createTitledBorder("Monitors"));
textMonitors.setColumns(12);
textMonitors.setRows(5);
textMonitors.setName("monitors"); // NOI18N
jScrollPane7.setViewportView(textMonitors);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
.addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane7))
.addContainerGap())
);
jTabbedPane1.addTab("Records", jPanel3);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addContainerGap())
);
buttonAddToQueue.setText("Queue");
buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAddToQueueActionPerformed(evt);
}
});
jLabel3.setText("File:");
textFile.setDisabledTextColor(javax.swing.UIManager.getDefaults().getColor("TextField.foreground"));
textFile.setEnabled(false);
buttonOpen.setText("Open");
buttonOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonOpenActionPerformed(evt);
}
});
buttonSave.setText("Save As");
buttonSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonSaveActionPerformed(evt);
}
});
buttonClear.setText("Clear");
buttonClear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonClearActionPerformed(evt);
}
});
buttonData.setText("Data Panel");
buttonData.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDataActionPerformed(evt);
}
});
jLabel2.setText("Time:");
textTime.setEditable(false);
textTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
progress.setMaximum(1000);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonScienta)
.addGap(18, 18, 18)
.addComponent(buttonData)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textTime, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(progress, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(buttonStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonAbort))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textFile)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonOpen)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonSave)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAddToQueue)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonClear)))
.addContainerGap())
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonAddToQueue, buttonStart});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonClear, buttonOpen, buttonSave});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonData, buttonScienta});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonOpen)
.addComponent(buttonSave)
.addComponent(jLabel3)
.addComponent(textFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonClear)
.addComponent(buttonAddToQueue))
.addGap(18, 18, 18)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(progress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(buttonStart)
.addComponent(buttonAbort)
.addComponent(buttonData)
.addComponent(buttonScienta))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void buttonScientaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScientaActionPerformed
try {
this.showDevicePanel("scienta");
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonScientaActionPerformed
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try {
startButtonPressed=true;
execute();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
try {
abort();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenActionPerformed
try {
open();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonOpenActionPerformed
private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
try {
checkValues();
//TODO: Factorized
JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(getHomePath()));
FileNameExtensionFilter filter = new FileNameExtensionFilter(getDescription(), getExtensions());
chooser.setFileFilter(filter);
try {
if (currentFile != null) {
chooser.setSelectedFile(currentFile);
}
} catch (Exception ex) {
this.showException(ex);
}
int rVal = chooser.showSaveDialog(this);
if (rVal == JFileChooser.APPROVE_OPTION) {
String fileName = chooser.getSelectedFile().getAbsolutePath();
if (IO.getExtension(chooser.getSelectedFile().getAbsolutePath()).isEmpty()) {
fileName += "." + FILE_EXTENSION;
}
saveAs(fileName);
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonSaveActionPerformed
private void buttonAddToQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddToQueueActionPerformed
try {
QueueProcessor tq = null;
if (this.isDetached()) {
if ((queueProcessor == null) || !queueProcessor.isLoaded()) {
queueProcessor = new QueueProcessor();
Context.getInstance().getPluginManager().loadPlugin(queueProcessor, "Queue");
Context.getInstance().getPluginManager().startPlugin(queueProcessor);
}
tq = queueProcessor;
tq.requestFocus();
} else {
List<QueueProcessor> queues = getView().getQueues();
if (queues.size() == 0) {
tq = getView().openProcessor(QueueProcessor.class, null);
} else {
tq = queues.get(0);
}
getView().getDocumentsTab().setSelectedComponent(tq);
}
if (currentFile != null) {
if (tq.getTableInfoCol()!=null){
tq.addNewFile(currentFile.getPath(), "", textTime.getText());
} else {
String args = (textTime.getText().isBlank()) ? "": "\"Time\":"+textTime.getText();
tq.addNewFile(currentFile.getPath(), args);
}
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonAddToQueueActionPerformed
private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed
try {
clear();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonClearActionPerformed
private void buttonDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDataActionPerformed
try {
if ((dataDialog == null) || (!dataDialog.isDisplayable())) {
DataPanel panel = new DataPanel();
panel.initialize();
panel.setDefaultDataPanelListener();
dataDialog = showDialog("Data", null, panel);
}
dataDialog.requestFocus();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonDataActionPerformed
private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
try {
onTabChanged();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_jTabbedPane1StateChanged
private void butonPlotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butonPlotActionPerformed
try {
plotImage();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_butonPlotActionPerformed
private void roiChanged(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_roiChanged
updateDetectorPlot();
}//GEN-LAST:event_roiChanged
private void buttonEditMasterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEditMasterActionPerformed
try {
String name = (String) modelMaster.getValueAt(tableMaster.getSelectedRow(), 0);
DevicePanel pn = showDevicePanel(name);
SwingUtils.getWindow(pn).setLocationRelativeTo(this);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonEditMasterActionPerformed
private void tableMasterKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tableMasterKeyReleased
updateControls();
}//GEN-LAST:event_tableMasterKeyReleased
private void tableMasterMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMasterMousePressed
updateControls();
}//GEN-LAST:event_tableMasterMousePressed
private void tableMasterMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMasterMouseClicked
try {
if ((evt.getClickCount() % 2) == 0) {
buttonEditMasterActionPerformed(null);
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_tableMasterMouseClicked
private void buttonPrivateMasterAxisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPrivateMasterAxisActionPerformed
try {
if (buttonPrivateMasterAxis.isSelected() != (privateMasterAxis!=null)){
if (buttonPrivateMasterAxis.isSelected()) {
createPrivateMasterAxis();
} else {
deletePrivateMasterAxis();
}
}
} catch (Exception ex) {
showException(ex);
} finally{
buttonPrivateMasterAxis.setSelected(privateMasterAxis!=null);
}
}//GEN-LAST:event_buttonPrivateMasterAxisActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton butonPlot;
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonAddToQueue;
private javax.swing.JButton buttonClear;
private javax.swing.JButton buttonData;
private javax.swing.JButton buttonEditMaster;
private javax.swing.JButton buttonOpen;
private javax.swing.JCheckBox buttonPrivateMasterAxis;
private javax.swing.JButton buttonSave;
private javax.swing.JButton buttonScienta;
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkCompression;
private javax.swing.JCheckBox checkZigzag;
private ch.psi.pshell.swing.DiscretePositionerSelector comboAcquisition;
private ch.psi.pshell.swing.DiscretePositionerSelector comboDetMode;
private ch.psi.pshell.swing.DiscretePositionerSelector comboEnergy;
private javax.swing.JComboBox<String> comboGrating;
private ch.psi.pshell.swing.DiscretePositionerSelector comboLens;
private ch.psi.pshell.swing.DiscretePositionerSelector comboPass;
private javax.swing.JComboBox<String> comboPol;
private ch.psi.pshell.plot.MatrixPlotJFree detectorPlot;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JScrollPane jScrollPane6;
private javax.swing.JScrollPane jScrollPane7;
private javax.swing.JScrollPane jScrollPane8;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JPanel panelEnergy;
private javax.swing.JPanel panelX;
private javax.swing.JPanel panelY;
private javax.swing.JProgressBar progress;
private javax.swing.JSpinner spinnerLatency;
private javax.swing.JSpinner spinnerPasses;
private javax.swing.JTable tableFixed;
private javax.swing.JTable tableInactive;
private javax.swing.JTable tableMaster;
private javax.swing.JTable tableScanned;
private ch.psi.pshell.swing.RegisterPanel textCenterEnergy;
private ch.psi.pshell.swing.RegisterPanel textCenterThetaX;
private ch.psi.pshell.swing.RegisterPanel textCenterThetaY;
private ch.psi.pshell.swing.RegisterPanel textChannels;
private javax.swing.JTextArea textDiagnostics;
private ch.psi.pshell.swing.RegisterPanel textExposureDev;
private javax.swing.JTextField textFile;
private ch.psi.pshell.swing.RegisterPanel textHighEnergy;
private ch.psi.pshell.swing.RegisterPanel textHighThetaY;
private ch.psi.pshell.swing.RegisterPanel textLowEnergy;
private ch.psi.pshell.swing.RegisterPanel textLowThetaY;
private javax.swing.JTextArea textMonitors;
private javax.swing.JTextArea textSensors;
private ch.psi.pshell.swing.RegisterPanel textSlices;
private javax.swing.JTextArea textSnapshots;
private ch.psi.pshell.swing.RegisterPanel textStepEnergy;
private ch.psi.pshell.swing.RegisterPanel textStepThetaY;
private javax.swing.JTextField textTime;
private javax.swing.JTextField textXChannelMax;
private javax.swing.JTextField textXChannelMin;
private javax.swing.JTextField textYChannelMax;
private javax.swing.JTextField textYChannelMin;
// End of variables declaration//GEN-END:variables
}