diff --git a/plugins/TestingList.form b/plugins/TestingList.form index e413594..0dc3a81 100644 --- a/plugins/TestingList.form +++ b/plugins/TestingList.form @@ -471,13 +471,14 @@ - - - - - - - + + + + + + + + @@ -486,11 +487,7 @@ - - - - - + diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 7c4c1b7..df5c99f 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; import java.nio.file.Path; import java.nio.file.Paths; @@ -67,7 +68,7 @@ import static org.python.bouncycastle.util.Arrays.append; * @author boccioli_m */ public class TestingList extends Panel { - + Properties properties = new Properties(); Task task = new Task() { @Override protected Object execute() throws Exception { @@ -348,6 +349,7 @@ public class TestingList extends Panel { property = props.getProperty("showEnabledTestsOnly"); property = property.replace("\"",""); showEnabledTestsOnly("true".equals(property)); + properties = props; reader.close(); } catch (FileNotFoundException ex) { @@ -359,6 +361,32 @@ public class TestingList extends Panel { } } + + /** + * save general properties + */ + private void saveProperties(){ + File configFile = TESTS_PROPERTIES_DEFAULT_DIR.toFile(); + /* + try { + if (!configFile.isFile()) configFile.createNewFile(); + FileReader reader = new FileReader(configFile); + Properties props = properties; + + OutputStream out = new FileOutputStream( configFile ); + props.store(out, "TestingList for pshell: configuration properties"); + + out.close(); + } catch (FileNotFoundException ex) { + // file does not exist + System.out.println(ex.toString()); + } catch (IOException ex) { + // I/O error + System.out.println(ex.toString()); + } + */ + } + /** * close the custom panel if present @@ -367,6 +395,9 @@ public class TestingList extends Panel { jPanelCustomFrame.removeAll(); jPanelCustom.setVisible(false); repaint(); + //store custom panel in the properties + //properties.setProperty("customPanel", ""); + saveProperties(); } @@ -416,9 +447,11 @@ public class TestingList extends Panel { * */ private void loadCustomPanel(String sPanelClassName){ - if (sPanelClassName == null || sPanelClassName == "") return; + closeCustomPanel(); + 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[]{""}); @@ -426,6 +459,9 @@ public class TestingList extends Panel { this.jLabelCustomPanelName.setText(sPanelClassName); repaint(); revalidate(); + //store custom panel in the properties + //properties.setProperty("customPanel", sPanelClassName); + saveProperties(); jPanelCustom.setVisible(true); } catch (ClassNotFoundException ex) { Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); @@ -1218,11 +1254,16 @@ public class TestingList extends Panel { * @param show if false, show all tests. If true, show only selected tests. */ public void showEnabledTestsOnly(boolean show) { + String filter; if (show) { - filterTests("true"); + filter ="true"; } else { - filterTests(""); + filter =""; } + filterTests(filter); + //store filter in the properties + //properties.setProperty("showEnabledTestsOnly", filter); + saveProperties(); //if only enabled tests are visible, disable the move buttons this.jButtonMoveUp.setEnabled(!show); this.jButtonMoveDown.setEnabled(!show); @@ -2332,6 +2373,9 @@ public class TestingList extends Panel { } in.close(); loadTests(); + //store current file in the properties + //properties.setProperty("listFilter", file.toString()); + saveProperties(); } catch (Exception ex) { ex.printStackTrace(); SwingUtils.showMessage(this, "loadListFilter()", ex.toString()); diff --git a/script/tests/tests.properties b/script/tests/tests.properties index a526237..3a3eea4 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,3 +1,4 @@ -customPanel = Kollimators -listFilter = CollimatorTests -showEnabledTestsOnly = true \ No newline at end of file +#TestingList for pshell: configuration properties +#Thu Oct 15 10:53:38 CEST 2015 +customPanel= +showEnabledTestsOnly=