Closedown
This commit is contained in:
@@ -1,2 +1 @@
|
||||
Fe_plus=690 755 3 10 0 -9
|
||||
Fe_plus2=690 755 3 10 0 0
|
||||
Fe=690 755 3 10 -9 9 -2 2
|
||||
|
||||
@@ -1 +1 @@
|
||||
Fe_plus=690 755 3 10 0 -9
|
||||
Fe_plus=690 755 3 10 -9 9 -2 2
|
||||
|
||||
+54
-10
@@ -48,7 +48,6 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="panelParameters" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
@@ -57,7 +56,8 @@
|
||||
<Component id="buttonExecute" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="jPanel2" alignment="0" pref="230" max="32767" attributes="0"/>
|
||||
<Component id="jPanel2" alignment="0" pref="240" max="32767" attributes="0"/>
|
||||
<Component id="panelParameters" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelPlot" max="32767" attributes="0"/>
|
||||
@@ -179,7 +179,7 @@
|
||||
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textFolder" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace pref="22" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -265,7 +265,7 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textFile">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Unknown"/>
|
||||
<Property name="text" type="java.lang.String" value="{el}_{mode}"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||
@@ -320,12 +320,18 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="comboSetup" linkSize="6" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonConfigure" linkSize="6" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel10" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel11" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="comboSetup" linkSize="6" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonConfigure" linkSize="6" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboRunType" linkSize="6" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="23" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -333,9 +339,17 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="comboSetup" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="comboSetup" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonConfigure" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboRunType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -360,6 +374,36 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonConfigureActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel10">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Element:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel11">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Run Type:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="comboRunType">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="9">
|
||||
<StringItem index="0" value="Manual"/>
|
||||
<StringItem index="1" value="+"/>
|
||||
<StringItem index="2" value="-"/>
|
||||
<StringItem index="3" value="LH"/>
|
||||
<StringItem index="4" value="LV"/>
|
||||
<StringItem index="5" value="+/-"/>
|
||||
<StringItem index="6" value="+/-/-/+"/>
|
||||
<StringItem index="7" value="LH/LV"/>
|
||||
<StringItem index="8" value="LH/LV/LV/LH"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboRunTypeActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
|
||||
+184
-68
@@ -28,7 +28,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class EnergyScan extends Panel {
|
||||
|
||||
@@ -39,6 +39,8 @@ public class EnergyScan extends Panel {
|
||||
ChannelDoubleArray fdata;
|
||||
ChannelInteger count;
|
||||
|
||||
double[] offsets = new double[4];
|
||||
|
||||
@Override
|
||||
protected JPanel create() {
|
||||
panel = new PluginPanel();
|
||||
@@ -54,7 +56,6 @@ public class EnergyScan extends Panel {
|
||||
edata = (ChannelDoubleArray) getController().getDevicePool().getByName("edata");
|
||||
idata = (ChannelDoubleArray) getController().getDevicePool().getByName("idata");
|
||||
fdata = (ChannelDoubleArray) getController().getDevicePool().getByName("fdata");
|
||||
|
||||
|
||||
getController().getDevicePool().getByName("count").addListener(new DeviceListener() {
|
||||
@Override
|
||||
@@ -65,7 +66,7 @@ public class EnergyScan extends Panel {
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
});
|
||||
update();
|
||||
//panel.loadConfig();
|
||||
}
|
||||
@@ -73,9 +74,9 @@ public class EnergyScan extends Panel {
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
panel.loadConfig();
|
||||
panel.loadConfig();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onApplicationStateChange(State state, State former) {
|
||||
getComponent().setEnabled(state == State.Ready);
|
||||
@@ -85,11 +86,19 @@ public class EnergyScan extends Panel {
|
||||
protected void doUpdate() {
|
||||
panel.plot();
|
||||
}
|
||||
|
||||
Path getConfigFile(){
|
||||
|
||||
Path getConfigFile() {
|
||||
return Paths.get(getController().getSetup().getConfigPath(), "energy_scan.properties");
|
||||
}
|
||||
|
||||
enum Mode {
|
||||
|
||||
plus,
|
||||
minus,
|
||||
lh,
|
||||
lv
|
||||
}
|
||||
|
||||
public class PluginPanel extends MonitoredPanel {
|
||||
|
||||
final LinePlotBase plot;
|
||||
@@ -124,39 +133,39 @@ public class EnergyScan extends Panel {
|
||||
Integer c = count.take();
|
||||
if (c == null) {
|
||||
series.clear();
|
||||
} else {
|
||||
} else {
|
||||
double[] ydata = null;
|
||||
if (radioE.isSelected()){
|
||||
data.setSize(c);
|
||||
ydata=data.read();
|
||||
} else if (radioF.isSelected()){
|
||||
fdata.setSize(c);
|
||||
ydata=fdata.read();
|
||||
} else if (radioI0.isSelected()){
|
||||
idata.setSize(c);
|
||||
ydata=idata.read();
|
||||
} else if (radioTEY.isSelected()){
|
||||
data.setSize(c);
|
||||
idata.setSize(c);
|
||||
ydata=data.read();
|
||||
if (radioE.isSelected()) {
|
||||
data.setSize(c);
|
||||
ydata = data.read();
|
||||
} else if (radioF.isSelected()) {
|
||||
fdata.setSize(c);
|
||||
ydata = fdata.read();
|
||||
} else if (radioI0.isSelected()) {
|
||||
idata.setSize(c);
|
||||
ydata = idata.read();
|
||||
} else if (radioTEY.isSelected()) {
|
||||
data.setSize(c);
|
||||
idata.setSize(c);
|
||||
ydata = data.read();
|
||||
double[] i0 = idata.read();
|
||||
for (int i=0;i<c;i++){
|
||||
for (int i = 0; i < c; i++) {
|
||||
ydata[i] = (i0[i] == 0.0) ? Double.NaN : ydata[i] / i0[i];
|
||||
}
|
||||
} else if (radioTFY.isSelected()){
|
||||
fdata.setSize(c);
|
||||
idata.setSize(c);
|
||||
ydata=fdata.read();
|
||||
}
|
||||
} else if (radioTFY.isSelected()) {
|
||||
fdata.setSize(c);
|
||||
idata.setSize(c);
|
||||
ydata = fdata.read();
|
||||
double[] i0 = idata.read();
|
||||
for (int i=0;i<c;i++){
|
||||
for (int i = 0; i < c; i++) {
|
||||
ydata[i] = (i0[i] == 0.0) ? Double.NaN : ydata[i] / i0[i];
|
||||
}
|
||||
}
|
||||
if (ydata==null){
|
||||
}
|
||||
}
|
||||
if (ydata == null) {
|
||||
series.clear();
|
||||
} else {
|
||||
edata.setSize(c);
|
||||
double[] xdata = edata.read();
|
||||
edata.setSize(c);
|
||||
double[] xdata = edata.read();
|
||||
series.setData(xdata, ydata);
|
||||
}
|
||||
}
|
||||
@@ -165,20 +174,64 @@ public class EnergyScan extends Panel {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void loadConfig(){
|
||||
|
||||
void loadConfig() {
|
||||
DefaultComboBoxModel model = (DefaultComboBoxModel) comboSetup.getModel();
|
||||
model.removeAllElements();
|
||||
try{
|
||||
try {
|
||||
for (String line : Files.readAllLines(getConfigFile())) {
|
||||
if ((line!=null) && (!line.trim().isEmpty())){
|
||||
if ((line != null) && (!line.trim().isEmpty())) {
|
||||
String[] tokens = line.split("=");
|
||||
if (tokens.length>0){
|
||||
if (tokens.length > 0) {
|
||||
model.addElement(tokens[0].trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
String expandPath(String path) {
|
||||
long time = System.currentTimeMillis();
|
||||
String mode;
|
||||
if (comboMode.getSelectedIndex() == 0) {
|
||||
mode = "plus";
|
||||
} else if (comboMode.getSelectedIndex() == 1) {
|
||||
mode = "minus";
|
||||
} else {
|
||||
mode = "lin_" + String.format("%1.0f", (Double) spinnerAlpha.getValue());
|
||||
}
|
||||
|
||||
path = path.replaceAll("\\{date\\}", Chrono.getTimeStr(time, "YYYYMMdd"));
|
||||
path = path.replaceAll("\\{time\\}", Chrono.getTimeStr(time, "HHmmss"));
|
||||
path = path.replaceAll("\\{year\\}", Chrono.getTimeStr(time, "YYYY"));
|
||||
path = path.replaceAll("\\{month\\}", Chrono.getTimeStr(time, "MM"));
|
||||
path = path.replaceAll("\\{day\\}", Chrono.getTimeStr(time, "dd"));
|
||||
path = path.replaceAll("\\{el\\}", String.valueOf(comboSetup.getSelectedItem()));
|
||||
path = path.replaceAll("\\{mode\\}", mode);
|
||||
return path;
|
||||
}
|
||||
|
||||
void setMode(Mode mode) {
|
||||
switch (mode) {
|
||||
case plus:
|
||||
comboMode.setSelectedIndex(0);
|
||||
spinnerOffset.setValue(offsets[0]);
|
||||
return;
|
||||
case minus:
|
||||
comboMode.setSelectedIndex(1);
|
||||
spinnerOffset.setValue(offsets[1]);
|
||||
return;
|
||||
case lh:
|
||||
comboMode.setSelectedIndex(2);
|
||||
spinnerOffset.setValue(offsets[2]);
|
||||
spinnerAlpha.setValue(0.0);
|
||||
return;
|
||||
case lv:
|
||||
comboMode.setSelectedIndex(3);
|
||||
spinnerOffset.setValue(offsets[3]);
|
||||
spinnerAlpha.setValue(90.0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +265,9 @@ public class EnergyScan extends Panel {
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
comboSetup = new javax.swing.JComboBox();
|
||||
buttonConfigure = new javax.swing.JButton();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
jLabel11 = new javax.swing.JLabel();
|
||||
comboRunType = new javax.swing.JComboBox();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
radioTEY = new javax.swing.JRadioButton();
|
||||
radioTFY = new javax.swing.JRadioButton();
|
||||
@@ -270,7 +326,7 @@ public class EnergyScan extends Panel {
|
||||
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel6.setText("File:");
|
||||
|
||||
textFile.setText("Unknown");
|
||||
textFile.setText("{el}_{mode}");
|
||||
|
||||
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel7.setText("Folder:");
|
||||
@@ -366,7 +422,7 @@ public class EnergyScan extends Panel {
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
.addContainerGap(22, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Setup"));
|
||||
@@ -384,27 +440,49 @@ public class EnergyScan extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
jLabel10.setText("Element:");
|
||||
|
||||
jLabel11.setText("Run Type:");
|
||||
|
||||
comboRunType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Manual", "+", "-", "LH", "LV", "+/-", "+/-/-/+", "LH/LV", "LH/LV/LV/LH" }));
|
||||
comboRunType.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboRunTypeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(comboSetup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonConfigure))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(comboSetup, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonConfigure, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(comboRunType, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(23, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfigure, comboSetup});
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfigure, comboRunType, comboSetup});
|
||||
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(comboSetup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(comboSetup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel10))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonConfigure)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel11)
|
||||
.addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
@@ -511,14 +589,14 @@ public class EnergyScan extends Panel {
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(16, 16, 16)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonAbort)
|
||||
.addComponent(buttonExecute)))
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE))
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
|
||||
.addComponent(panelParameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
@@ -536,15 +614,12 @@ public class EnergyScan extends Panel {
|
||||
args.put("TIME", (Double) spinnerTime.getValue());
|
||||
args.put("DELAY", (Double) spinnerDelay.getValue());
|
||||
args.put("MODE", comboMode.getSelectedItem().toString());
|
||||
args.put("OFFSET", (Double) spinnerOffset.getValue());
|
||||
args.put("FILE", textFile.getText());
|
||||
String folder = textFolder.getText();
|
||||
long time = System.currentTimeMillis();
|
||||
folder = folder.replaceAll("\\{date\\}", Chrono.getTimeStr(time, "YYYYMMdd"));
|
||||
folder = folder.replaceAll("\\{time\\}", Chrono.getTimeStr(time, "HHmmss"));
|
||||
folder = folder.replaceAll("\\{year\\}", Chrono.getTimeStr(time, "YYYY"));
|
||||
folder = folder.replaceAll("\\{month\\}", Chrono.getTimeStr(time, "MM"));
|
||||
folder = folder.replaceAll("\\{day\\}", Chrono.getTimeStr(time, "dd"));
|
||||
args.put("OFFSET", (Double) spinnerOffset.getValue());
|
||||
|
||||
String file = expandPath(textFile.getText());
|
||||
args.put("FILE", file);
|
||||
|
||||
String folder = expandPath(textFolder.getText());
|
||||
args.put("FOLDER", folder);
|
||||
runAsync("EnergyScan", args);
|
||||
plot.getAxis(Plot.AxisId.X).setRange(Math.min(e1, e2), Math.max(e1, e2));
|
||||
@@ -559,32 +634,35 @@ public class EnergyScan extends Panel {
|
||||
|
||||
private void comboSetupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSetupActionPerformed
|
||||
try {
|
||||
Properties prop = new Properties();
|
||||
Properties prop = new Properties();
|
||||
prop.load(new FileInputStream(getConfigFile().toFile()));
|
||||
String selection = comboSetup.getSelectedItem().toString();
|
||||
String val = prop.getProperty(selection);
|
||||
String[] tokens = val.split(" ");
|
||||
if (tokens.length!=6){
|
||||
if (tokens.length != 8) {
|
||||
throw new Exception("Invalid file format");
|
||||
}
|
||||
textFile.setText(selection);
|
||||
spinnerE1.setValue(Double.valueOf(tokens[0].trim()));
|
||||
spinnerE2.setValue(Double.valueOf(tokens[1].trim()));
|
||||
spinnerTime.setValue(Double.valueOf(tokens[2].trim()));
|
||||
spinnerDelay.setValue(Double.valueOf(tokens[3].trim()));
|
||||
comboMode.setSelectedIndex(Integer.valueOf(tokens[4].trim()));
|
||||
spinnerOffset.setValue(Double.valueOf(tokens[5].trim()));
|
||||
} catch (Exception ex) {
|
||||
|
||||
offsets[0] = Double.valueOf(tokens[4].trim());
|
||||
offsets[1] = Double.valueOf(tokens[5].trim());
|
||||
offsets[2] = Double.valueOf(tokens[6].trim());
|
||||
offsets[3] = Double.valueOf(tokens[7].trim());
|
||||
comboRunTypeActionPerformed(null);
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_comboSetupActionPerformed
|
||||
|
||||
private void buttonConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigureActionPerformed
|
||||
try {
|
||||
Desktop.getDesktop().open(getConfigFile().toFile());
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_buttonConfigureActionPerformed
|
||||
|
||||
private void comboModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModeActionPerformed
|
||||
@@ -595,14 +673,52 @@ public class EnergyScan extends Panel {
|
||||
panel.plot();
|
||||
}//GEN-LAST:event_radioPlotActionPerformed
|
||||
|
||||
private void comboRunTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboRunTypeActionPerformed
|
||||
try {
|
||||
switch (comboRunType.getSelectedIndex()) {
|
||||
case 0: //Manual
|
||||
return;
|
||||
case 1: //+
|
||||
setMode(Mode.plus);
|
||||
return;
|
||||
case 2: //-
|
||||
setMode(Mode.minus);
|
||||
return;
|
||||
case 3: //LH
|
||||
setMode(Mode.lh);
|
||||
return;
|
||||
case 4: //LV
|
||||
setMode(Mode.lv);
|
||||
return;
|
||||
case 5: //+/-
|
||||
setMode(Mode.plus);
|
||||
return;
|
||||
case 6: //+/-/-/+
|
||||
setMode(Mode.plus);
|
||||
return;
|
||||
case 7: //LH/LV
|
||||
setMode(Mode.lh);
|
||||
return;
|
||||
case 8: //LH/LV/LV/LH
|
||||
setMode(Mode.lh);
|
||||
return;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
}//GEN-LAST:event_comboRunTypeActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonConfigure;
|
||||
private javax.swing.JButton buttonExecute;
|
||||
private javax.swing.ButtonGroup buttonGroupPlot;
|
||||
private javax.swing.JComboBox comboMode;
|
||||
private javax.swing.JComboBox comboRunType;
|
||||
private javax.swing.JComboBox comboSetup;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
|
||||
Reference in New Issue
Block a user