X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FPlatform.java;h=7b93fe5fd4e9975adde7b9d650f47d70a3059962;hb=304e64fb34b32659be1bbfd39fb4e15b2f79586e;hp=daaab3a7a908d9cb361bdb4824677396b51dd375;hpb=cfb79b69d9fa44595560659bd95d1d1cd27677ad;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index daaab3a..7b93fe5 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -23,6 +23,7 @@ package jalview.util; import java.awt.Component; import java.awt.Dimension; import java.awt.GraphicsEnvironment; + import java.awt.Toolkit; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; @@ -61,7 +62,6 @@ import com.stevesoft.pat.Regex; import jalview.bin.Jalview; import jalview.javascript.json.JSON; import swingjs.api.JSUtilI; - /** * System platform information used by Applet and Application * @@ -74,7 +74,10 @@ public class Platform false; private static Boolean isNoJSMac = null, isNoJSWin = null, isMac = null, - isWin = null; + isWin = null, isLinux = null; + + + private static Boolean isHeadless = null; private static swingjs.api.JSUtilI jsutil; @@ -171,6 +174,18 @@ public class Platform } /** + * added to check LaF for Linux + * + * @return + */ + public static boolean isLinux() + { + return (isLinux == null + ? (isLinux = (System.getProperty("os.name").indexOf("Linux") >= 0)) + : isLinux); + } + + /** * * @return true if HTML5 JavaScript */ @@ -201,6 +216,18 @@ public class Platform return (isNoJSWin == null ? (isNoJSWin = !isJS && isWin()) : isNoJSWin); } + /** + * + * @return true if we are running in non-interactive no UI mode + */ + public static boolean isHeadless() + { + if (isHeadless == null) + { + isHeadless = "true".equals(System.getProperty("java.awt.headless")); + } + return isHeadless; + } /** * @@ -496,6 +523,7 @@ public class Platform public static String getUniqueAppletID() { return (isJS ? (String) jsutil.getAppletAttribute("_uniqueId") : null); + } /** @@ -595,6 +623,7 @@ public class Platform "StringJS does not support FileReader parsing for JSON -- but it could..."); } return JSON.parse(r); + } /** @@ -609,13 +638,11 @@ public class Platform public static void streamToFile(InputStream is, File outFile) throws IOException { - if (isJS) { jsutil.setFileBytes(outFile, is); return; } - FileOutputStream fio = new FileOutputStream(outFile); try { @@ -648,7 +675,6 @@ public class Platform if (isJS) { jsutil.addDirectDatabaseCall(domain); - System.out.println( "Platform adding known access-control-allow-origin * for domain " + domain); @@ -663,8 +689,7 @@ public class Platform public static void getURLCommandArguments() { - try - { + try { /** * Retrieve the first query field as command arguments to Jalview. Include * only if prior to "?j2s" or "&j2s" or "#". Assign the applet's @@ -672,14 +697,14 @@ public class Platform * * @j2sNative var a = * decodeURI((document.location.href.replace("&","?").split("?j2s")[0] - * + "?").split("?")[1].split("#")[0]); a && - * (J2S.thisApplet.__Info.args = a.split(" ")); - * - * System.out.println("URL arguments: " + a); + * + "?").split("?")[1].split("#")[0]); a && (System.out.println("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.")); */ } catch (Throwable t) { } + } /** @@ -704,7 +729,6 @@ public class Platform String p2 = path2.replace('\\', '/'); return p1.equals(p2); } - ///////////// JAL-3253 Applet additions ////////////// /** @@ -1028,5 +1052,4 @@ public class Platform } } } - }