diff --git a/plugins/EnergyScan.form b/plugins/EnergyScan.form index 7b50e48..5658ccc 100644 --- a/plugins/EnergyScan.form +++ b/plugins/EnergyScan.form @@ -1,6 +1,10 @@
+ + + + @@ -16,9 +20,14 @@ - - - + + + + + + + + @@ -31,7 +40,6 @@ - @@ -53,7 +61,10 @@ - + + + + @@ -155,15 +166,17 @@ - - - - - - + + + + + + + + @@ -358,5 +371,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/EnergyScan.java b/plugins/EnergyScan.java index 95d6ec0..c4c313a 100644 --- a/plugins/EnergyScan.java +++ b/plugins/EnergyScan.java @@ -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//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()) ); }// //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;