diff --git a/plugins/Kollimators.form b/plugins/Kollimators.form index 489b048..857a444 100644 --- a/plugins/Kollimators.form +++ b/plugins/Kollimators.form @@ -17,8 +17,8 @@ - - + + @@ -188,6 +188,7 @@ + diff --git a/plugins/Kollimators.java b/plugins/Kollimators.java index 805f9e4..e9c57ab 100644 --- a/plugins/Kollimators.java +++ b/plugins/Kollimators.java @@ -82,14 +82,15 @@ public class Kollimators extends javax.swing.JPanel { jLabel8.setText("Resolution:"); jLabelDeviceName.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabelDeviceName.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabelDeviceName, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE) + .addGap(3, 3, 3) + .addComponent(jLabelDeviceName, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() diff --git a/plugins/TestingList.form b/plugins/TestingList.form index b78419e..434bd29 100644 --- a/plugins/TestingList.form +++ b/plugins/TestingList.form @@ -476,6 +476,9 @@ + + + @@ -487,7 +490,7 @@ - + @@ -524,8 +527,14 @@ + + + + + + - + @@ -549,7 +558,7 @@ - + diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 31c56f4..8f486b0 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -324,7 +324,7 @@ public class TestingList extends Panel { private void loadProperties(){ File configFile = TESTS_PROPERTIES_DEFAULT_DIR.toFile(); if (!configFile.isFile()) return; - + boolean error = false; try { FileReader reader = new FileReader(configFile); Properties props = new Properties(); @@ -359,13 +359,19 @@ public class TestingList extends Panel { } catch (FileNotFoundException ex) { // file does not exist System.out.println(ex.toString()); + error = true; } catch (IOException ex) { // I/O error System.out.println(ex.toString()); + error = true; } catch (Exception ex){ // Any other exception - System.out.println(ex.toString()); + System.out.println(ex.toString()); + error = true; } + if(error){ + //load defaults + } } @@ -474,6 +480,8 @@ public class TestingList extends Panel { public void loadCustomPanel(Component panel){ if(panel != null) loadCustomPanel(panel.getClass().getName() ); + else + closeCustomPanel(); } /** @@ -489,7 +497,9 @@ public class TestingList extends Panel { */ private void loadCustomPanel(String sPanelClassName){ closeCustomPanel(); - if (sPanelClassName == null || sPanelClassName.trim() == "" || sPanelClassName.isEmpty()) { + if ( sPanelClassName == null || + sPanelClassName.trim() == "" || + sPanelClassName.isEmpty()) { return; } @@ -539,6 +549,7 @@ public class TestingList extends Panel { //store custom panel in the properties saveProperties("customPanel", sPanelClassName); jPanelCustom.setVisible(true); + animateCustomPanel(); } catch (ClassNotFoundException ex) { Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchMethodException ex) { @@ -556,6 +567,70 @@ public class TestingList extends Panel { } } + /** + * Starts animating the custom panel, if present + * + * Note: the custom panel must have the public method "animate(String deviceName)" + * + * @param deviceName name of the device. The panel should then append the epics PV to the device name for caget/caset + */ + public void animateCustomPanel(String deviceName) { + try { + Component customPanel = getCustomPanel(); + //if no custom panel: nothing to do + if(customPanel==null) return; + //call the method "animate" of the custom panel (this function must be there) + Class[] cArg = new Class[1]; + cArg[0] = String.class; + Method animate = customPanel.getClass().getMethod("animate", cArg); + animate.invoke(customPanel, deviceName); + } catch (NoSuchMethodException ex) { + System.out.println("animateCustomPanel(): "+String.valueOf(ex)); + } catch (SecurityException ex) { + System.out.println("animateCustomPanel(): "+String.valueOf(ex)); + } catch (IllegalAccessException ex) { + System.out.println("animateCustomPanel(): "+String.valueOf(ex)); + } catch (IllegalArgumentException ex) { + System.out.println("animateCustomPanel(): "+String.valueOf(ex)); + } catch (InvocationTargetException ex) { + System.out.println("animateCustomPanel(): "+String.valueOf(ex)); + } catch (Exception ex){ + System.out.println("animateCustomPanel(): "+String.valueOf(ex)); + } + } + + + /** + * Starts animating the custom panel, if present, and only if the whole list of selected tests contains one only device name + * + * Note: the custom panel must have the public method "animate(String deviceName)" + */ + public void animateCustomPanel(){ + Component customPanel = getCustomPanel(); + //if no custom panel: nothing to do + if(customPanel==null) return; + //scan the table to see if only one device name is present + String sDeviceName = ""; + String sRowDeviceName = ""; + boolean bRowTestEnabled = false; + for (int row = 0; row < jTable1.getRowCount(); row++) { + sRowDeviceName = String.valueOf(jTable1.getValueAt(row, COL.DEVICENAME.ordinal())); + bRowTestEnabled = (boolean) jTable1.getValueAt(row, COL.CHECK.ordinal()); + if(bRowTestEnabled){ + if(sDeviceName == ""){ + sDeviceName = sRowDeviceName; + } else if(sDeviceName != sRowDeviceName){ + //there are at least two devices. Cannot animate the custom panel + return; + } + } + } + //if only one device name is present in the table, then animate the custom panel with the device + if(sDeviceName != ""){ + animateCustomPanel(sDeviceName); + } + } + /** * write info into a log file @@ -957,7 +1032,9 @@ public class TestingList extends Panel { jButtonX.setFont(new java.awt.Font("Tahoma", 0, 8)); // NOI18N jButtonX.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/x-darker-8px.png"))); // NOI18N jButtonX.setToolTipText("Close this custom panel"); - jButtonX.setPreferredSize(new java.awt.Dimension(10, 10)); + jButtonX.setMaximumSize(new java.awt.Dimension(12, 12)); + jButtonX.setMinimumSize(new java.awt.Dimension(12, 12)); + jButtonX.setPreferredSize(new java.awt.Dimension(12, 12)); jButtonX.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/x-darker-8px.png"))); // NOI18N jButtonX.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -968,7 +1045,7 @@ public class TestingList extends Panel { jLabelCustomPanelName.setMaximumSize(new java.awt.Dimension(1000, 20)); jLabelCustomPanelName.setMinimumSize(new java.awt.Dimension(100, 20)); - jLabelCustomPanelName.setPreferredSize(new java.awt.Dimension(200, 20)); + jLabelCustomPanelName.setPreferredSize(new java.awt.Dimension(100, 20)); jLabelCustomPanelName.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabelCustomPanelNameMouseClicked(evt); @@ -982,7 +1059,7 @@ public class TestingList extends Panel { jPanelCustomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCustomLayout.createSequentialGroup() .addGroup(jPanelCustomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanelCustomHeader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanelCustomHeader, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .addComponent(jPanelCustomFrame, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); @@ -995,6 +1072,8 @@ public class TestingList extends Panel { .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + jPanelCustom.setVisible(false); + add(jPanelCustom, java.awt.BorderLayout.SOUTH); }// //GEN-END:initComponents @@ -1553,70 +1632,6 @@ public class TestingList extends Panel { dlg.pack(); dlg.setVisible(true); } - - /** - * Starts animating the custom panel, if present - * - * Note: the custom panel must have the public method "animate(String deviceName)" - * - * @param deviceName name of the device. The panel should then append the epics PV to the device name for caget/caset - */ - public void animateCustomPanel(String deviceName) { - try { - Component customPanel = getCustomPanel(); - //if no custom panel: nothing to do - if(customPanel==null) return; - //call the method "animate" of the custom panel (this function must be there) - Class[] cArg = new Class[1]; - cArg[0] = String.class; - Method animate = customPanel.getClass().getMethod("animate", cArg); - animate.invoke(customPanel, deviceName); - } catch (NoSuchMethodException ex) { - System.out.println("animateCustomPanel(): "+String.valueOf(ex)); - } catch (SecurityException ex) { - System.out.println("animateCustomPanel(): "+String.valueOf(ex)); - } catch (IllegalAccessException ex) { - System.out.println("animateCustomPanel(): "+String.valueOf(ex)); - } catch (IllegalArgumentException ex) { - System.out.println("animateCustomPanel(): "+String.valueOf(ex)); - } catch (InvocationTargetException ex) { - System.out.println("animateCustomPanel(): "+String.valueOf(ex)); - } catch (Exception ex){ - System.out.println("animateCustomPanel(): "+String.valueOf(ex)); - } - } - - - /** - * Starts animating the custom panel, if present, and only if the whole list of selected tests contains one only device name - * - * Note: the custom panel must have the public method "animate(String deviceName)" - */ - public void animateCustomPanel(){ - Component customPanel = getCustomPanel(); - //if no custom panel: nothing to do - if(customPanel==null) return; - //scan the table to see if only one device name is present - String sDeviceName = ""; - String sRowDeviceName = ""; - boolean bRowTestEnabled = false; - for (int row = 0; row < jTable1.getRowCount(); row++) { - sRowDeviceName = String.valueOf(jTable1.getValueAt(row, COL.DEVICENAME.ordinal())); - bRowTestEnabled = (boolean) jTable1.getValueAt(row, COL.CHECK.ordinal()); - if(bRowTestEnabled){ - if(sDeviceName == ""){ - sDeviceName = sRowDeviceName; - } else if(sDeviceName != sRowDeviceName){ - //there are at least two devices. Cannot animate the custom panel - return; - } - } - } - //if only one device name is present in the table, then animate the custom panel with the device - if(sDeviceName != ""){ - animateCustomPanel(sDeviceName); - } - } /** diff --git a/script/tests/tests.properties b/script/tests/tests.properties index 7895053..b28ca04 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,5 +1,5 @@ #TestingList for pshell: configuration properties -#Fri Oct 16 14:53:58 CEST 2015 +#Fri Oct 16 15:24:36 CEST 2015 customPanel=Kollimators showEnabledTestsOnly=true listFilter=CollimatorTests