X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FPlatform.java;h=99c82a48fed22ad2d58e98d9214dd98b0ea748e8;hb=refs%2Fheads%2FJalview-JS%2FJAL-3253-applet-SwingJS-3.2.9.v1e;hp=389768fcfcf591cf8122463f118bf5759161837b;hpb=c2f5a227f8ad828af0c4693ee71d5e032761684c;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 389768f..99c82a4 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -35,19 +35,19 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; -import java.util.HashMap; -import java.util.HashSet; import java.util.Properties; -import java.util.Set; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.SwingUtilities; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; +import java.util.logging.ConsoleHandler; +import java.util.logging.Level; +import java.util.logging.Logger; import com.stevesoft.pat.Regex; import swingjs.api.JSUtilI; @@ -73,7 +73,7 @@ public class Platform private static Boolean isNoJSMac = null, isNoJSWin = null, isMac = null, isWin = null; - // private static Boolean isHeadless = null; + private static Boolean isHeadless = null; /** * added to group mouse events into Windows and nonWindows (mac, unix, linux) @@ -130,18 +130,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; - // } + /** + * + * @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; + } /** * @@ -331,6 +331,9 @@ public class Platform break; } } + + ////// jsutil additions, simplifications + public static void cacheFileData(String path, Object data) { if (isJS()) @@ -505,7 +508,8 @@ public class Platform public static Object parseJSON(String json) throws ParseException { - return (isJS() ? JSON.parse(json) : new JSONParser().parse(json)); + return (isJS() ? JSON.parse(json) + : new JSONParser().parse(json)); } public static Object parseJSON(Reader r) @@ -634,6 +638,9 @@ public class Platform return p1.equals(p2); } + ///// new methods from applet branch only + + public static URL getDocumentBase() { return (isJS() ? jsutil.getDocumentBase() : null);