XPS
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
XPS.java=enabled
|
||||
TimeResolved.java=enabled
|
||||
EnergyScan.java=enabled
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Wed Jan 11 10:35:51 CET 2023
|
||||
#Wed Jan 11 10:54:13 CET 2023
|
||||
LastRunDate=230111
|
||||
FileSequentialNumber=99
|
||||
DaySequentialNumber=6
|
||||
FileSequentialNumber=100
|
||||
DaySequentialNumber=7
|
||||
|
||||
@@ -131,22 +131,17 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textName" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonClear" linkSize="6" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonOpen" linkSize="6" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" linkSize="6" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textName" pref="108" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonClear" linkSize="6" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonOpen" linkSize="6" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" linkSize="6" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
@@ -154,9 +149,9 @@
|
||||
<Component id="spinnerPasses" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonAddToQueue" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -202,12 +197,12 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="buttonAdd" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="307" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="buttonInsert" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonDelete" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@@ -221,7 +216,7 @@
|
||||
<Component id="jScrollPane1" pref="82" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonAdd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonInsert" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonDelete" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@@ -247,15 +242,19 @@
|
||||
</Table>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tableMouseReleased"/>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="tableKeyReleased"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="buttonAdd">
|
||||
<Component class="javax.swing.JButton" name="buttonInsert">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Add"/>
|
||||
<Property name="text" type="java.lang.String" value="Insert"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonInsertActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonDelete">
|
||||
|
||||
@@ -31,6 +31,7 @@ public class EnergyScan extends ScriptProcessor {
|
||||
public EnergyScan() {
|
||||
initComponents();
|
||||
model = (DefaultTableModel) table.getModel();
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,6 +81,7 @@ public class EnergyScan extends ScriptProcessor {
|
||||
buttonAbort.setEnabled((state == State.Busy) && isRunning());
|
||||
buttonScienta.setEnabled(state.isInitialized());
|
||||
buttonAddToQueue.setEnabled(buttonStart.isEnabled());
|
||||
updateButtons();
|
||||
updateSeq();
|
||||
}
|
||||
|
||||
@@ -134,6 +136,7 @@ public class EnergyScan extends ScriptProcessor {
|
||||
data.add(spinnerPasses.getValue());
|
||||
String json = EncoderJson.encode(data, true);
|
||||
Files.write(currentFile.toPath(), json.getBytes());
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,6 +155,7 @@ public class EnergyScan extends ScriptProcessor {
|
||||
model.setDataVector(vector[1], SwingUtils.getTableColumnNames(table));
|
||||
spinnerPasses.setValue((vector.length>2) ? (Integer)vector[2][0][0] : 1);
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
String lastOutput;
|
||||
@@ -201,6 +205,18 @@ public class EnergyScan extends ScriptProcessor {
|
||||
return args;
|
||||
}
|
||||
|
||||
protected void updateButtons() {
|
||||
boolean editing = !isExecuting();
|
||||
int rows = model.getRowCount();
|
||||
int cur = table.getSelectedRow();
|
||||
buttonDelete.setEnabled((rows > 0) && (cur >= 0) && editing);
|
||||
buttonInsert.setEnabled(editing);
|
||||
buttonClear.setEnabled(editing);
|
||||
buttonOpen.setEnabled(editing);
|
||||
table.setEnabled(editing);
|
||||
textName.setEnabled(editing);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
@@ -216,7 +232,7 @@ public class EnergyScan extends ScriptProcessor {
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
table = new javax.swing.JTable();
|
||||
buttonAdd = new javax.swing.JButton();
|
||||
buttonInsert = new javax.swing.JButton();
|
||||
buttonDelete = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
buttonOpen = new javax.swing.JButton();
|
||||
@@ -274,12 +290,22 @@ public class EnergyScan extends ScriptProcessor {
|
||||
return types [columnIndex];
|
||||
}
|
||||
});
|
||||
table.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
||||
tableMouseReleased(evt);
|
||||
}
|
||||
});
|
||||
table.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
tableKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane1.setViewportView(table);
|
||||
|
||||
buttonAdd.setText("Add");
|
||||
buttonAdd.addActionListener(new java.awt.event.ActionListener() {
|
||||
buttonInsert.setText("Insert");
|
||||
buttonInsert.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonAddActionPerformed(evt);
|
||||
buttonInsertActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -297,16 +323,16 @@ public class EnergyScan extends ScriptProcessor {
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(buttonAdd)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(buttonInsert)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonDelete)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addComponent(buttonDelete)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAdd, buttonDelete});
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDelete, buttonInsert});
|
||||
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -315,7 +341,7 @@ public class EnergyScan extends ScriptProcessor {
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonAdd)
|
||||
.addComponent(buttonInsert)
|
||||
.addComponent(buttonDelete))
|
||||
.addContainerGap())
|
||||
);
|
||||
@@ -361,27 +387,24 @@ public class EnergyScan extends ScriptProcessor {
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonClear)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonOpen)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSave)))
|
||||
.addContainerGap())
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textName, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonClear)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonOpen)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSave))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spinnerPasses, 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(buttonAddToQueue)
|
||||
.addGap(26, 26, 26))))
|
||||
.addComponent(buttonAddToQueue)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonClear, buttonOpen, buttonSave});
|
||||
@@ -490,19 +513,21 @@ public class EnergyScan extends ScriptProcessor {
|
||||
}
|
||||
}//GEN-LAST:event_buttonAbortActionPerformed
|
||||
|
||||
private void buttonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddActionPerformed
|
||||
private void buttonInsertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInsertActionPerformed
|
||||
try {
|
||||
//model.addRow(new Object[]{energy.getMinValue(), energy.getMaxValue(), 10.0});
|
||||
model.addRow(new Object[]{500.0, 1000.0, 100.0});
|
||||
updateButtons();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonAddActionPerformed
|
||||
}//GEN-LAST:event_buttonInsertActionPerformed
|
||||
|
||||
private void buttonDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDeleteActionPerformed
|
||||
try {
|
||||
if ((model.getRowCount() > 0) && (table.getSelectedRow() >= 0)) {
|
||||
model.removeRow(table.getSelectedRow());
|
||||
updateButtons();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
@@ -578,12 +603,20 @@ public class EnergyScan extends ScriptProcessor {
|
||||
}
|
||||
}//GEN-LAST:event_buttonClearActionPerformed
|
||||
|
||||
private void tableMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMouseReleased
|
||||
updateButtons();
|
||||
}//GEN-LAST:event_tableMouseReleased
|
||||
|
||||
private void tableKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tableKeyReleased
|
||||
updateButtons();
|
||||
}//GEN-LAST:event_tableKeyReleased
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonAdd;
|
||||
private javax.swing.JButton buttonAddToQueue;
|
||||
private javax.swing.JButton buttonClear;
|
||||
private javax.swing.JButton buttonDelete;
|
||||
private javax.swing.JButton buttonInsert;
|
||||
private javax.swing.JButton buttonOpen;
|
||||
private javax.swing.JButton buttonResetId;
|
||||
private javax.swing.JButton buttonSave;
|
||||
|
||||
@@ -139,7 +139,9 @@
|
||||
<Component id="jLabel1" linkSize="7" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textName" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonClear" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonOpen" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" min="-2" max="-2" attributes="0"/>
|
||||
@@ -163,6 +165,7 @@
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonOpen" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonClear" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
@@ -220,6 +223,14 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddToQueueActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonClear">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Clear"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
|
||||
@@ -74,6 +74,13 @@ public class TimeResolved extends ScriptProcessor {
|
||||
buttonAbort.setEnabled((state == State.Busy) && isRunning());
|
||||
buttonScienta.setEnabled(state.isInitialized());
|
||||
buttonAddToQueue.setEnabled(buttonStart.isEnabled());
|
||||
|
||||
boolean editing = !isExecuting();
|
||||
buttonClear.setEnabled(editing);
|
||||
buttonOpen.setEnabled(editing);
|
||||
textName.setEnabled(editing);
|
||||
spinnerScans.setEnabled(editing);
|
||||
|
||||
updateSeq();
|
||||
}
|
||||
|
||||
@@ -173,6 +180,7 @@ public class TimeResolved extends ScriptProcessor {
|
||||
buttonOpen = new javax.swing.JButton();
|
||||
buttonSave = new javax.swing.JButton();
|
||||
buttonAddToQueue = new javax.swing.JButton();
|
||||
buttonClear = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
textFileId = new javax.swing.JTextField();
|
||||
buttonResetId = new javax.swing.JButton();
|
||||
@@ -231,6 +239,13 @@ public class TimeResolved extends ScriptProcessor {
|
||||
}
|
||||
});
|
||||
|
||||
buttonClear.setText("Clear");
|
||||
buttonClear.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonClearActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
@@ -246,7 +261,9 @@ public class TimeResolved extends ScriptProcessor {
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textName)
|
||||
.addGap(18, 18, 18)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonClear)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonOpen)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSave)))
|
||||
@@ -267,7 +284,8 @@ public class TimeResolved extends ScriptProcessor {
|
||||
.addComponent(textName)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(buttonOpen)
|
||||
.addComponent(buttonSave))
|
||||
.addComponent(buttonSave)
|
||||
.addComponent(buttonClear))
|
||||
.addGap(11, 11, 11)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel3)
|
||||
@@ -428,9 +446,18 @@ public class TimeResolved extends ScriptProcessor {
|
||||
}
|
||||
}//GEN-LAST:event_buttonAddToQueueActionPerformed
|
||||
|
||||
private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed
|
||||
try {
|
||||
open(null);
|
||||
} catch (Exception ex) {
|
||||
showException( ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonClearActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonAddToQueue;
|
||||
private javax.swing.JButton buttonClear;
|
||||
private javax.swing.JButton buttonOpen;
|
||||
private javax.swing.JButton buttonResetId;
|
||||
private javax.swing.JButton buttonSave;
|
||||
|
||||
320
plugins/XPS.form
Normal file
320
plugins/XPS.form
Normal file
@@ -0,0 +1,320 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JEditorPane" name="jEditorPane1">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</NonVisualComponents>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel2" alignment="1" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="buttonStart" linkSize="3" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
||||
<Component id="buttonAbort" linkSize="3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textCurScan" linkSize="4" min="-2" pref="53" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="buttonScienta" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="buttonAddToQueue" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="32767" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textFileId" linkSize="4" min="-2" pref="67" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="buttonResetId" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textFileId" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textCurScan" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonAddToQueue" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonResetId" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonScienta" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="buttonStart">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Start"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonAbort">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Abort"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonScienta">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Scienta Panel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScientaActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Parameters"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textName" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonClear" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="buttonOpen" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="buttonUp" linkSize="8" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonDown" linkSize="8" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonInsert" linkSize="8" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonDelete" linkSize="8" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="textName" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonOpen" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonClear" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="150" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonInsert" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonDelete" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonUp" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonDown" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Name:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textName">
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="textNameActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonOpen">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Open"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOpenActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonSave">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Save"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSaveActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="table">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||
<Table columnCount="3" rowCount="0">
|
||||
<Column editable="true" title="Enabled" type="java.lang.Boolean"/>
|
||||
<Column editable="true" title="Region Name" type="java.lang.Object"/>
|
||||
<Column editable="false" title="Arguments" type="java.lang.String"/>
|
||||
</Table>
|
||||
</Property>
|
||||
<Property name="selectionMode" type="int" value="0"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tableMouseReleased"/>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="tableKeyReleased"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="buttonInsert">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Insert"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonInsertActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonDelete">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDeleteActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonClear">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Clear"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonUp">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Move Up"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonUpActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonDown">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Move Down"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDownActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="File ID:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textFileId">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonResetId">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Reset"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonResetIdActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Current Region:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textCurScan">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonAddToQueue">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Add To Queue"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddToQueueActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
731
plugins/XPS.java
Normal file
731
plugins/XPS.java
Normal file
@@ -0,0 +1,731 @@
|
||||
|
||||
import ch.psi.pshell.scan.Scan;
|
||||
import ch.psi.pshell.ui.ScriptProcessor;
|
||||
import ch.psi.utils.EncoderJson;
|
||||
import ch.psi.utils.IO;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.StandardDialog;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class XPS extends ScriptProcessor {
|
||||
|
||||
File currentFile;
|
||||
final DefaultTableModel model;
|
||||
public static final String FILE_EXTENSION = "xps";
|
||||
|
||||
public XPS() {
|
||||
initComponents();
|
||||
model = (DefaultTableModel) table.getModel();
|
||||
|
||||
table.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
try {
|
||||
if ((e.getClickCount() == 2) && (!e.isPopupTrigger())) {
|
||||
if (table.isEnabled()){
|
||||
int row = table.getSelectedRow();
|
||||
if ((model.getRowCount()>0) && (row>=0)){
|
||||
row = table.convertRowIndexToModel(row);
|
||||
|
||||
String name = (String) model.getValueAt(row, 1);
|
||||
String json = (String) model.getValueAt(row, 2);
|
||||
Map pars = (Map) EncoderJson.decode(json, Map.class);
|
||||
pars.put("name", name);
|
||||
Map<String, Object> newPars = showScientaParametersDialog(pars);
|
||||
if (newPars!=null){
|
||||
name = (String) newPars.get("name");
|
||||
if (name!=null){
|
||||
newPars.remove("name");
|
||||
json = EncoderJson.encode(newPars, true);
|
||||
//showMessage(name, json);
|
||||
model.setValueAt(name, row, 1);
|
||||
model.setValueAt(json, row, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
table.getColumnModel().getColumn(0).setMaxWidth(60);
|
||||
table.getColumnModel().getColumn(0).setResizable(false);
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "XPS";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSave() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return (currentFile==null) ? null : currentFile.toString();
|
||||
}
|
||||
@Override
|
||||
public boolean createMenuNew() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createFilePanel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "XPS scan definition file (*." + FILE_EXTENSION + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getExtensions() {
|
||||
return new String[]{FILE_EXTENSION};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHomePath() {
|
||||
return "{home}/parameters";
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
this.startTimer(1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
buttonStart.setEnabled(state == State.Ready);
|
||||
buttonAbort.setEnabled((state == State.Busy) && isRunning());
|
||||
buttonScienta.setEnabled(state.isInitialized());
|
||||
buttonAddToQueue.setEnabled(buttonStart.isEnabled());
|
||||
updateButtons();
|
||||
updateSeq();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimer() {
|
||||
if (isRunning()){
|
||||
try{
|
||||
textCurScan.setText(getGlobalVar("CURRENT_REGION").toString());
|
||||
} catch(Exception ex){
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
textCurScan.setText("");
|
||||
}
|
||||
try{
|
||||
int index = (Integer)getGlobalVar("CURRENT_INDEX");
|
||||
for (int row=0; row<model.getRowCount(); row++){
|
||||
if (Boolean.TRUE.equals(model.getValueAt(row, 0))){
|
||||
if (index==0){
|
||||
row = table.convertRowIndexToView(row);
|
||||
table.setRowSelectionInterval(row, row);
|
||||
break;
|
||||
}
|
||||
index--;
|
||||
}
|
||||
}
|
||||
} catch(Exception ex){
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
table.clearSelection();
|
||||
}
|
||||
} else {
|
||||
textCurScan.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
void updateSeq() {
|
||||
try {
|
||||
textFileId.setText(String.valueOf(getContext().getFileSequentialNumber()));
|
||||
} catch (Exception ex) {
|
||||
textFileId.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecutedFile(String fileName, Object result) {
|
||||
}
|
||||
|
||||
//Callback to perform update - in event thread
|
||||
@Override
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
String getScanName() {
|
||||
String name = textName.getText().trim();
|
||||
return name.isEmpty() ? null : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScript() {
|
||||
return "templates/XPS";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getArgs() {
|
||||
HashMap<String, Object> args = new HashMap<>();
|
||||
|
||||
ArrayList regions = new ArrayList();
|
||||
for (int i = 0; i < model.getRowCount(); i++) {
|
||||
if (Boolean.TRUE.equals(model.getValueAt(i, 0))){
|
||||
ArrayList region = new ArrayList();
|
||||
region.add(model.getValueAt(i, 1));
|
||||
region.add(model.getValueAt(i, 2));
|
||||
regions.add(region);
|
||||
}
|
||||
}
|
||||
|
||||
args.put("FILE", null);
|
||||
args.put("NAME", getScanName());
|
||||
args.put("REGIONS", regions);
|
||||
return args;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartingExecution(Map<String, Object> args){
|
||||
table.clearSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishedExecution(Map<String, Object> args, Object ret, Throwable t){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAs(String fileName) throws IOException {
|
||||
currentFile = new File(fileName);
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(new Object[][]{new Object[]{textName.getText()}});
|
||||
data.add(model.getDataVector());
|
||||
String json = EncoderJson.encode(data, true);
|
||||
Files.write(currentFile.toPath(), json.getBytes());
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(String fileName) throws IOException {
|
||||
if (fileName==null){
|
||||
currentFile = null;
|
||||
textName.setText("");
|
||||
model.setRowCount(0);
|
||||
} else {
|
||||
Path path = Paths.get(fileName);
|
||||
String json = new String(Files.readAllBytes(path));
|
||||
currentFile = path.toFile();
|
||||
Object[][][] vector = (Object[][][]) EncoderJson.decode(json, Object[][][].class);
|
||||
textName.setText(String.valueOf(vector[0][0][0]));
|
||||
model.setDataVector(vector[1], SwingUtils.getTableColumnNames(table));
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> showScientaParametersDialog(Map<String, Object> pars) throws Exception{
|
||||
Class cls = getContext().getClassByName("ScientaParametersDialog");
|
||||
Constructor constructor= cls.getConstructor(Window.class, boolean.class, Map.class);
|
||||
StandardDialog dlg = (StandardDialog) constructor.newInstance(getWindow(),true, pars);
|
||||
dlg.setVisible(true);
|
||||
if (dlg.getResult()){
|
||||
return (Map<String, Object>)cls.getMethod("getValues").invoke(dlg);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void updateButtons() {
|
||||
boolean editing = !isExecuting();
|
||||
int rows = model.getRowCount();
|
||||
int cur = table.getSelectedRow();
|
||||
buttonUp.setEnabled((rows > 0) && (cur > 0) && editing);
|
||||
buttonDown.setEnabled((rows > 0) && (cur >= 0) && (cur < (rows - 1)) && editing);
|
||||
buttonDelete.setEnabled((rows > 0) && (cur >= 0) && editing);
|
||||
buttonInsert.setEnabled(editing);
|
||||
buttonClear.setEnabled(editing);
|
||||
buttonOpen.setEnabled(editing);
|
||||
table.setEnabled(editing);
|
||||
textName.setEnabled(editing);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
jEditorPane1 = new javax.swing.JEditorPane();
|
||||
buttonStart = new javax.swing.JButton();
|
||||
buttonAbort = new javax.swing.JButton();
|
||||
buttonScienta = new javax.swing.JButton();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
textName = new javax.swing.JTextField();
|
||||
buttonOpen = new javax.swing.JButton();
|
||||
buttonSave = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
table = new javax.swing.JTable();
|
||||
buttonInsert = new javax.swing.JButton();
|
||||
buttonDelete = new javax.swing.JButton();
|
||||
buttonClear = new javax.swing.JButton();
|
||||
buttonUp = new javax.swing.JButton();
|
||||
buttonDown = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
textFileId = new javax.swing.JTextField();
|
||||
buttonResetId = new javax.swing.JButton();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
textCurScan = new javax.swing.JTextField();
|
||||
buttonAddToQueue = new javax.swing.JButton();
|
||||
|
||||
jScrollPane2.setViewportView(jEditorPane1);
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
buttonScienta.setText("Scienta Panel");
|
||||
buttonScienta.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonScientaActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
|
||||
|
||||
jLabel1.setText("Name:");
|
||||
|
||||
textName.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
textNameActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonOpen.setText("Open");
|
||||
buttonOpen.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonOpenActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonSave.setText("Save");
|
||||
buttonSave.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonSaveActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
table.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
|
||||
},
|
||||
new String [] {
|
||||
"Enabled", "Region Name", "Arguments"
|
||||
}
|
||||
) {
|
||||
Class[] types = new Class [] {
|
||||
java.lang.Boolean.class, java.lang.Object.class, java.lang.String.class
|
||||
};
|
||||
boolean[] canEdit = new boolean [] {
|
||||
true, true, false
|
||||
};
|
||||
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
return types [columnIndex];
|
||||
}
|
||||
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return canEdit [columnIndex];
|
||||
}
|
||||
});
|
||||
table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
table.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
||||
tableMouseReleased(evt);
|
||||
}
|
||||
});
|
||||
table.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
tableKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane1.setViewportView(table);
|
||||
|
||||
buttonInsert.setText("Insert");
|
||||
buttonInsert.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonInsertActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonDelete.setText("Delete");
|
||||
buttonDelete.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonDeleteActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonClear.setText("Clear");
|
||||
buttonClear.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonClearActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonUp.setText("Move Up");
|
||||
buttonUp.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonUpActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonDown.setText("Move Down");
|
||||
buttonDown.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonDownActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
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()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonClear)
|
||||
.addGap(5, 5, 5)
|
||||
.addComponent(buttonOpen)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSave))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(buttonUp)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonDown)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonInsert)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonDelete)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDelete, buttonDown, buttonInsert, buttonUp});
|
||||
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(textName)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(buttonOpen)
|
||||
.addComponent(buttonSave)
|
||||
.addComponent(buttonClear))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonInsert)
|
||||
.addComponent(buttonDelete)
|
||||
.addComponent(buttonUp)
|
||||
.addComponent(buttonDown))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jLabel2.setText("File ID:");
|
||||
|
||||
textFileId.setEditable(false);
|
||||
textFileId.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
|
||||
buttonResetId.setText("Reset");
|
||||
buttonResetId.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonResetIdActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel4.setText("Current Region:");
|
||||
|
||||
textCurScan.setEditable(false);
|
||||
textCurScan.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
|
||||
buttonAddToQueue.setText("Add To Queue");
|
||||
buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonAddToQueueActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
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()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(33, 33, 33)
|
||||
.addComponent(buttonAbort)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel4)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textCurScan, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(buttonScienta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(18, 18, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(buttonAddToQueue)
|
||||
.addGap(18, 18, Short.MAX_VALUE)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textFileId, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(buttonResetId, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addContainerGap())))
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonStart});
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonResetId, textCurScan, textFileId});
|
||||
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(7, 7, 7)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(textFileId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(textCurScan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonAddToQueue))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonResetId)
|
||||
.addComponent(buttonScienta))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonStart)
|
||||
.addComponent(buttonAbort))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
|
||||
try {
|
||||
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 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 buttonResetIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonResetIdActionPerformed
|
||||
try {
|
||||
this.getContext().setFileSequentialNumber(0);
|
||||
updateSeq();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonResetIdActionPerformed
|
||||
|
||||
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 {
|
||||
JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(getHomePath()));
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter(getDescription(), getExtensions());
|
||||
chooser.setFileFilter(filter);
|
||||
try {
|
||||
if (currentFile != null) {
|
||||
chooser.setSelectedFile(currentFile);
|
||||
} else if (getScanName() != null) {
|
||||
File file = Paths.get(chooser.getCurrentDirectory().getAbsolutePath(), getScanName()).toFile();
|
||||
chooser.setSelectedFile(file);
|
||||
}
|
||||
} 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 {
|
||||
//queue(getFileName()!=null); //If file is defined then queue file.
|
||||
queue(); //Queue editing parameters
|
||||
} catch (Exception ex) {
|
||||
showException( ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonAddToQueueActionPerformed
|
||||
|
||||
private void textNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textNameActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_textNameActionPerformed
|
||||
|
||||
private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed
|
||||
try {
|
||||
open(null);
|
||||
} catch (Exception ex) {
|
||||
showException( ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonClearActionPerformed
|
||||
|
||||
private void buttonInsertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInsertActionPerformed
|
||||
try {
|
||||
Map<String, Object> pars = showScientaParametersDialog(null);
|
||||
if (pars!=null){
|
||||
String name = (String) pars.get("name");
|
||||
if (name!=null){
|
||||
pars.remove("name");
|
||||
String json = EncoderJson.encode(pars, true);
|
||||
model.addRow(new Object[]{true, name, json});
|
||||
updateButtons();
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException( ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonInsertActionPerformed
|
||||
|
||||
private void buttonDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDeleteActionPerformed
|
||||
try {
|
||||
if ((model.getRowCount() > 0) && (table.getSelectedRow() >= 0)) {
|
||||
model.removeRow(table.getSelectedRow());
|
||||
updateButtons();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonDeleteActionPerformed
|
||||
|
||||
private void buttonUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUpActionPerformed
|
||||
try {
|
||||
int rows = model.getRowCount();
|
||||
int cur = table.getSelectedRow();
|
||||
model.moveRow(cur, cur, cur - 1);
|
||||
table.setRowSelectionInterval(cur - 1, cur - 1);
|
||||
updateButtons();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonUpActionPerformed
|
||||
|
||||
private void buttonDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDownActionPerformed
|
||||
try {
|
||||
int rows = model.getRowCount();
|
||||
int cur = table.getSelectedRow();
|
||||
model.moveRow(cur, cur, cur + 1);
|
||||
table.setRowSelectionInterval(cur + 1, cur + 1);
|
||||
updateButtons();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonDownActionPerformed
|
||||
|
||||
private void tableKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tableKeyReleased
|
||||
updateButtons();
|
||||
}//GEN-LAST:event_tableKeyReleased
|
||||
|
||||
private void tableMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMouseReleased
|
||||
updateButtons();
|
||||
}//GEN-LAST:event_tableMouseReleased
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonAddToQueue;
|
||||
private javax.swing.JButton buttonClear;
|
||||
private javax.swing.JButton buttonDelete;
|
||||
private javax.swing.JButton buttonDown;
|
||||
private javax.swing.JButton buttonInsert;
|
||||
private javax.swing.JButton buttonOpen;
|
||||
private javax.swing.JButton buttonResetId;
|
||||
private javax.swing.JButton buttonSave;
|
||||
private javax.swing.JButton buttonScienta;
|
||||
private javax.swing.JButton buttonStart;
|
||||
private javax.swing.JButton buttonUp;
|
||||
private javax.swing.JEditorPane jEditorPane1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JTable table;
|
||||
private javax.swing.JTextField textCurScan;
|
||||
private javax.swing.JTextField textFileId;
|
||||
private javax.swing.JTextField textName;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
84
script/templates/XPS.py
Normal file
84
script/templates/XPS.py
Normal file
@@ -0,0 +1,84 @@
|
||||
import json
|
||||
|
||||
CURRENT_REGION = ""
|
||||
CURRENT_INDEX = -1
|
||||
|
||||
if get_exec_pars().debug:
|
||||
print "Setting debug parameters"
|
||||
NAME = None
|
||||
FILE = None
|
||||
R1 = """{
|
||||
"scienta.elementSet" : "HiPPHAXPES",
|
||||
"scienta.lensMode" : "T_HiPPHAXPES",
|
||||
"scienta.lowEnergy" : 387.0,
|
||||
"scienta.acquisitionMode" : "Swept",
|
||||
"scienta.slices" : 1.0,
|
||||
"scienta.stepSize" : 0.25,
|
||||
"scienta.passEnergy" : 2,
|
||||
"scienta.detectorMode" : "ADC",
|
||||
"scienta.energyMode" : "Kinetic",
|
||||
"scienta.centerEnergy" : 397.0,
|
||||
"scienta.stepTime" : 1.0,
|
||||
"scienta.highEnergy" : 407.0,
|
||||
"scienta.iterations" : 1.0
|
||||
} """
|
||||
|
||||
REGIONS = [["R1", R1]]
|
||||
|
||||
if FILE:
|
||||
FILE = get_context().setup.expandPath("{home}/parameters/" + FILE)
|
||||
with open(FILE) as json_file:
|
||||
cfg = json.load(json_file)
|
||||
NAME , REGIONS= cfg[0][0][0], cfg[1]
|
||||
print "FILE: ", FILE
|
||||
print "NAME: ", NAME
|
||||
#print "REGIONS: ", REGIONS
|
||||
|
||||
|
||||
set_device_alias(scienta.getSpectrum(), "spectrum")
|
||||
set_device_alias(scienta.getDataMatrix(), "image")
|
||||
set_device_alias(scienta.stats[0], "sum")
|
||||
|
||||
sensors=[i0, scienta.stats[0], scienta.getSpectrum()]
|
||||
|
||||
|
||||
def apply_pars(pars):
|
||||
scienta.elementSet = scienta.elementSet.valueOf(pars["scienta.elementSet"])
|
||||
scienta.lensMode = scienta.lensMode.valueOf(pars["scienta.lensMode"])
|
||||
scienta.detectorMode = scienta.detectorMode.valueOf(pars["scienta.detectorMode"])
|
||||
scienta.energyMode = scienta.energyMode.valueOf(pars["scienta.energyMode"])
|
||||
scienta.acquisitionMode = scienta.acquisitionMode.valueOf(pars["scienta.acquisitionMode"])
|
||||
scienta.passEnergy = pars["scienta.passEnergy"]
|
||||
scienta.getLowEnergy().writeAsync(pars["scienta.centerEnergy"])
|
||||
scienta.getCenterEnergy().writeAsync(pars["scienta.passEnergy"])
|
||||
scienta.getHighEnergy().writeAsync(pars["scienta.highEnergy"])
|
||||
scienta.getSlices().writeAsync(pars["scienta.slices"])
|
||||
scienta.getStepSize().writeAsync(pars["scienta.stepSize"])
|
||||
scienta.getStepTime().writeAsync(pars["scienta.stepTime"])
|
||||
scienta.setIterations(int(pars["scienta.iterations"]))
|
||||
|
||||
|
||||
|
||||
def before_read(position, scan):
|
||||
#trigger_scienta()
|
||||
pass
|
||||
|
||||
|
||||
#dummy_trigger_scienta()
|
||||
|
||||
|
||||
try:
|
||||
for r in REGIONS:
|
||||
name=r[0]
|
||||
pars = json.loads(r[1])
|
||||
CURRENT_REGION = name
|
||||
CURRENT_INDEX = CURRENT_INDEX+1
|
||||
print "Region: ", name
|
||||
print "Pars: ", pars
|
||||
apply_pars(pars)
|
||||
time.sleep(5.0)
|
||||
|
||||
#tscan(sensors, 1, 0.001, before_read=before_read, after_read=after_readout, name = NAME)
|
||||
finally:
|
||||
scienta.zeroSupplies()
|
||||
|
||||
27
script/test/TestScientaParsPanel.py
Normal file
27
script/test/TestScientaParsPanel.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import ch.psi.utils.swing.SwingUtils as SwingUtils
|
||||
import ScientaParametersPanel
|
||||
import ScientaParametersDialog
|
||||
|
||||
"""
|
||||
pn = ScientaParametersPanel()
|
||||
pn.setDevice(scienta)
|
||||
SwingUtils.showDialog(App.getInstance().getMainFrame(), "Scienta", None, pn)
|
||||
time.sleep(1.0)
|
||||
pars = pn.values
|
||||
for k in pars.keySet() : print k,"=",pars[k]
|
||||
"""
|
||||
|
||||
|
||||
dlg = ScientaParametersDialog(App.getInstance().getMainFrame(),True, None)
|
||||
dlg.visible=True
|
||||
if dlg.result:
|
||||
pars = dlg.values
|
||||
for k in pars.keySet() : print k,"=",pars[k]
|
||||
|
||||
|
||||
dlg = ScientaParametersDialog(App.getInstance().getMainFrame(),True, pars)
|
||||
dlg.visible=True
|
||||
if dlg.result:
|
||||
pars = dlg.values
|
||||
for k in pars.keySet() : print k,"=",pars[k]
|
||||
|
||||
Reference in New Issue
Block a user