new: added properties file tat is read at init via loadProperties()
file is tests.properties todo: save properties
This commit is contained in:
@@ -48,6 +48,8 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItemNewDeviceActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator6">
|
||||
</MenuItem>
|
||||
<Menu class="javax.swing.JMenu" name="jMenuLoadCustomPanel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Load Custom Panel"/>
|
||||
@@ -183,7 +185,7 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,100,0,0,1,-60"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
@@ -467,18 +469,29 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanelCustomFrame" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="382" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanelCustomFrame" pref="440" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabelCustomPanelName" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jButtonX" min="-2" pref="18" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jButtonX" pref="17" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jButtonX" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="jLabelCustomPanelName" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="jPanelCustomFrame" min="-2" pref="80" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="253" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -507,6 +520,8 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonXActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabelCustomPanelName">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
||||
@@ -299,32 +299,32 @@ public class TestingList extends Panel {
|
||||
*/
|
||||
private void initialise(){
|
||||
initComponents();
|
||||
closeCustomPanel();
|
||||
initLogger();
|
||||
loadProperties();
|
||||
buildTable();
|
||||
closeCustomPanel();
|
||||
|
||||
try {
|
||||
loadTests();
|
||||
//if not administrator, then show only enabled tests
|
||||
boolean bShow = Controller.getInstance().getLevel()==AccessLevel.administrator;
|
||||
showSelectedTestsOnly(bShow);
|
||||
jCheckBoxMenuShowSelectedTests1.setState(bShow);
|
||||
//showEnabledTestsOnly(bShow);
|
||||
jCheckBoxMenuShowSelectedTests1.setEnabled(bShow);
|
||||
if(bShow){
|
||||
//if tests are not shown, then show the load tests dialog
|
||||
loadListFilter();
|
||||
//loadListFilter();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
getLogger().severe(ex.getMessage());
|
||||
}
|
||||
}
|
||||
loadProperties();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* load general properties
|
||||
*/
|
||||
private void loadProperties(){
|
||||
System.out.print("Properties loading ");
|
||||
File configFile = TESTS_PROPERTIES_DEFAULT_DIR.toFile();
|
||||
System.out.print("Properties file: " + configFile.toString());
|
||||
if (!configFile.isFile()) return;
|
||||
|
||||
try {
|
||||
@@ -332,16 +332,30 @@ public class TestingList extends Panel {
|
||||
Properties props = new Properties();
|
||||
props.load(reader);
|
||||
|
||||
String customPanel = props.getProperty("customPanel");
|
||||
String property = null;
|
||||
|
||||
//list filter
|
||||
property = props.getProperty("listFilter");
|
||||
property = property.replace("\"","");
|
||||
loadListFilter(Paths.get(TESTS_CONFIG_DEFAULT_DIR.toString(), property).toFile());
|
||||
|
||||
//custom panel
|
||||
property = props.getProperty("customPanel");
|
||||
property = property.replace("\"","");
|
||||
loadCustomPanel(property);
|
||||
|
||||
//show Enabled Tests Only
|
||||
property = props.getProperty("showEnabledTestsOnly");
|
||||
property = property.replace("\"","");
|
||||
showEnabledTestsOnly("true".equals(property));
|
||||
|
||||
System.out.print("Custom Panel: " + customPanel);
|
||||
reader.close();
|
||||
} catch (FileNotFoundException ex) {
|
||||
// file does not exist
|
||||
System.out.print(ex.toString());
|
||||
System.out.println(ex.toString());
|
||||
} catch (IOException ex) {
|
||||
// I/O error
|
||||
System.out.print(ex.toString());
|
||||
System.out.println(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,12 +416,14 @@ public class TestingList extends Panel {
|
||||
*
|
||||
*/
|
||||
private void loadCustomPanel(String sPanelClassName){
|
||||
if (sPanelClassName == null || sPanelClassName == "") return;
|
||||
try {
|
||||
closeCustomPanel();
|
||||
//create a class to visualise the details panel
|
||||
Class panelClass = getController().getClassByName(sPanelClassName);
|
||||
JPanel detailsPanel = (JPanel) panelClass.getConstructor(new Class[]{String.class}).newInstance(new Object[]{""});
|
||||
this.jPanelCustomFrame.add(detailsPanel);
|
||||
this.jLabelCustomPanelName.setText(sPanelClassName);
|
||||
repaint();
|
||||
revalidate();
|
||||
jPanelCustom.setVisible(true);
|
||||
@@ -485,6 +501,7 @@ public class TestingList extends Panel {
|
||||
jMenuAdvanced = new javax.swing.JMenu();
|
||||
jMenuItemNewTest = new javax.swing.JMenuItem();
|
||||
jMenuItemNewDevice = new javax.swing.JMenuItem();
|
||||
jSeparator6 = new javax.swing.JPopupMenu.Separator();
|
||||
jMenuLoadCustomPanel = new javax.swing.JMenu();
|
||||
jSeparator2 = new javax.swing.JPopupMenu.Separator();
|
||||
jMenuItemEditScript = new javax.swing.JMenuItem();
|
||||
@@ -519,6 +536,7 @@ public class TestingList extends Panel {
|
||||
jPanelCustom = new javax.swing.JPanel();
|
||||
jPanelCustomFrame = new javax.swing.JPanel();
|
||||
jButtonX = new javax.swing.JButton();
|
||||
jLabelCustomPanelName = new javax.swing.JLabel();
|
||||
|
||||
jCheckBoxMenuShowSelectedTests.setSelected(true);
|
||||
jCheckBoxMenuShowSelectedTests.setText("Show enabled tests only");
|
||||
@@ -555,6 +573,7 @@ public class TestingList extends Panel {
|
||||
}
|
||||
});
|
||||
jMenuAdvanced.add(jMenuItemNewDevice);
|
||||
jMenuAdvanced.add(jSeparator6);
|
||||
|
||||
jMenuLoadCustomPanel.setText("Load Custom Panel");
|
||||
jMenuLoadCustomPanel.addMenuListener(new javax.swing.event.MenuListener() {
|
||||
@@ -821,16 +840,24 @@ public class TestingList extends Panel {
|
||||
jPanelCustom.setLayout(jPanelCustomLayout);
|
||||
jPanelCustomLayout.setHorizontalGroup(
|
||||
jPanelCustomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanelCustomFrame, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCustomLayout.createSequentialGroup()
|
||||
.addGap(0, 382, Short.MAX_VALUE)
|
||||
.addGroup(jPanelCustomLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanelCustomFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE))
|
||||
.addGroup(jPanelCustomLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabelCustomPanelName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jButtonX, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
jPanelCustomLayout.setVerticalGroup(
|
||||
jPanelCustomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanelCustomLayout.createSequentialGroup()
|
||||
.addComponent(jButtonX, javax.swing.GroupLayout.DEFAULT_SIZE, 17, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0)
|
||||
.addGroup(jPanelCustomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jButtonX, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCustomLayout.createSequentialGroup()
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(jLabelCustomPanelName)
|
||||
.addGap(0, 0, 0)))
|
||||
.addComponent(jPanelCustomFrame, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(253, 253, 253))
|
||||
);
|
||||
@@ -923,6 +950,8 @@ public class TestingList extends Panel {
|
||||
int rowAtPoint = jTable1.rowAtPoint(cursor);
|
||||
jTable1.setRowSelectionInterval(rowAtPoint, rowAtPoint);
|
||||
}
|
||||
//enable jMenuItemShowDetails depending on user privileges
|
||||
this.jMenuItemShowDetails.setEnabled(Controller.getInstance().getLevel()==AccessLevel.administrator);
|
||||
//enable action Show Test Details only if one row is selected
|
||||
this.jMenuItemShowDetails.setEnabled(jTable1.getSelectedRows().length == 1);
|
||||
this.jMenuItemRunSingleTest.setEnabled(jTable1.getSelectedRows().length == 1);
|
||||
@@ -993,7 +1022,7 @@ public class TestingList extends Panel {
|
||||
private void jCheckBoxMenuShowSelectedTestsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMenuShowSelectedTestsActionPerformed
|
||||
// TODO add your handling code here:
|
||||
boolean bShow = jCheckBoxMenuShowSelectedTests.getState();
|
||||
showSelectedTestsOnly(bShow);
|
||||
showEnabledTestsOnly(bShow);
|
||||
jCheckBoxMenuShowSelectedTests1.setState(bShow);
|
||||
}//GEN-LAST:event_jCheckBoxMenuShowSelectedTestsActionPerformed
|
||||
|
||||
@@ -1038,7 +1067,7 @@ public class TestingList extends Panel {
|
||||
private void jCheckBoxMenuShowSelectedTests1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMenuShowSelectedTests1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
boolean bShow = jCheckBoxMenuShowSelectedTests1.getState();
|
||||
showSelectedTestsOnly(bShow);
|
||||
showEnabledTestsOnly(bShow);
|
||||
jCheckBoxMenuShowSelectedTests.setState(bShow);
|
||||
}//GEN-LAST:event_jCheckBoxMenuShowSelectedTests1ActionPerformed
|
||||
|
||||
@@ -1136,6 +1165,7 @@ public class TestingList extends Panel {
|
||||
private javax.swing.JCheckBox jCheckBoxEnableDisable;
|
||||
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuShowSelectedTests;
|
||||
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuShowSelectedTests1;
|
||||
private javax.swing.JLabel jLabelCustomPanelName;
|
||||
private javax.swing.JMenu jMenuAdvanced;
|
||||
private javax.swing.JMenuItem jMenuItemDeselectSelection;
|
||||
private javax.swing.JMenuItem jMenuItemEditScript;
|
||||
@@ -1166,6 +1196,7 @@ public class TestingList extends Panel {
|
||||
private javax.swing.JPopupMenu.Separator jSeparator3;
|
||||
private javax.swing.JPopupMenu.Separator jSeparator4;
|
||||
private javax.swing.JPopupMenu.Separator jSeparator5;
|
||||
private javax.swing.JSeparator jSeparator6;
|
||||
private javax.swing.JTable jTable1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
//</editor-fold>
|
||||
@@ -1186,7 +1217,7 @@ public class TestingList extends Panel {
|
||||
*
|
||||
* @param show if false, show all tests. If true, show only selected tests.
|
||||
*/
|
||||
public void showSelectedTestsOnly(boolean show) {
|
||||
public void showEnabledTestsOnly(boolean show) {
|
||||
if (show) {
|
||||
filterTests("true");
|
||||
} else {
|
||||
@@ -2042,7 +2073,7 @@ public class TestingList extends Panel {
|
||||
}
|
||||
}
|
||||
}
|
||||
showSelectedTestsOnly(jCheckBoxMenuShowSelectedTests1.getState());
|
||||
showEnabledTestsOnly(jCheckBoxMenuShowSelectedTests1.getState());
|
||||
logger.log(Level.INFO, iCounter + " tests loaded.");
|
||||
}
|
||||
|
||||
@@ -2272,7 +2303,7 @@ public class TestingList extends Panel {
|
||||
File file = fc.getSelectedFile();
|
||||
loadListFilter(file);
|
||||
jCheckBoxMenuShowSelectedTests.setSelected(true);
|
||||
this.showSelectedTestsOnly(true);
|
||||
this.showEnabledTestsOnly(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2283,6 +2314,10 @@ public class TestingList extends Panel {
|
||||
* @param file file containing the settings
|
||||
*/
|
||||
private void loadListFilter(File file) {
|
||||
if (file == null || !file.isFile()){
|
||||
loadListFilter();
|
||||
return;
|
||||
}
|
||||
DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel();
|
||||
try {
|
||||
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
|
||||
|
||||
3
script/tests/tests.properties
Normal file
3
script/tests/tests.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
customPanel = Kollimators
|
||||
listFilter = CollimatorTests
|
||||
showEnabledTestsOnly = true
|
||||
Reference in New Issue
Block a user