Closedown

This commit is contained in:
x07maop
2015-06-17 15:17:13 +02:00
parent eb59e7c3cf
commit 3e3b71e34a
2 changed files with 285 additions and 26 deletions

View File

@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroupPlot">
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@@ -16,9 +20,14 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelPlot" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="panelParameters" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@@ -31,7 +40,6 @@
<Component id="jPanel1" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="panelPlot" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
@@ -53,7 +61,10 @@
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelPlot" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelPlot" pref="205" max="32767" attributes="0"/>
<Component id="jPanel2" pref="205" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -155,15 +166,17 @@
<Component id="spinnerDelay" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboMode" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerOffset" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="3" groupAlignment="3" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerAlpha" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboMode" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerOffset" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@@ -358,5 +371,113 @@
</Component>
</SubComponents>
</Container>
<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="Plot Options"/>
</Border>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[120, 181]"/>
</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="radioTEY" linkSize="7" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="radioTFY" linkSize="7" min="-2" max="-2" attributes="0"/>
<Component id="radioE" linkSize="7" min="-2" max="-2" attributes="0"/>
<Component id="radioF" linkSize="7" min="-2" max="-2" attributes="0"/>
<Component id="radioI0" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="50" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="radioTEY" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="radioTFY" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="radioE" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="radioF" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="radioI0" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JRadioButton" name="radioTEY">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="TEY"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 22]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioPlotActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioTFY">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="text" type="java.lang.String" value="TFY"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioPlotActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioE">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="text" type="java.lang.String" value="E"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioPlotActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioF">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="text" type="java.lang.String" value="F"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioPlotActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioI0">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="text" type="java.lang.String" value="I0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioPlotActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -35,6 +35,8 @@ public class EnergyScan extends Panel {
PluginPanel panel;
ChannelDoubleArray data;
ChannelDoubleArray edata;
ChannelDoubleArray idata;
ChannelDoubleArray fdata;
ChannelInteger count;
@Override
@@ -50,6 +52,9 @@ public class EnergyScan extends Panel {
count = (ChannelInteger) getController().getDevicePool().getByName("count");
data = (ChannelDoubleArray) getController().getDevicePool().getByName("data");
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
@@ -117,10 +122,41 @@ public class EnergyScan extends Panel {
Integer c = count.take();
if (c == null) {
series.clear();
} else {
data.setSize(c);
edata.setSize(c);
series.setData(edata.read(), data.read());
} else {
edata.setSize(c);
double[] xdata = edata.read();
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();
double[] io = idata.read();
for (int i=0;i<c;i++){
ydata[c] = (io[c] == 0.0) ? Double.NaN : ydata[c] / io[c];
}
} else if (radioTFY.isSelected()){
fdata.setSize(c);
idata.setSize(c);
ydata=fdata.read();
double[] io = idata.read();
for (int i=0;i<c;i++){
ydata[c] = (io[c] == 0.0) ? Double.NaN : ydata[c] / io[c];
}
}
if (ydata==null){
series.clear();
} else {
series.setData(xdata, ydata);
}
}
} catch (Exception ex) {
SwingUtils.showException(this, ex);
@@ -147,6 +183,7 @@ public class EnergyScan extends Panel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroupPlot = new javax.swing.ButtonGroup();
buttonExecute = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
panelPlot = new javax.swing.JPanel();
@@ -172,6 +209,12 @@ public class EnergyScan extends Panel {
jPanel1 = new javax.swing.JPanel();
comboSetup = new javax.swing.JComboBox();
buttonConfigure = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
radioTEY = new javax.swing.JRadioButton();
radioTFY = new javax.swing.JRadioButton();
radioE = new javax.swing.JRadioButton();
radioF = new javax.swing.JRadioButton();
radioI0 = new javax.swing.JRadioButton();
buttonExecute.setText("Start");
buttonExecute.addActionListener(new java.awt.event.ActionListener() {
@@ -306,14 +349,15 @@ public class EnergyScan extends Panel {
.addComponent(jLabel4)
.addComponent(spinnerDelay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(spinnerOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(spinnerAlpha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(spinnerAlpha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(spinnerOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
@@ -364,13 +408,95 @@ public class EnergyScan extends Panel {
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Plot Options"));
jPanel2.setPreferredSize(new java.awt.Dimension(120, 181));
buttonGroupPlot.add(radioTEY);
radioTEY.setSelected(true);
radioTEY.setText("TEY");
radioTEY.setMinimumSize(new java.awt.Dimension(100, 22));
radioTEY.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioPlotActionPerformed(evt);
}
});
buttonGroupPlot.add(radioTFY);
radioTFY.setText("TFY");
radioTFY.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioPlotActionPerformed(evt);
}
});
buttonGroupPlot.add(radioE);
radioE.setText("E");
radioE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioPlotActionPerformed(evt);
}
});
buttonGroupPlot.add(radioF);
radioF.setText("F");
radioF.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioPlotActionPerformed(evt);
}
});
buttonGroupPlot.add(radioI0);
radioI0.setText("I0");
radioI0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioPlotActionPerformed(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(radioTEY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(radioTFY)
.addComponent(radioE)
.addComponent(radioF)
.addComponent(radioI0))
.addContainerGap(50, Short.MAX_VALUE))
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {radioE, radioF, radioI0, radioTEY, radioTFY});
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(radioTEY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioTFY)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioF)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioI0)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -379,8 +505,7 @@ public class EnergyScan extends Panel {
.addComponent(buttonExecute, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -396,7 +521,9 @@ public class EnergyScan extends Panel {
.addComponent(buttonAbort)
.addComponent(buttonExecute))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
@@ -467,10 +594,15 @@ public class EnergyScan extends Panel {
spinnerAlpha.setEnabled(comboMode.getSelectedItem().equals("LINEAR"));
}//GEN-LAST:event_comboModeActionPerformed
private void radioPlotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioPlotActionPerformed
panel.plot();
}//GEN-LAST:event_radioPlotActionPerformed
// 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 comboSetup;
private javax.swing.JLabel jLabel1;
@@ -483,8 +615,14 @@ public class EnergyScan extends Panel {
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel panelParameters;
private javax.swing.JPanel panelPlot;
private javax.swing.JRadioButton radioE;
private javax.swing.JRadioButton radioF;
private javax.swing.JRadioButton radioI0;
private javax.swing.JRadioButton radioTEY;
private javax.swing.JRadioButton radioTFY;
private javax.swing.JSpinner spinnerAlpha;
private javax.swing.JSpinner spinnerDelay;
private javax.swing.JSpinner spinnerE1;