X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Futil%2FPlatform.java;fp=src%2Fjalview%2Futil%2FPlatform.java;h=7b318ba0b0568e695a43c153d4ba26ac67072ae8;hb=5d4f312f392e448a128138404fc4bc72762f072a;hp=0a788d936cd7adf0428a152841e7bd423dbf5bf6;hpb=703901ee1111a5c61922c71618156f165258412d;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 0a788d9..7b318ba 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -23,6 +23,7 @@ package jalview.util; import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.io.File; +import java.util.Properties; import javax.swing.SwingUtilities; @@ -223,7 +224,8 @@ public class Platform } } -public static void cacheFileData(String path, byte[] data) { + public static void cacheFileData(String path, byte[] data) + { if (!isJS()) return; /** @@ -232,22 +234,26 @@ public static void cacheFileData(String path, byte[] data) { * swingjs.JSUtil.cacheFileData$S$O(path, data); * */ -} + } -public static byte[] getFileBytes(File f) { + public static byte[] getFileBytes(File f) + { return /** @j2sNative f && f._bytes || */null; -} + } -public static byte[] getFileAsBytes(String fileStr) { + public static byte[] getFileAsBytes(String fileStr) + { // BH 2018 hack for no support for access-origin - return /** @j2sNative swingjs.JSUtil.getFileAsBytes$O(fileStr) || */ null; -} + return /** @j2sNative swingjs.JSUtil.getFileAsBytes$O(fileStr) || */ null; + } -public static String getFileAsString(String data) { + public static String getFileAsString(String data) + { return /** @j2sNative swingjs.JSUtil.getFileAsString$S(data) || */ null; -} + } -public static boolean setFileBytes(File f, String urlstring) { + public static boolean setFileBytes(File f, String urlstring) + { if (!isJS()) return false; @SuppressWarnings("unused") @@ -256,30 +262,30 @@ public static boolean setFileBytes(File f, String urlstring) { * f._bytes = bytes; */ return true; -} + } -public static void addJ2SBinaryType(String ext) -{ - ext = "." + ext + "?"; - + public static void addJ2SBinaryType(String ext) + { /** * @j2sNative * - * J2S._binaryTypes.push(ext); + * J2S._binaryTypes.push("." + ext + "?"); * */ -} + } -public static String encodeURI(String value) { + public static String encodeURI(String value) + { /** * @j2sNative * return encodeURIComponent(value); */ return value; -} + } -public static boolean openURL(String url) { + public static boolean openURL(String url) + { if (!isJS()) return false; /** @@ -289,7 +295,49 @@ public static boolean openURL(String url) { * window.open(url); */ return true; -} + } + + public static String getUniqueAppletID() { + @SuppressWarnings("unused") + ThreadGroup g = Thread.currentThread().getThreadGroup(); + /** + * @j2sNative return g.html5Applet._uniqueId; + * + */ + return null; + + } + /** + * Read the Info block for this applet. + * + * @param prefix "jalview_" + * @param p + * @return unique id for this applet + */ + public static void readInfoProperties(String prefix, Properties p) + { + @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]; + */ + + p.put(id + "_" + key, value); + + /** + * @j2sNative + + + } + } + */ + } }