X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FPlatform.java;h=bb0c1b66784c3fb0f6221557e84496f8ebe88da8;hb=refs%2Fheads%2FJalview-JS%2Fbug%2FJAL-3762_URLparamsOverrideInfoArg;hp=ade9d8773359eb49cb711444a29b2492aaec1e3c;hpb=17e4ea278bc9a5fb280db1252ce78b7a295215f5;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index ade9d87..bb0c1b6 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -337,7 +337,7 @@ public class Platform public static byte[] getFileBytes(File f) { - return /** @j2sNative f && f._bytes || */ + return /** @j2sNative f && swingjs.JSUtil.getFileBytes$java_io_File(f) || */ null; } @@ -375,8 +375,10 @@ public class Platform } @SuppressWarnings("unused") byte[] bytes = getFileAsBytes(urlstring); + // TODO temporary doubling of 秘bytes and _bytes; + // just remove _bytes when new transpiler has been installed /** - * @j2sNative f._bytes = bytes; + * @j2sNative f.\u79d8bytes = f._bytes = bytes; */ return true; } @@ -428,10 +430,8 @@ public class Platform public static String getUniqueAppletID() { - @SuppressWarnings("unused") - ThreadGroup g = Thread.currentThread().getThreadGroup(); /** - * @j2sNative return g.html5Applet._uniqueId; + * @j2sNative return swingjs.JSUtil.getApplet$()._uniqueId; * */ return null; @@ -452,13 +452,12 @@ public class Platform { return; } - @SuppressWarnings("unused") - ThreadGroup g = Thread.currentThread().getThreadGroup(); String id = getUniqueAppletID(); String key = "", value = ""; /** - * @j2sNative var info = g.html5Applet.__Info || {}; for (var key in info) { - * if (key.indexOf(prefix) == 0) { value = "" + info[key]; + * @j2sNative var info = swingjs.JSUtil.getApplet$().__Info || {}; for (var + * key in info) { if (key.indexOf(prefix) == 0) { value = "" + + * info[key]; */ System.out.println( @@ -544,23 +543,22 @@ public class Platform * @param is * @param outFile * @throws IOException - * if the file cannot be created or there is a problem reading the - * input stream. + * if the file cannot be created or there is a problem + * reading the input stream. */ public static void streamToFile(InputStream is, File outFile) throws IOException { + if (isJS() && /** + * @j2sNative outFile.setBytes$O && outFile.setBytes$O(is) && + */ + true) + { + return; + } FileOutputStream fio = new FileOutputStream(outFile); try { - if (isJS() - && /** - * @j2sNative outFile.setBytes$O && outFile.setBytes$O(is) && - */ - true) - { - return; - } byte[] bb = new byte[32 * 1024]; int l; while ((l = is.read(bb)) > 0) @@ -603,18 +601,21 @@ public class Platform public static void getURLCommandArguments() { - - /** - * Retrieve the first query field as command arguments to Jalview. Include - * only if prior to "?j2s" or "&j2s" or "#". Assign the applet's __Info.args - * element to this value. - * - * @j2sNative var a = - * decodeURI((document.location.href.replace("&","?").split("?j2s")[0] - * + "?").split("?")[1].split("#")[0]); a && - * (J2S.thisApplet.__Info.args = a.split(" ")); - */ - + try { + /** + * Retrieve the first query field as command arguments to Jalview. Include + * only if prior to "?j2s" or "&j2s" or "#". Assign the applet's + * __Info.args element to this value. + * + * @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(" ")); + * (!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) + { + } } /**