JAL-1551 a bit of javadoc for Jalview.testoutput methods
[jalview.git] / src / jalview / bin / Jalview.java
index 159cf75..b560c5f 100755 (executable)
@@ -396,7 +396,7 @@ public class Jalview
 
     // get bootstrap properties (mainly for the logger level)
     Properties bootstrapProperties = Cache
-            .bootstrapProperties(bootstrapArgs.get(Arg.PROPS));
+            .bootstrapProperties(bootstrapArgs.getValue(Arg.PROPS));
 
     // report Jalview version
     Cache.loadBuildProperties(
@@ -451,11 +451,14 @@ public class Jalview
                 .getDefault("DEFAULT_CLOSE_EXTERNAL_VIEWERS", false)
                 || Cache.getDefault("ALWAYS_CLOSE_EXTERNAL_VIEWERS", false);
         StructureViewerBase.setQuitClose(closeExternal);
-        for (JInternalFrame frame : Desktop.desktop.getAllFrames())
+        if (desktop != null)
         {
-          if (frame instanceof StructureViewerBase)
+          for (JInternalFrame frame : Desktop.desktop.getAllFrames())
           {
-            ((StructureViewerBase) frame).closeViewer(closeExternal);
+            if (frame instanceof StructureViewerBase)
+            {
+              ((StructureViewerBase) frame).closeViewer(closeExternal);
+            }
           }
         }
 
@@ -479,7 +482,7 @@ public class Jalview
     });
 
     String usrPropsFile = bootstrapArgs.contains(Arg.PROPS)
-            ? bootstrapArgs.get(Arg.PROPS)
+            ? bootstrapArgs.getValue(Arg.PROPS)
             : aparser.getValue("props");
     // if usrPropsFile == null, loadProperties will use the Channel
     // preferences.file
@@ -533,7 +536,7 @@ public class Jalview
       }
 
       // new CLI
-      headlessArg = isHeadless(bootstrapArgs);
+      headlessArg = bootstrapArgs.isHeadless();
       if (headlessArg)
       {
         System.setProperty("java.awt.headless", "true");
@@ -550,7 +553,7 @@ public class Jalview
       // allow https handshakes to download intermediate certs if necessary
       System.setProperty("com.sun.security.enableAIAcaIssuers", "true");
 
-      String jabawsUrl = bootstrapArgs.get(Arg.JABAWS);
+      String jabawsUrl = bootstrapArgs.getValue(Arg.JABAWS);
       if (jabawsUrl == null)
         jabawsUrl = aparser.getValue("jabaws");
       if (jabawsUrl != null)
@@ -642,7 +645,7 @@ public class Jalview
 
     if (!(headless || headlessArg))
     {
-      Desktop.nosplash = "false".equals(bootstrapArgs.get(Arg.SPLASH))
+      Desktop.nosplash = "false".equals(bootstrapArgs.getValue(Arg.SPLASH))
               || aparser.contains("nosplash")
               || Cache.getDefault("SPLASH", "true").equals("false");
       desktop = new Desktop();
@@ -771,8 +774,8 @@ public class Jalview
 
         if ((!aparser.contains("nonews")
                 && Cache.getProperty("NONEWS") == null
-                && !"false".equals(bootstrapArgs.get(Arg.NEWS)))
-                || "true".equals(bootstrapArgs.get(Arg.NEWS)))
+                && !"false".equals(bootstrapArgs.getValue(Arg.NEWS)))
+                || "true".equals(bootstrapArgs.getValue(Arg.NEWS)))
         {
           desktop.checkForNews();
         }
@@ -1777,8 +1780,14 @@ public class Jalview
     }
   }
 
-  /*
-   * testoutput for string values
+  /******************************
+   * 
+   * TEST OUTPUT METHODS
+   * 
+   ******************************/
+  /**
+   * method for reporting string values parsed/processed during tests
+   * 
    */
   protected static void testoutput(ArgParser ap, Arg a, String s1,
           String s2)
@@ -1802,6 +1811,10 @@ public class Jalview
     testoutput(true, a, s1, s2);
   }
 
+  /**
+   * method for reporting string values parsed/processed during tests
+   */
+
   protected static void testoutput(BootstrapArgs bsa, Arg a, String s1,
           String s2)
   {
@@ -1826,6 +1839,9 @@ public class Jalview
     testoutput(true, a, s1, s2);
   }
 
+  /**
+   * report value set for string values parsed/processed during tests
+   */
   private static void testoutput(boolean yes, Arg a, String s1, String s2)
   {
     if (yes && ((s1 == null && s2 == null)
@@ -1883,26 +1899,4 @@ public class Jalview
     System.out.println("[TESTOUTPUT] arg "
             + (yes ? a.argString() : a.negateArgString()) + " was set");
   }
-
-  private static boolean isHeadless(BootstrapArgs bootstrapArgs)
-  {
-    if (bootstrapArgs == null)
-    {
-      return false;
-    }
-    boolean isHeadless = false;
-    if (bootstrapArgs.contains(Arg.GUI))
-    {
-      isHeadless = !bootstrapArgs.getBoolean(Arg.GUI);
-    }
-    else if (bootstrapArgs.contains(Arg.HEADLESS))
-    {
-      isHeadless = bootstrapArgs.getBoolean(Arg.HEADLESS);
-    }
-    else if (bootstrapArgs.argsHaveOption(Opt.OUTPUTFILE))
-    {
-      isHeadless = true;
-    }
-    return isHeadless;
-  }
 }