From 6e57b79633068d8c083487ee3aebaecff4867833 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Fri, 28 Aug 2015 17:55:16 +0200 Subject: [PATCH] improvements --- plugins/NewTest.java | 12 +++++++----- plugins/TestingList.java | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/NewTest.java b/plugins/NewTest.java index e2f230d..f6143b9 100644 --- a/plugins/NewTest.java +++ b/plugins/NewTest.java @@ -272,10 +272,12 @@ public class NewTest extends javax.swing.JPanel { public static Path TEMPLATES_TESTCONFIG_FILEPATH = Paths.get(".", "home", "script", "tests","templates","testTemplate.config"); public static Path TEMPLATES_DEVICECONFIG_FILEPATH = Paths.get(".", "home", "script", "tests","templates","deviceTemplate.config"); public static String ALLOWED_CHARS = "[a-zA-Z0-9._\\-\\]\\[(){} ]*"; + public static String NEW_TYPE_DEVICE = "Device"; + public static String NEW_TYPE_TEST = "Test"; /** * fill table with example parameters - * @param newType the new can be Device or Test. + * @param newType the new can be NEW_TYPE_DEVICE or NEW_TYPE_TEST. */ private void fillComponents(String newType) { @@ -288,8 +290,8 @@ public class NewTest extends javax.swing.JPanel { } }); - //adapt labels according to type (Device or Test) - if(newType == "Device"){ + //adapt labels according to type (NEW_TYPE_DEVICE or NEW_TYPE_TEST) + if(newType == NEW_TYPE_DEVICE){ this.lblDescr.setText(newType + " "+ this.lblDescr.getText()); this.lblName.setText( newType + " "+ this.lblName.getText()); lblParams.setVisible(false); @@ -452,7 +454,7 @@ public class NewTest extends javax.swing.JPanel { */ public void generateTestFiles(){ HashMap hmTestParams = (HashMap) getParametersFromTable(); - if(sType.equals("Device")){ + if(sType.equals(NEW_TYPE_DEVICE)){ generateDeviceFiles(this.txtTestName.getText(), this.txtTestDescription.getText(), this.jComboBoxTestSuites.getSelectedItem().toString(), @@ -668,7 +670,7 @@ public class NewTest extends javax.swing.JPanel { props.load(in); in.close(); FileOutputStream out = new FileOutputStream(configFile); - if(sType.equals("Devices")){ + if(sType.equals(NEW_TYPE_DEVICE)){ //creation of device config props.setProperty("name", sTestName); props.setProperty("description", sTestDescription); diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 1c0ece5..41c5851 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -910,6 +910,11 @@ public class TestingList extends Panel { } } + /** + * open New Test/Device editor panel + * + * @param type can be "Device" or "Test". Either device or test will be created. + */ public void openNewTestEditor(String type){ try { JDialog dlg = new JDialog(getView(), "New Test", true);