if (Platform.isJS())
{
- final String ns = JalviewJSUtil.getJ2sNamespace();
- if (ns != null)
- {
- final String jalviewjsDesktopElementId = "testApplet_LayeredPaneUI_10_8div";
- final String nsc = ns + (ns.length() > 0 ? ":" : "");
- final String nsu = ns + (ns.length() > 0 ? "_" : "");
- final String splashId = nsc + "jalviewjsSplash";
- final String splashClassActive = nsu + "jalviewjsSplashActive";
- final String splashClassInactive = nsu + "jalviewjsSplashInactive";
- final String splashClassHidden = nsu + "jalviewjsSplashHidden";
- final String j2s_overflow = JalviewJSUtil
- .getJ2sInfoValue("overflow");
- /**
- * @j2sNative // splash element disappearance
- *
- * function sleep(ms) {
- *
- * return new Promise(resolve => setTimeout(resolve, ms));
- *
- * }
- *
- * var splashElement = document.getElementById(splashId);
- *
- * if (splashElement !== undefined) {
- *
- * splashElement.classList.remove(splashClassActive);
- *
- * splashElement.classList.add(splashClassInactive);
- *
- * async function hideSplash() {
- *
- * await sleep(5000);
- *
- * splashElement.classList.add(splashClassHidden);
- *
- * }
- *
- * hideSplash();
- *
- * }
- *
- * // overflow setting
- *
- * async function changeVisibility() {
- *
- * var desktopElement = null;
- *
- * var timeCount = 0;
- *
- * var setCount = 0;
- *
- * var stayedSetCount = 0;
- *
- * while ((desktopElement == null || setCount < 5) &&
- * timeCount < 50 && stayedSetCount < 5) {
- *
- * await sleep(100);
- *
- * if (desktopElement == null) {
- *
- * desktopElement =
- * document.getElementById(jalviewjsDesktopElementId);
- *
- * }
- *
- * if (desktopElement !== undefined && desktopElement !==
- * null) {
- *
- * if (desktopElement.style.overflow == "hidden") {
- *
- * desktopElement.style.overflow = "visible";
- *
- * setCount++;
- *
- * stayedSetCount = 0;
- *
- * } else {
- *
- * stayedSetCount++;
- *
- * }
- *
- * }
- *
- * timeCount++;
- *
- * }
- *
- * }
- *
- * if (new String(j2s_overflow).substring(0,4) === "true") {
- *
- * changeVisibility();
- *
- * }
- */
- }
+ JalviewJSUtil.setJ2SLoadedCSS();
// used for jalviewjsTest
jalview.bin.Console.info("JALVIEWJS: CREATED DESKTOP");
}
"height", "serverURL", "j2sPath", "console" };
/**
+ * Key values to get from thisApplet
+ */
+ private static final String j2sIdKey = "_id";
+
+ private static final String[] j2sAppletKeys = { j2sIdKey, "_j2sPath",
+ "_j2sFullPath" };
+
+ /**
* The prefix for non-named keys in the Info={} block
*/
private static final String j2sParameterPrefix = "j2s_";
|| Arrays.asList(j2sSavedKeys).contains(key)))
{
j2sInfo.put(key, val);
-
if (key.equals(j2sNamespaceKey))
{
setJ2sNamespace(val);
*
* }
*/
+
+ // Now set important parameters from the J2S.thisApplet object
+ key = null;
+ val = null;
+ /**
+ * @j2sNative if (J2S.thisApplet !== undefined) {
+ *
+ * Object.entries(J2S.thisApplet).forEach( entry => {
+ *
+ * key = entry[0];
+ *
+ * val = entry[1];
+ */
+ if (key != null && Arrays.asList(j2sAppletKeys).contains(key))
+ {
+ j2sInfo.put(key, val);
+ if (key.equals(j2sIdKey))
+ {
+ setJ2sId(val);
+ }
+ }
+ /**
+ * @j2sNative }
+ *
+ * );
+ *
+ * }
+ */
+ }
+
+ /**
+ * Applet ID
+ */
+ private static String j2sId = null;
+
+ private static void setJ2sId(String id)
+ {
+ if (!Platform.isJS())
+ {
+ return;
+ }
+ Console.outPrintln("j2sId set to '" + id + "'");
+ j2sId = id;
+ }
+
+ public static String getJ2sId()
+ {
+ return j2sId;
}
/**
}
}
+ public static void setJ2SLoadedCSS()
+ {
+ final String ns = JalviewJSUtil.getJ2sNamespace();
+ if (ns != null)
+ {
+ final String jalviewjsDesktopElementId = getJ2sId()
+ + "_LayeredPaneUI_10_8div";
+ final String nsc = ns + (ns.length() > 0 ? ":" : "");
+ final String nsu = ns + (ns.length() > 0 ? "_" : "");
+ final String splashId = nsc + "jalviewjsSplash";
+ final String splashClassActive = nsu + "jalviewjsSplashActive";
+ final String splashClassInactive = nsu + "jalviewjsSplashInactive";
+ final String splashClassFinal = nsu + "jalviewjsSplashFinal";
+ final String j2s_overflow = JalviewJSUtil.getJ2sInfoValue("overflow");
+ /**
+ * @j2sNative // splash element disappearance
+ *
+ * function sleep(ms) {
+ *
+ * return new Promise(resolve => setTimeout(resolve, ms));
+ *
+ * }
+ *
+ * var splashElement = document.getElementById(splashId);
+ *
+ * if (splashElement !== undefined) {
+ *
+ * splashElement.classList.remove(splashClassActive);
+ *
+ * splashElement.classList.add(splashClassInactive);
+ *
+ * async function hideSplash() {
+ *
+ * await sleep(5000);
+ *
+ * splashElement.classList.add(splashClassFinal);
+ *
+ * }
+ *
+ * hideSplash();
+ *
+ * }
+ *
+ * // overflow setting
+ *
+ * async function changeVisibility() {
+ *
+ * var desktopElement = null;
+ *
+ * var timeCount = 0;
+ *
+ * var setCount = 0;
+ *
+ * var stayedSetCount = 0;
+ *
+ * while ((desktopElement == null || setCount < 5) && timeCount
+ * < 50 && stayedSetCount < 5) {
+ *
+ * await sleep(100);
+ *
+ * if (desktopElement == null) {
+ *
+ * desktopElement =
+ * document.getElementById(jalviewjsDesktopElementId);
+ *
+ * }
+ *
+ * if (desktopElement !== undefined && desktopElement !== null)
+ * {
+ *
+ * if (desktopElement.style.overflow == "hidden") {
+ *
+ * desktopElement.style.overflow = "visible";
+ *
+ * setCount++;
+ *
+ * stayedSetCount = 0;
+ *
+ * } else {
+ *
+ * stayedSetCount++;
+ *
+ * }
+ *
+ * }
+ *
+ * timeCount++;
+ *
+ * }
+ *
+ * }
+ *
+ * if (new String(j2s_overflow).substring(0,4) === "true") {
+ *
+ * changeVisibility();
+ *
+ * }
+ */
+ }
+ }
}
opacity: 0%;
transition: opacity 1s;
}
-.jv_jalviewjsSplashHidden {
+.jv_jalviewjsSplashFinal {
display: none;
}
</style>
</head>
<body>
<script>
-SwingJS.getApplet('testApplet', Info);
+SwingJS.getApplet('jalviewjs', Info);
getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))};
</script>
<div style="position:absolute;left:10px;top:10px;width:640px;height:1200px;">
<img style="width; 2rem; height: 2rem;" src="images/jalview_logo_small.svg" />
</div>
</div>
-This is System.out. <a href="javascript:testApplet._clearConsole()">clear it</a> <a href='javascript:J2S.getProfile()'>start/stop profiling</a><br>see <a href=___j2sflags.htm>___j2sflags.htm</a> for SwingJS URL command-line options<br><a href="javascript:getClassList()">get _j2sClassList.txt</a>
+This is System.out. <a href="javascript:jalviewjs._clearConsole()">clear it</a> <a href='javascript:J2S.getProfile()'>start/stop profiling</a><br>see <a href=___j2sflags.htm>___j2sflags.htm</a> for SwingJS URL command-line options<br><a href="javascript:getClassList()">get _j2sClassList.txt</a>
</div>
</body>
</html>
transform: rotate(360deg);
}
}
-.jv_jalviewjsSplashRotate {
- animation: rotation 6s infinite cubic-bezier(0.4, 0.6, 0.6, 0.4);
+@keyframes pulse {
+ 0% {
+ transform: scale(1);
+ }
+ 50% {
+ transform: scale(0.85);
+ }
+ 100% {
+ transform: scale(1);
+ }
}
-.jv_jalviewjsSplashActive {
+.jv1_jalviewjsSplashRotate {
+ animation: rotation 3s infinite cubic-bezier(0.4, 0.6, 0.6, 0.4);
+}
+.jv1_jalviewjsSplashActive {
display: visible;
opacity: 100%;
+ z-index: 100;
}
-.jv_jalviewjsSplashInactive {
+.jv1_jalviewjsSplashInactive {
opacity: 0%;
transition: opacity 1s;
+ z-index: 100;
}
-.jv_jalviewjsSplashHidden {
+.jv1_jalviewjsSplashFinal {
display: none;
}
+
+.jv_jalviewjsSplashRotate {
+ animation: pulse 1s cubic-bezier(0.4, 0.6, 0.6, 0.4);
+ animation-iteration-count: infinite;
+ animation-fill-mode: forwards;
+}
+.jv_jalviewjsSplashActive {
+ z-index: 100;
+}
+.jv_jalviewjsSplashInactive {
+ animation-iteration-count: 1;
+ animation-fill-mode: forwards;
+ opacity: 30%;
+ transition: all 1s;
+ z-index: 100;
+}
+.jv_jalviewjsSplashFinal {
+ z-index: -1;
+ opacity: 30%;
+}
+
</style>
</head>
<body>
<script>
-SwingJS.getApplet('testApplet', Info);
+SwingJS.getApplet('jalviewjs', Info);
getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))};
</script>
<div style="position:absolute;left:10px;top:10px;width:640px;height:1200px;">
<div id="sysoutdiv" contentEditable="true" style="padding: 5px; border: 1px solid green; width: 100%; height: 95%; overflow: auto; font-family: 'Fira Mono', monospace; font-size: 8pt;">
-<div id="jv:jalviewjsSplash" class="jv_jalviewjsSplashRotate jv_jalviewjsSplashActive" style="position: absolute; right: 1rem; top: 1rem; z-index: 1000;">
+<div id="jv:jalviewjsSplash" class="jv_jalviewjsSplashRotate jv_jalviewjsSplashActive" style="position: absolute; right: 1rem; top: 1rem;">
<img style="width; 2rem; height: 2rem;" src="images/jalview_logo_small.svg" />
</div>
</div>
-This is System.out. <a href="javascript:testApplet._clearConsole()">clear it</a> <a href='javascript:J2S.getProfile()'>start/stop profiling</a><br>see <a href=___j2sflags.htm>___j2sflags.htm</a> for SwingJS URL command-line options<br><a href="javascript:getClassList()">get _j2sClassList.txt</a>
+This is System.out. <a href="javascript:jalviewjs._clearConsole()">clear it</a> <a href='javascript:J2S.getProfile()'>start/stop profiling</a><br>see <a href=___j2sflags.htm>___j2sflags.htm</a> for SwingJS URL command-line options<br><a href="javascript:getClassList()">get _j2sClassList.txt</a>
</div>
</body>
</html>