X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalviewLite.java;h=b73fffc5abeafae97ef7cfa54e3fbcd4646ea441;hb=eb3e681d6e82ccdd5d312d1981dfb306e7f479f0;hp=e7f2a5346449cfba358ba5cc9afdafc73cf0492c;hpb=17e4ea278bc9a5fb280db1252ce78b7a295215f5;p=jalview.git diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index e7f2a53..b73fffc 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -20,6 +20,8 @@ */ package jalview.bin; +import java.util.Locale; + import jalview.analysis.AlignmentUtils; import jalview.api.StructureSelectionManagerProvider; import jalview.appletgui.AlignFrame; @@ -207,8 +209,9 @@ public class JalviewLite extends Applet final StructureSelectionManagerProvider me = this; final int pos = apos; // use vamsas listener to broadcast to all listeners in scope - if (alignedPosition != null && (alignedPosition.trim().length() == 0 - || alignedPosition.toLowerCase().indexOf("false") > -1)) + if (alignedPosition != null + && (alignedPosition.trim().length() == 0 || alignedPosition + .toLowerCase(Locale.ROOT).indexOf("false") > -1)) { java.awt.EventQueue.invokeLater(new Runnable() { @@ -289,8 +292,9 @@ public class JalviewLite extends Applet { if (debug) { - System.err.println("Selecting region using separator string '" - + separator + "'"); + jalview.bin.Console + .errPrintln("Selecting region using separator string '" + + separator + "'"); } } // deparse fields @@ -341,7 +345,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; @@ -352,7 +356,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; @@ -393,13 +397,13 @@ public class JalviewLite extends Applet } if (debug) { - System.err.println("Range '" + cl + "' deparsed as [" + from - + "," + to + "]"); + 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 + "]"); } } @@ -412,14 +416,14 @@ public class JalviewLite extends Applet r--; } catch (NumberFormatException ex) { - if (cl.toLowerCase().equals("sequence")) + if (cl.toLowerCase(Locale.ROOT).equals("sequence")) { // we are in the dataset sequence's coordinate frame. inseqpos = true; } else { - System.err.println( + jalview.bin.Console.errPrintln( "ERROR: Couldn't parse integer from point selection element of column selection string '" + cl + "'"); return; @@ -448,14 +452,15 @@ 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 - + "' deparsed as [" + r + "]"); + jalview.bin.Console + .errPrintln("ERROR: Invalid Point selection '" + cl + + "' deparsed as [" + r + "]"); } } } @@ -937,7 +942,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; } @@ -949,12 +954,12 @@ 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() - + " listeners in total."); + jalview.bin.Console.errPrintln("There are now " + + javascriptListeners.size() + " listeners in total."); } } @@ -984,7 +989,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; } @@ -996,12 +1001,12 @@ 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() - + " listeners in total."); + jalview.bin.Console.errPrintln("There are now " + + javascriptListeners.size() + " listeners in total."); } } @@ -1024,7 +1029,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; } @@ -1036,10 +1041,11 @@ public class JalviewLite extends Applet .addStructureViewerListener(mol); if (debug) { - System.err.println("Added a javascript structure viewer listener '" - + listener + "'"); - System.err.println("There are now " + javascriptListeners.size() - + " listeners in total."); + jalview.bin.Console + .errPrintln("Added a javascript structure viewer listener '" + + listener + "'"); + jalview.bin.Console.errPrintln("There are now " + + javascriptListeners.size() + " listeners in total."); } } @@ -1084,7 +1090,8 @@ public class JalviewLite extends Applet rprt = debug; if (debug) { - System.err.println("Removed listener '" + listener + "'"); + jalview.bin.Console + .errPrintln("Removed listener '" + listener + "'"); } } else @@ -1094,22 +1101,22 @@ public class JalviewLite extends Applet } if (rprt) { - System.err.println("There are now " + javascriptListeners.size() - + " listeners in total."); + jalview.bin.Console.errPrintln("There are now " + + javascriptListeners.size() + " listeners in total."); } } @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(); } @@ -1186,8 +1193,9 @@ public class JalviewLite extends Applet } } catch (NumberFormatException e) { - System.err.println("Ignoring invalid residue number string '" - + pdbResNum + "'"); + jalview.bin.Console + .errPrintln("Ignoring invalid residue number string '" + + pdbResNum + "'"); } } @@ -1217,9 +1225,10 @@ public class JalviewLite extends Applet } catch (Exception ex) { - System.err.println("Couldn't parse integer arguments (topRow='" - + topRow + "' and leftHandColumn='" + leftHandColumn - + "')"); + jalview.bin.Console + .errPrintln("Couldn't parse integer arguments (topRow='" + + topRow + "' and leftHandColumn='" + + leftHandColumn + "')"); ex.printStackTrace(); } } @@ -1248,8 +1257,9 @@ public class JalviewLite extends Applet } catch (Exception ex) { - System.err.println("Couldn't parse integer arguments (topRow='" - + topRow + "')"); + jalview.bin.Console + .errPrintln("Couldn't parse integer arguments (topRow='" + + topRow + "')"); ex.printStackTrace(); } @@ -1280,7 +1290,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(); @@ -1412,18 +1422,19 @@ 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) { @@ -1433,14 +1444,15 @@ 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) { - useXtrnalSviewer = externalsviewer.trim().toLowerCase().equals(TRUE); + useXtrnalSviewer = externalsviewer.trim().toLowerCase(Locale.ROOT) + .equals(TRUE); } /** * if true disable the check for jmol @@ -1461,7 +1473,8 @@ 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 @@ -1569,7 +1582,8 @@ 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 { @@ -1580,7 +1594,8 @@ 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 { @@ -1591,7 +1606,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."); } } @@ -1628,14 +1643,15 @@ public class JalviewLite extends Applet "Calling oninit callback '" + initjscallback + "'."); } catch (Exception e) { - System.err.println("Exception when executing _oninit callback '" - + initjscallback + "'."); + 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."); } } @@ -1696,7 +1712,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. @@ -1711,7 +1727,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); } */ }); @@ -1797,7 +1813,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) @@ -1809,7 +1825,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)"); } } @@ -1840,7 +1856,7 @@ public class JalviewLite extends Applet { if (JalviewLite.debug) { - System.err.println(msg); + jalview.bin.Console.errPrintln(msg); } } @@ -1880,8 +1896,8 @@ public class JalviewLite extends Applet { if (debug) { - System.err.println("Prepended document base '" + documentBase - + "' to make: '" + withDocBase + "'"); + jalview.bin.Console.errPrintln("Prepended document base '" + + documentBase + "' to make: '" + withDocBase + "'"); } protocol = DataSourceType.URL; return withDocBase; @@ -1899,7 +1915,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; @@ -2006,7 +2022,7 @@ public class JalviewLite extends Applet + " as " + (al1.isNucleotide() ? "protein product" : "cDNA") + " for " + af.getTitle(); - System.err.println(msg); + jalview.bin.Console.errPrintln(msg); } } @@ -2080,7 +2096,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(); } @@ -2210,7 +2226,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 + ")"); } @@ -2316,7 +2332,7 @@ public class JalviewLite extends Applet } else { - System.err.println( + jalview.bin.Console.errPrintln( "Annotations were not added from annotation file '" + param + "'"); } @@ -2388,13 +2404,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 + "')"); } @@ -2465,13 +2481,14 @@ 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; } } @@ -2492,7 +2509,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; } @@ -2560,18 +2577,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; @@ -2616,13 +2633,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; @@ -2691,7 +2708,7 @@ public class JalviewLite extends Applet final String groups, boolean state) { final boolean st = state;// !(state==null || state.equals("") || - // state.toLowerCase().equals("false")); + // state.toLowerCase(Locale.ROOT).equals("false")); java.awt.EventQueue.invokeLater(new Runnable() { @Override @@ -2741,7 +2758,8 @@ 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 + "'"); } } @@ -2897,8 +2915,8 @@ public class JalviewLite extends Applet Color col = ColorUtils.parseColourString(colprop); if (col == null) { - System.err.println("Couldn't parse '" + colprop + "' as a colour for " - + colparam); + jalview.bin.Console.errPrintln("Couldn't parse '" + colprop + + "' as a colour for " + colparam); } return (col == null) ? defcolour : col; } @@ -2967,7 +2985,7 @@ public class JalviewLite extends Applet } if (debug) { - System.err.println( + jalview.bin.Console.errPrintln( "resolveUrlForLocalOrAbsolute returning " + resolvedPath); } return resolvedPath; @@ -2996,7 +3014,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); } @@ -3005,7 +3023,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)