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;
import jalview.bin.Jalview;
import jalview.javascript.json.JSON;
import swingjs.api.JSUtilI;
-
/**
* System platform information used by Applet and Application
*
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;
}
/**
+ * 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
*/
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;
+ }
/**
*
public static String getUniqueAppletID()
{
return (isJS ? (String) jsutil.getAppletAttribute("_uniqueId") : null);
+
}
/**
"StringJS does not support FileReader parsing for JSON -- but it could...");
}
return JSON.parse(r);
+
}
/**
public static void streamToFile(InputStream is, File outFile)
throws IOException
{
-
if (isJS)
{
jsutil.setFileBytes(outFile, is);
return;
}
-
FileOutputStream fio = new FileOutputStream(outFile);
try
{
if (isJS)
{
jsutil.addDirectDatabaseCall(domain);
-
System.out.println(
"Platform adding known access-control-allow-origin * for domain "
+ domain);
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
*
* @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)
{
}
+
}
/**
String p2 = path2.replace('\\', '/');
return p1.equals(p2);
}
-
///////////// JAL-3253 Applet additions //////////////
/**
}
}
}
-
}