X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Futil%2FPlatform.java;h=7998ec8cc9866268e089b8562e0ec94b149c02e2;hb=3fdc889794e3566af57628f0b6a308eb23886f96;hp=573e2d584db09e7deac6c36abee5ec239a3cf53f;hpb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 573e2d5..7998ec8 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -20,8 +20,6 @@ */ package jalview.util; -import jalview.javascript.json.JSON; - import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.io.BufferedReader; @@ -40,6 +38,8 @@ import javax.swing.SwingUtilities; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; +import jalview.javascript.json.JSON; + /** * System platform information used by Applet and Application * @@ -56,6 +56,27 @@ public class Platform private static Boolean isHeadless = null; + // If launched from CLI with launcher script then -DCOLUMNWIDTH is set + private static final int CONSOLEWIDTH; + + private static final String CONSOLEWIDTHPROPERTY = "CONSOLEWIDTH"; + + static + { + int cw = 80; + if (System.getProperty(CONSOLEWIDTHPROPERTY) != null + && System.getProperty(CONSOLEWIDTHPROPERTY).length() > 0) + { + try + { + cw = Integer.parseInt(System.getProperty(CONSOLEWIDTHPROPERTY)); + } catch (NumberFormatException e) + { + } + } + CONSOLEWIDTH = cw; + } + /** * added to group mouse events into Windows and nonWindows (mac, unix, linux) * @@ -288,7 +309,7 @@ public class Platform time = mark = t; if (msg != null) { - System.err.println("Platform: timer reset\t\t\t" + msg); + jalview.bin.Console.errPrintln("Platform: timer reset\t\t\t" + msg); } break; case TIME_MARK: @@ -304,8 +325,9 @@ public class Platform } if (msg != null) { - System.err.println("Platform: timer mark\t" + ((t - time) / 1000f) - + "\t" + ((t - mark) / 1000f) + "\t" + msg); + jalview.bin.Console.errPrintln( + "Platform: timer mark\t" + ((t - time) / 1000f) + "\t" + + ((t - mark) / 1000f) + "\t" + msg); } mark = t; } @@ -316,8 +338,9 @@ public class Platform case TIME_GET: if (msg != null) { - System.err.println("Platform: timer dur\t" + ((t - time) / 1000f) - + "\t" + ((duration) / 1000f) + "\t" + msg); + jalview.bin.Console + .errPrintln("Platform: timer dur\t" + ((t - time) / 1000f) + + "\t" + ((duration) / 1000f) + "\t" + msg); } set = 0; break; @@ -473,7 +496,7 @@ public class Platform * info[key]; */ - System.out.println( + jalview.bin.Console.outPrintln( "Platform id=" + id + " reading Info." + key + " = " + value); p.put(id + "_" + key, value); @@ -599,7 +622,7 @@ public class Platform if (isJS()) { - System.out.println( + jalview.bin.Console.outPrintln( "Platform adding known access-control-allow-origin * for domain " + domain); /** @@ -623,12 +646,13 @@ public class Platform * @j2sNative var a = * decodeURI((document.location.href.replace("&","?").split("?j2s")[0] * + "?").split("?")[1].split("#")[0]); a && - * (System.out.println("URL arguments detected were "+a)) && - * (J2S.thisApplet.__Info.urlargs = a.split(" ")); + * (jalview.bin.Console.outPrintln("URL arguments detected were + * "+a)) && (J2S.thisApplet.__Info.urlargs = a.split(" ")); * (!J2S.thisApplet.__Info.args || J2S.thisApplet.__Info.args * == "" || J2S.thisApplet.__Info.args == "??") && - * (J2S.thisApplet.__Info.args = a) && (System.out.println("URL - * arguments were passed to J2S main.")); + * (J2S.thisApplet.__Info.args = a) && + * (jalview.bin.Console.outPrintln("URL arguments were passed + * to J2S main.")); */ } catch (Throwable t) { @@ -657,4 +681,12 @@ public class Platform String p2 = path2.replace('\\', '/'); return p1.equals(p2); } + + /** + * If started on command line using launch script, return the console width + */ + public static int consoleWidth() + { + return CONSOLEWIDTH; + } }