import java.awt.Toolkit;
import java.awt.event.MouseEvent;
+import java.io.File;
import javax.swing.SwingUtilities;
}
/**
+ * Answers true if Jalview is running as Javascript, else false. The value is
+ * set at compile time.
*
- * @return true if HTML5 JavaScript
+ * @return
*/
public static boolean isJS()
{
- return isJS;
+ return /** @j2sNative true || */ false;
}
/**
break;
}
}
+
+public static void cacheFileData(String path, byte[] data) {
+ if (!isJS())
+ return;
+ /**
+ * @j2sNative
+ *
+ * swingjs.JSUtil.cacheFileData$S$O(path, data);
+ *
+ */
+}
+
+public static byte[] getFileBytes(File f) {
+ return /** @j2sNative f && f._bytes || */null;
+}
+
+public static byte[] getFileAsBytes(String fileStr) {
+ // BH 2018 hack for no support for access-origin
+ return /** @j2sNative swingjs.JSUtil.getFileAsBytes$O(fileStr) || */ null;
+}
+
+public static String getFileAsString(String data) {
+ return /** @j2sNative swingjs.JSUtil.getFileAsString$S(data) || */ null;
+}
+
+public static boolean setFileBytes(File f, String urlstring) {
+ if (!isJS())
+ return false;
+ @SuppressWarnings("unused")
+ byte[] bytes = getFileAsBytes(urlstring);
+ /** @j2sNative
+ * f._bytes = bytes;
+ */
+ return true;
+}
+
+public static void addJ2SBinaryType(String ext)
+{
+ ext = "." + ext + "?";
+
+ /**
+ * @j2sNative
+ *
+ * J2S._binaryTypes.push(ext);
+ *
+ */
+}
+
+public static String encodeURI(String value) {
+ /**
+ * @j2sNative
+ * return encodeURIComponent(value);
+ */
+ return value;
+}
+
+public static boolean openURL(String url) {
+ if (!isJS())
+ return false;
+ /**
+ * @j2sNative
+ *
+ *
+ * window.open(url);
+ */
+ return true;
+}
+
+
}