X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalviewLite.java;h=e8be95fbf42f7a8c3ff2d59a77629d91f9d6d04f;hb=e75315ad5faf541f6943e9395c81a078369f2f63;hp=a60496c4191bc5fd13ac5a59ccfd299d39aea527;hpb=2a66892874abea357a5e5d9ef2f69919453c31d0;p=jalview.git diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index a60496c..e8be95f 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; @@ -198,7 +200,7 @@ public class JalviewLite extends Applet int apos = -1; try { - apos = new Integer(position).intValue(); + apos = Integer.valueOf(position).intValue(); apos--; } catch (NumberFormatException ex) { @@ -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,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 + "'"); } } @@ -337,22 +340,22 @@ public class JalviewLite extends Applet int from = -1, to = -1; try { - from = new Integer(cl.substring(0, p)).intValue(); + from = Integer.valueOf(cl.substring(0, p)).intValue(); 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; } try { - to = new Integer(cl.substring(p + 1)).intValue(); + to = Integer.valueOf(cl.substring(p + 1)).intValue(); 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 +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 + "]"); } } @@ -408,18 +411,18 @@ public class JalviewLite extends Applet int r = -1; try { - r = new Integer(cl).intValue(); + r = Integer.valueOf(cl).intValue(); 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,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 + "]"); } } @@ -937,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; } @@ -949,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."); } } @@ -984,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; } @@ -996,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."); } } @@ -1024,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; } @@ -1036,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."); } } @@ -1084,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 @@ -1094,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."); } } @@ -1102,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(); } @@ -1176,7 +1179,7 @@ public class JalviewLite extends Applet try { StructureSelectionManager.getStructureSelectionManager(me) - .mouseOverStructure(new Integer(pdbResNum).intValue(), + .mouseOverStructure(Integer.valueOf(pdbResNum).intValue(), chain, pdbfile); if (debug) { @@ -1186,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 + "'"); } @@ -1212,12 +1215,12 @@ public class JalviewLite extends Applet { try { - alf.scrollTo(new Integer(topRow).intValue(), - new Integer(leftHandColumn).intValue()); + alf.scrollTo(Integer.valueOf(topRow).intValue(), + Integer.valueOf(leftHandColumn).intValue()); } 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(); @@ -1244,11 +1247,11 @@ public class JalviewLite extends Applet { try { - alf.scrollToRow(new Integer(topRow).intValue()); + alf.scrollToRow(Integer.valueOf(topRow).intValue()); } 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(); } @@ -1276,11 +1279,11 @@ public class JalviewLite extends Applet { try { - alf.scrollToColumn(new Integer(leftHandColumn).intValue()); + alf.scrollToColumn(Integer.valueOf(leftHandColumn).intValue()); } catch (Exception ex) { - System.err.println( + jalview.bin.Console.errPrintln( "Couldn't parse integer arguments (leftHandColumn='" + leftHandColumn + "')"); ex.printStackTrace(); @@ -1333,7 +1336,7 @@ public class JalviewLite extends Applet private boolean alignPdbStructures = false; /** - * use an external structure viewer exclusively (no jmols or MCViews will be + * use an external structure viewer exclusively (no jmols or mc_views will be * opened by JalviewLite itself) */ public boolean useXtrnalSviewer = false; @@ -1412,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) { @@ -1433,14 +1436,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 +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 @@ -1569,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 { @@ -1580,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 { @@ -1591,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."); } } @@ -1628,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."); } } @@ -1696,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. @@ -1711,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); } */ }); @@ -1797,8 +1801,8 @@ public class JalviewLite extends Applet } if (!jmolAvailable) { - System.out.println( - "Jmol not available - Using MCview for structures"); + jalview.bin.Console.outPrintln( + "Jmol not available - Using mc_view for structures"); } } catch (java.lang.ClassNotFoundException ex) { @@ -1809,8 +1813,8 @@ public class JalviewLite extends Applet jmolAvailable = false; if (debug) { - System.err.println( - "Skipping Jmol check. Will use MCView (probably)"); + jalview.bin.Console.errPrintln( + "Skipping Jmol check. Will use mc_view (probably)"); } } checkedForJmol = true; @@ -1840,7 +1844,7 @@ public class JalviewLite extends Applet { if (JalviewLite.debug) { - System.err.println(msg); + jalview.bin.Console.errPrintln(msg); } } @@ -1880,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; @@ -1899,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; @@ -2006,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); } } @@ -2080,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(); } @@ -2210,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 + ")"); } @@ -2316,7 +2320,7 @@ public class JalviewLite extends Applet } else { - System.err.println( + jalview.bin.Console.errPrintln( "Annotations were not added from annotation file '" + param + "'"); } @@ -2388,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 + "')"); } @@ -2465,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; } } @@ -2492,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; } @@ -2560,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; @@ -2616,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; @@ -2691,7 +2695,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 +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 + "'"); } } @@ -2897,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; @@ -2967,7 +2971,7 @@ public class JalviewLite extends Applet } if (debug) { - System.err.println( + jalview.bin.Console.errPrintln( "resolveUrlForLocalOrAbsolute returning " + resolvedPath); } return resolvedPath; @@ -2996,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); } @@ -3005,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)