diff --git a/config/plugins.properties b/config/plugins.properties index 4ba62ba..e4f6483 100644 --- a/config/plugins.properties +++ b/config/plugins.properties @@ -1,3 +1,3 @@ test2.java=enabled GunSolenoidAlignment.java=disabled -test.java=enabled +test.java=disabled diff --git a/plugins/test2.form b/plugins/test2.form index ff9cfab..f212544 100644 --- a/plugins/test2.form +++ b/plugins/test2.form @@ -16,13 +16,272 @@ - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/test2.java b/plugins/test2.java index 9ab0acc..e4b2189 100644 --- a/plugins/test2.java +++ b/plugins/test2.java @@ -39,18 +39,250 @@ public class test2 extends Panel { // //GEN-BEGIN:initComponents private void initComponents() { + buttonRun = new javax.swing.JButton(); + buttonAbort = new javax.swing.JButton(); + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + spinnerI1 = new javax.swing.JSpinner(); + jLabel2 = new javax.swing.JLabel(); + spinnerI2 = new javax.swing.JSpinner(); + jLabel3 = new javax.swing.JLabel(); + spinnerStep = new javax.swing.JSpinner(); + jLabel4 = new javax.swing.JLabel(); + spinnerSettlingTime = new javax.swing.JSpinner(); + checkSaveImages = new javax.swing.JCheckBox(); + spinnerNumBackgrounds = new javax.swing.JSpinner(); + jLabel5 = new javax.swing.JLabel(); + checkBackground = new javax.swing.JCheckBox(); + radioBackSimple = new javax.swing.JRadioButton(); + radioBackMultiple = new javax.swing.JRadioButton(); + jLabel6 = new javax.swing.JLabel(); + spinnerNumImages = new javax.swing.JSpinner(); + + buttonRun.setText("Run"); + buttonRun.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonRunActionPerformed(evt); + } + }); + + buttonAbort.setText("Abort"); + buttonAbort.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonAbortActionPerformed(evt); + } + }); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters")); + + jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel1.setText("Starting phase:"); + + spinnerI1.setModel(new javax.swing.SpinnerNumberModel(100.0d, 50.0d, 150.0d, 1.0d)); + spinnerI1.setName("spinnerphi1"); // NOI18N + + jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel2.setText("Final phase:"); + + spinnerI2.setModel(new javax.swing.SpinnerNumberModel(100.0d, 50.0d, 150.0d, 1.0d)); + spinnerI2.setName("spinnerphi2"); // NOI18N + + jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel3.setText("Step size:"); + + spinnerStep.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.1d, 10.0d, 1.0d)); + + jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel4.setText("Settling time:"); + + spinnerSettlingTime.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 10.0d, 1.0d)); + + checkSaveImages.setText("Save images"); + + spinnerNumBackgrounds.setModel(new javax.swing.SpinnerNumberModel(5, 1, 10, 1)); + + jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel5.setText("Number of backgrounds:"); + + checkBackground.setSelected(true); + checkBackground.setText("Background:"); + checkBackground.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkBackgroundActionPerformed(evt); + } + }); + + radioBackSimple.setText("Simple"); + + radioBackMultiple.setSelected(true); + radioBackMultiple.setText("Multiple"); + + jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel6.setText("Number of images:"); + + spinnerNumImages.setModel(new javax.swing.SpinnerNumberModel(0, 0, 10, 1)); + + 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() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spinnerI1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spinnerI2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spinnerSettlingTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinnerNumBackgrounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spinnerNumImages, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(radioBackSimple) + .addComponent(checkBackground)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(radioBackMultiple)) + .addComponent(checkSaveImages)) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(spinnerI1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(spinnerI2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(spinnerSettlingTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(4, 4, 4) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(spinnerNumImages, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent(checkBackground) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(radioBackSimple) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(radioBackMultiple) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(spinnerNumBackgrounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(57, 57, 57) + .addComponent(checkSaveImages) + .addContainerGap(207, Short.MAX_VALUE)) + ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 449, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 307, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(buttonRun, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)) + .addGap(100, 100, 100)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 137, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(41, 41, 41) + .addComponent(buttonRun) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonAbort)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addContainerGap()) ); }// //GEN-END:initComponents + private void buttonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRunActionPerformed + try { + HashMap args = new HashMap(); + args.put("phi1", spinnerphi1.getValue()); + args.put("phi2", spinnerphi2.getValue()); + args.put("dphi", spinnerStep.getValue()); + args.put("settling_time", spinnerSettlingTime.getValue()); + args.put("plot_image", checkSaveImages.isSelected()); + args.put("number_images", spinnerNumImages.getValue()); + args.put("number_backgrounds", spinnerNumBackgrounds.getValue()); + args.put("use_background", checkBackground.isSelected()); + args.put("multiple_background", radioBackMultiple.isSelected()); + ((Plugin)this).runAsync("Alignment/Laser_gun_alignment",args); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonRunActionPerformed + + 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 checkBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBackgroundActionPerformed + radioBackMultiple.setEnabled(checkBackground.isSelected()); + radioBackSimple.setEnabled(checkBackground.isSelected()); + spinnerNumBackgrounds.setEnabled(checkBackground.isSelected()); + }//GEN-LAST:event_checkBackgroundActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton buttonAbort; + private javax.swing.JButton buttonRun; + private javax.swing.JCheckBox checkBackground; + private javax.swing.JCheckBox checkSaveImages; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JPanel jPanel1; + private javax.swing.JRadioButton radioBackMultiple; + private javax.swing.JRadioButton radioBackSimple; + private javax.swing.JSpinner spinnerphi1; + private javax.swing.JSpinner spinnerphi2; + private javax.swing.JSpinner spinnerNumBackgrounds; + private javax.swing.JSpinner spinnerNumImages; + private javax.swing.JSpinner spinnerSettlingTime; + private javax.swing.JSpinner spinnerStep; // End of variables declaration//GEN-END:variables }