Merge branch 'develop' into spike/JAL-4047/JAL-4048_columns_in_sequenceID
[jalview.git] / src / jalview / bin / JalviewLite.java
index 7d66f6d..e8be95f 100644 (file)
@@ -292,7 +292,7 @@ public class JalviewLite extends Applet
     {
       if (debug)
       {
-        System.err.println("Selecting region using separator string '"
+        jalview.bin.Console.errPrintln("Selecting region using separator string '"
                 + separator + "'");
       }
     }
@@ -344,7 +344,7 @@ public class JalviewLite extends Applet
             from--;
           } catch (NumberFormatException ex)
           {
-            System.err.println(
+            jalview.bin.Console.errPrintln(
                     "ERROR: Couldn't parse first integer in range element column selection string '"
                             + cl + "' - format is 'from-to'");
             return;
@@ -355,7 +355,7 @@ public class JalviewLite extends Applet
             to--;
           } catch (NumberFormatException ex)
           {
-            System.err.println(
+            jalview.bin.Console.errPrintln(
                     "ERROR: Couldn't parse second integer in range element column selection string '"
                             + cl + "' - format is 'from-to'");
             return;
@@ -396,13 +396,13 @@ public class JalviewLite extends Applet
             }
             if (debug)
             {
-              System.err.println("Range '" + cl + "' deparsed as [" + from
+              jalview.bin.Console.errPrintln("Range '" + cl + "' deparsed as [" + from
                       + "," + to + "]");
             }
           }
           else
           {
-            System.err.println("ERROR: Invalid Range '" + cl
+            jalview.bin.Console.errPrintln("ERROR: Invalid Range '" + cl
                     + "' deparsed as [" + from + "," + to + "]");
           }
         }
@@ -422,7 +422,7 @@ public class JalviewLite extends Applet
             }
             else
             {
-              System.err.println(
+              jalview.bin.Console.errPrintln(
                       "ERROR: Couldn't parse integer from point selection element of column selection string '"
                               + cl + "'");
               return;
@@ -451,13 +451,13 @@ public class JalviewLite extends Applet
             csel.addElement(r);
             if (debug)
             {
-              System.err.println("Point selection '" + cl
+              jalview.bin.Console.errPrintln("Point selection '" + cl
                       + "' deparsed as [" + r + "]");
             }
           }
           else
           {
-            System.err.println("ERROR: Invalid Point selection '" + cl
+            jalview.bin.Console.errPrintln("ERROR: Invalid Point selection '" + cl
                     + "' deparsed as [" + r + "]");
           }
         }
@@ -940,7 +940,7 @@ public class JalviewLite extends Applet
       listener = listener.trim();
       if (listener.length() == 0)
       {
-        System.err.println(
+        jalview.bin.Console.errPrintln(
                 "jalview Javascript error: Ignoring empty function for mouseover listener.");
         return;
       }
@@ -952,11 +952,11 @@ public class JalviewLite extends Applet
             .addStructureViewerListener(mol);
     if (debug)
     {
-      System.err.println("Added a mouseover listener for "
+      jalview.bin.Console.errPrintln("Added a mouseover listener for "
               + ((af == null) ? "All frames"
                       : "Just views for "
                               + af.getAlignViewport().getSequenceSetId()));
-      System.err.println("There are now " + javascriptListeners.size()
+      jalview.bin.Console.errPrintln("There are now " + javascriptListeners.size()
               + " listeners in total.");
     }
   }
@@ -987,7 +987,7 @@ public class JalviewLite extends Applet
       listener = listener.trim();
       if (listener.length() == 0)
       {
-        System.err.println(
+        jalview.bin.Console.errPrintln(
                 "jalview Javascript error: Ignoring empty function for selection listener.");
         return;
       }
@@ -999,11 +999,11 @@ public class JalviewLite extends Applet
             .addSelectionListener(mol);
     if (debug)
     {
-      System.err.println("Added a selection listener for "
+      jalview.bin.Console.errPrintln("Added a selection listener for "
               + ((af == null) ? "All frames"
                       : "Just views for "
                               + af.getAlignViewport().getSequenceSetId()));
-      System.err.println("There are now " + javascriptListeners.size()
+      jalview.bin.Console.errPrintln("There are now " + javascriptListeners.size()
               + " listeners in total.");
     }
   }
@@ -1027,7 +1027,7 @@ public class JalviewLite extends Applet
       listener = listener.trim();
       if (listener.length() == 0)
       {
-        System.err.println(
+        jalview.bin.Console.errPrintln(
                 "jalview Javascript error: Ignoring empty function for selection listener.");
         return;
       }
@@ -1039,9 +1039,9 @@ public class JalviewLite extends Applet
             .addStructureViewerListener(mol);
     if (debug)
     {
-      System.err.println("Added a javascript structure viewer listener '"
+      jalview.bin.Console.errPrintln("Added a javascript structure viewer listener '"
               + listener + "'");
-      System.err.println("There are now " + javascriptListeners.size()
+      jalview.bin.Console.errPrintln("There are now " + javascriptListeners.size()
               + " listeners in total.");
     }
   }
@@ -1087,7 +1087,7 @@ public class JalviewLite extends Applet
         rprt = debug;
         if (debug)
         {
-          System.err.println("Removed listener '" + listener + "'");
+          jalview.bin.Console.errPrintln("Removed listener '" + listener + "'");
         }
       }
       else
@@ -1097,7 +1097,7 @@ public class JalviewLite extends Applet
     }
     if (rprt)
     {
-      System.err.println("There are now " + javascriptListeners.size()
+      jalview.bin.Console.errPrintln("There are now " + javascriptListeners.size()
               + " listeners in total.");
     }
   }
@@ -1105,14 +1105,14 @@ public class JalviewLite extends Applet
   @Override
   public void stop()
   {
-    System.err.println("Applet " + getName() + " stop().");
+    jalview.bin.Console.errPrintln("Applet " + getName() + " stop().");
     tidyUp();
   }
 
   @Override
   public void destroy()
   {
-    System.err.println("Applet " + getName() + " destroy().");
+    jalview.bin.Console.errPrintln("Applet " + getName() + " destroy().");
     tidyUp();
   }
 
@@ -1189,7 +1189,7 @@ public class JalviewLite extends Applet
           }
         } catch (NumberFormatException e)
         {
-          System.err.println("Ignoring invalid residue number string '"
+          jalview.bin.Console.errPrintln("Ignoring invalid residue number string '"
                   + pdbResNum + "'");
         }
 
@@ -1220,7 +1220,7 @@ public class JalviewLite extends Applet
 
         } catch (Exception ex)
         {
-          System.err.println("Couldn't parse integer arguments (topRow='"
+          jalview.bin.Console.errPrintln("Couldn't parse integer arguments (topRow='"
                   + topRow + "' and leftHandColumn='" + leftHandColumn
                   + "')");
           ex.printStackTrace();
@@ -1251,7 +1251,7 @@ public class JalviewLite extends Applet
 
         } catch (Exception ex)
         {
-          System.err.println("Couldn't parse integer arguments (topRow='"
+          jalview.bin.Console.errPrintln("Couldn't parse integer arguments (topRow='"
                   + topRow + "')");
           ex.printStackTrace();
         }
@@ -1283,7 +1283,7 @@ public class JalviewLite extends Applet
 
         } catch (Exception ex)
         {
-          System.err.println(
+          jalview.bin.Console.errPrintln(
                   "Couldn't parse integer arguments (leftHandColumn='"
                           + leftHandColumn + "')");
           ex.printStackTrace();
@@ -1415,18 +1415,18 @@ public class JalviewLite extends Applet
     {
       if (debug)
       {
-        System.err.println("Applet context is '"
+        jalview.bin.Console.errPrintln("Applet context is '"
                 + getAppletContext().getClass().toString() + "'");
       }
       JSObject scriptObject = JSObject.getWindow(this);
       if (debug && scriptObject != null)
       {
-        System.err.println("Applet has Javascript callback support.");
+        jalview.bin.Console.errPrintln("Applet has Javascript callback support.");
       }
 
     } catch (Exception ex)
     {
-      System.err.println(
+      jalview.bin.Console.errPrintln(
               "Warning: No JalviewLite javascript callbacks available.");
       if (debug)
       {
@@ -1436,9 +1436,9 @@ public class JalviewLite extends Applet
 
     if (debug)
     {
-      System.err.println("JalviewLite Version " + getVersion());
-      System.err.println("Build Date : " + getBuildDate());
-      System.err.println("Installation : " + getInstallation());
+      jalview.bin.Console.errPrintln("JalviewLite Version " + getVersion());
+      jalview.bin.Console.errPrintln("Build Date : " + getBuildDate());
+      jalview.bin.Console.errPrintln("Installation : " + getInstallation());
     }
     String externalsviewer = getParameter("externalstructureviewer");
     if (externalsviewer != null)
@@ -1465,7 +1465,7 @@ public class JalviewLite extends Applet
         separator = sep;
         if (debug)
         {
-          System.err.println("Separator set to '" + separator + "'");
+          jalview.bin.Console.errPrintln("Separator set to '" + separator + "'");
         }
       }
       else
@@ -1573,7 +1573,7 @@ public class JalviewLite extends Applet
     {
       if (tries > 0)
       {
-        System.err.println("LiveConnect request thread going to sleep.");
+        jalview.bin.Console.errPrintln("LiveConnect request thread going to sleep.");
       }
       try
       {
@@ -1584,7 +1584,7 @@ public class JalviewLite extends Applet
       ;
       if (tries++ > 0)
       {
-        System.err.println("LiveConnect request thread woken up.");
+        jalview.bin.Console.errPrintln("LiveConnect request thread woken up.");
       }
       try
       {
@@ -1595,7 +1595,7 @@ public class JalviewLite extends Applet
         }
       } catch (Exception jsex)
       {
-        System.err.println("Attempt " + tries
+        jalview.bin.Console.errPrintln("Attempt " + tries
                 + " to access LiveConnect javascript failed.");
       }
     }
@@ -1632,14 +1632,14 @@ public class JalviewLite extends Applet
                   "Calling oninit callback '" + initjscallback + "'.");
         } catch (Exception e)
         {
-          System.err.println("Exception when executing _oninit callback '"
+          jalview.bin.Console.errPrintln("Exception when executing _oninit callback '"
                   + initjscallback + "'.");
           e.printStackTrace();
         }
       }
       else
       {
-        System.err.println("Not executing _oninit callback '"
+        jalview.bin.Console.errPrintln("Not executing _oninit callback '"
                 + initjscallback + "' - no scripting allowed.");
       }
     }
@@ -1700,7 +1700,7 @@ public class JalviewLite extends Applet
           ((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame;
           if (debug)
           {
-            System.err.println("Activated window " + frame);
+            jalview.bin.Console.errPrintln("Activated window " + frame);
           }
         }
         // be good.
@@ -1715,7 +1715,7 @@ public class JalviewLite extends Applet
        * 
        * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame ==
        * frame) { currentAlignFrame = null; if (debug) {
-       * System.err.println("Deactivated window "+frame); } }
+       * jalview.bin.Console.errPrintln("Deactivated window "+frame); } }
        * super.windowDeactivated(e); }
        */
     });
@@ -1801,7 +1801,7 @@ public class JalviewLite extends Applet
           }
           if (!jmolAvailable)
           {
-            System.out.println(
+            jalview.bin.Console.outPrintln(
                     "Jmol not available - Using mc_view for structures");
           }
         } catch (java.lang.ClassNotFoundException ex)
@@ -1813,7 +1813,7 @@ public class JalviewLite extends Applet
         jmolAvailable = false;
         if (debug)
         {
-          System.err.println(
+          jalview.bin.Console.errPrintln(
                   "Skipping Jmol check. Will use mc_view (probably)");
         }
       }
@@ -1844,7 +1844,7 @@ public class JalviewLite extends Applet
     {
       if (JalviewLite.debug)
       {
-        System.err.println(msg);
+        jalview.bin.Console.errPrintln(msg);
       }
     }
 
@@ -1884,7 +1884,7 @@ public class JalviewLite extends Applet
       {
         if (debug)
         {
-          System.err.println("Prepended document base '" + documentBase
+          jalview.bin.Console.errPrintln("Prepended document base '" + documentBase
                   + "' to make: '" + withDocBase + "'");
         }
         protocol = DataSourceType.URL;
@@ -1903,7 +1903,7 @@ public class JalviewLite extends Applet
         protocol = DataSourceType.URL;
         if (debug)
         {
-          System.err.println("Prepended codebase '" + codeBase
+          jalview.bin.Console.errPrintln("Prepended codebase '" + codeBase
                   + "' to make: '" + withCodeBase + "'");
         }
         return withCodeBase;
@@ -2010,7 +2010,7 @@ public class JalviewLite extends Applet
                   + " as "
                   + (al1.isNucleotide() ? "protein product" : "cDNA")
                   + " for " + af.getTitle();
-          System.err.println(msg);
+          jalview.bin.Console.errPrintln(msg);
         }
       }
 
@@ -2084,7 +2084,7 @@ public class JalviewLite extends Applet
             dbgMsg(">>>Dump finished.");
           } catch (Exception e)
           {
-            System.err.println(
+            jalview.bin.Console.errPrintln(
                     "Exception when trying to dump the content of the file parameter.");
             e.printStackTrace();
           }
@@ -2214,7 +2214,7 @@ public class JalviewLite extends Applet
                 {
                   // this may not really be a problem but we give a warning
                   // anyway
-                  System.err.println(
+                  jalview.bin.Console.errPrintln(
                           "Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "
                                   + i + ")");
                 }
@@ -2320,7 +2320,7 @@ public class JalviewLite extends Applet
         }
         else
         {
-          System.err.println(
+          jalview.bin.Console.errPrintln(
                   "Annotations were not added from annotation file '"
                           + param + "'");
         }
@@ -2392,13 +2392,13 @@ public class JalviewLite extends Applet
         {
           if (debug)
           {
-            System.err.println(
+            jalview.bin.Console.errPrintln(
                     "Attempting to load T-COFFEE score file from the scoreFile parameter");
           }
           result = alignFrame.loadScoreFile(sScoreFile);
           if (!result)
           {
-            System.err.println(
+            jalview.bin.Console.errPrintln(
                     "Failed to parse T-COFFEE parameter as a valid score file ('"
                             + sScoreFile + "')");
           }
@@ -2469,13 +2469,13 @@ public class JalviewLite extends Applet
         boolean rtn = (getClass().getResourceAsStream("/" + f) != null);
         if (debug)
         {
-          System.err.println("Resource '" + f + "' was "
+          jalview.bin.Console.errPrintln("Resource '" + f + "' was "
                   + (rtn ? "" : "not ") + "located by classloader.");
         }
         return rtn;
       } catch (Exception ex)
       {
-        System.out.println("Exception checking resources: " + f + " " + ex);
+        jalview.bin.Console.outPrintln("Exception checking resources: " + f + " " + ex);
         return false;
       }
     }
@@ -2496,7 +2496,7 @@ public class JalviewLite extends Applet
     {
       return initialAlignFrame;
     }
-    System.err.println(
+    jalview.bin.Console.errPrintln(
             "Implementation error: Jalview Applet API cannot work out which AlignFrame to use.");
     return null;
   }
@@ -2564,18 +2564,18 @@ public class JalviewLite extends Applet
       jv.removeAllElements();
       if (debug)
       {
-        System.err.println("Array from '" + separator
+        jalview.bin.Console.errPrintln("Array from '" + separator
                 + "' separated List:\n" + v.length);
         for (int i = 0; i < v.length; i++)
         {
-          System.err.println("item " + i + " '" + v[i] + "'");
+          jalview.bin.Console.errPrintln("item " + i + " '" + v[i] + "'");
         }
       }
       return v;
     }
     if (debug)
     {
-      System.err.println(
+      jalview.bin.Console.errPrintln(
               "Empty Array from '" + separator + "' separated List");
     }
     return null;
@@ -2620,13 +2620,13 @@ public class JalviewLite extends Applet
       {
         System.err
                 .println("Returning '" + separator + "' separated List:\n");
-        System.err.println(v);
+        jalview.bin.Console.errPrintln(v);
       }
       return v.toString();
     }
     if (debug)
     {
-      System.err.println(
+      jalview.bin.Console.errPrintln(
               "Returning empty '" + separator + "' separated List\n");
     }
     return "" + separator;
@@ -2745,7 +2745,7 @@ public class JalviewLite extends Applet
     this.separator = separator;
     if (debug)
     {
-      System.err.println("Default Separator now: '" + separator + "'");
+      jalview.bin.Console.errPrintln("Default Separator now: '" + separator + "'");
     }
   }
 
@@ -2901,7 +2901,7 @@ public class JalviewLite extends Applet
     Color col = ColorUtils.parseColourString(colprop);
     if (col == null)
     {
-      System.err.println("Couldn't parse '" + colprop + "' as a colour for "
+      jalview.bin.Console.errPrintln("Couldn't parse '" + colprop + "' as a colour for "
               + colparam);
     }
     return (col == null) ? defcolour : col;
@@ -2971,7 +2971,7 @@ public class JalviewLite extends Applet
     }
     if (debug)
     {
-      System.err.println(
+      jalview.bin.Console.errPrintln(
               "resolveUrlForLocalOrAbsolute returning " + resolvedPath);
     }
     return resolvedPath;
@@ -3000,7 +3000,7 @@ public class JalviewLite extends Applet
                         : getDocumentBase());
         if (debug)
         {
-          System.err.println("Show url (prepended " + prepend
+          jalview.bin.Console.errPrintln("Show url (prepended " + prepend
                   + " - toggle resolvetocodebase if code/docbase resolution is wrong): "
                   + url);
         }
@@ -3009,7 +3009,7 @@ public class JalviewLite extends Applet
       {
         if (debug)
         {
-          System.err.println("Show url: " + url);
+          jalview.bin.Console.errPrintln("Show url: " + url);
         }
       }
       if (url.indexOf("javascript:") == 0)