}
else
{
- setJSInfo();
+ setJ2sInfo();
}
if (args == null || args.length == 0 || (args.length == 1
}
/**
- * Info dict set by instantiating JalviewJS
+ * To be populated by Info={} hash set by instantiating JalviewJS
*/
- private Map<String, String> JSInfo = null;
+ private Map<String, String> j2sInfo = null;
- private final String[] JSSavedKeys = { "main", "core", "width", "height",
+ /**
+ * The non-j2s_-prefixed parameters to store
+ */
+ private final String[] j2sSavedKeys = { "main", "core", "width", "height",
"serverURL", "j2sPath", "console" };
- private final String JSSavedKeysPrefix = "js_";
+ /**
+ * The prefix for non-named keys in the Info={} block
+ */
+ private static final String j2sParameterPrefix = "j2s_";
- private final String JSNamespaceKey = JSSavedKeysPrefix + "namespace";
+ /**
+ * The Info key name for namespacing (query string parameters, class and id
+ * values)
+ */
+ private static final String j2sNamespaceKey = j2sParameterPrefix
+ + "namespace";
- public String getJSInfoValue(String key)
+ /**
+ * Get a value passed in from the Info={} hash. key should NOT use the
+ * namespace prefix.
+ *
+ * @param key
+ * key name without the j2s_ namespace in the Info={} hash.
+ * @return value value from the Info={} hash.
+ */
+ public String getJ2sInfoValue(String key)
{
- return JSInfo == null ? null : JSInfo.get(key);
+ if (j2sInfo == null || key == null)
+ {
+ return null;
+ }
+ String j2sKey = Arrays.asList(j2sSavedKeys).contains(key) ? key
+ : j2sParameterPrefix + key;
+ return j2sInfo.get(j2sKey);
}
- public void setJSInfo()
+ /**
+ * Get and save parameters and values from the Info={} hash.
+ */
+ public void setJ2sInfo()
{
if (!Platform.isJS())
{
return;
}
- JSInfo = new HashMap<>();
+ j2sInfo = new HashMap<>();
String key = null;
String val = null;
/**
*
* val = entry[1];
*/
- if (key != null && (key.startsWith(JSSavedKeysPrefix)
- || Arrays.asList(JSSavedKeys).contains(key)))
+ if (key != null && (key.startsWith(j2sParameterPrefix)
+ || Arrays.asList(j2sSavedKeys).contains(key)))
{
- JSInfo.put(key, val);
+ j2sInfo.put(key, val);
- if (key.equals(JSNamespaceKey))
+ if (key.equals(j2sNamespaceKey))
{
- setJSNamespace(val);
+ setJ2sNamespace(val);
}
}
/**
/**
* Namespace (if set) by JalviewJS
*/
- private String JSNamespace = null;
+ private String j2sNamespace = null;
- private void setJSNamespace(String ns)
+ private void setJ2sNamespace(String ns)
{
if (!Platform.isJS())
{
return;
}
- Console.outPrintln("JSNamespace set to '" + ns + "'");
- JSNamespace = ns;
+ Console.outPrintln("j2sNamespace set to '" + ns + "'");
+ j2sNamespace = ns;
}
- public String getJSNamespace()
+ public String getJ2sNamespace()
{
- return JSNamespace;
+ return j2sNamespace;
}
}
if (Platform.isJS())
{
- final String ns = Jalview.getInstance().getJSNamespace();
+ final String ns = Jalview.getInstance().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 + "jalviewSplash";
- final String splashClassActive = nsu + "jalviewSplashActive";
- final String splashClassInactive = nsu + "jalviewSplashInactive";
- final String splashClassHidden = nsu + "jalviewSplashHidden";
- final String js_overflow = Jalview.getInstance()
- .getJSInfoValue("js_overflow");
+ final String splashId = nsc + "jalviewjsSplash";
+ final String splashClassActive = nsu + "jalviewjsSplashActive";
+ final String splashClassInactive = nsu + "jalviewjsSplashInactive";
+ final String splashClassHidden = nsu + "jalviewjsSplashHidden";
+ final String j2s_overflow = Jalview.getInstance()
+ .getJ2sInfoValue("overflow");
/**
* @j2sNative // splash element disappearance
*
*
* }
*
- * if (new String(js_overflow).substring(0,4) === "true") {
+ * if (new String(j2s_overflow).substring(0,4) === "true") {
*
* changeVisibility();
*
* if namespace is not defined then use the old style single first
* parameter for arguments
*
- * @j2sNative var namespace = J2S.thisApplet.__Info.js_namespace;
+ * @j2sNative var namespace = J2S.thisApplet.__Info.j2s_namespace;
*
* if (namespace === undefined)
*
j2sPath: 'swingjs/j2s',
console:'sysoutdiv',
allowjavascript: true,
- namespace: "jv"
+ // all j2s_... values can be accessed in Jalview.getInstance().getJSInfoValue(key)
+ j2s_namespace: "jv",
+ j2s_overflow: true
}
</script>
+<style>
+@keyframes rotation {
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
+}
+.jv_jalviewjsSplashRotate {
+ animation: rotation 6s infinite cubic-bezier(0.4, 0.6, 0.6, 0.4);
+}
+.jv_jalviewjsSplashActive {
+ display: visible;
+ opacity: 100%;
+}
+.jv_jalviewjsSplashInactive {
+ opacity: 0%;
+ transition: opacity 1s;
+}
+.jv_jalviewjsSplashHidden {
+ display: none;
+}
+</style>
</head>
<body>
<script>
-SwingJS.getApplet('testApplet', Info)
-getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))}
+SwingJS.getApplet('testApplet', 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">
-<div id="jv:jalviewSplash" style="position:absolute;right:5px;top:5px;z-index:1000;">
-<img style="border-radius:50%;" src="images/jv.gif" />
+<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;">
+<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>
j2sPath: 'swingjs/j2s',
console:'sysoutdiv',
allowjavascript: true,
- // all js_... values can be accessed in Jalview.getInstance().getJSInfoValue(key)
- js_namespace: "jv",
- js_overflow: true
+ // all j2s_... values can be accessed in Jalview.getInstance().getJSInfoValue(key)
+ j2s_namespace: "jv",
+ j2s_overflow: true
}
</script>
<style>
transform: rotate(360deg);
}
}
-.jv_jalviewSplashRotate {
+.jv_jalviewjsSplashRotate {
animation: rotation 6s infinite cubic-bezier(0.4, 0.6, 0.6, 0.4);
}
-.jv_jalviewSplashActive {
+.jv_jalviewjsSplashActive {
display: visible;
opacity: 100%;
}
-.jv_jalviewSplashInactive {
+.jv_jalviewjsSplashInactive {
opacity: 0%;
transition: opacity 1s;
}
-.jv_jalviewSplashHidden {
+.jv_jalviewjsSplashHidden {
display: none;
}
</style>
</head>
<body>
<script>
-SwingJS.getApplet('testApplet', Info)
-getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))}
+SwingJS.getApplet('testApplet', 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:jalviewSplash" class="jv_jalviewSplashRotate jv_jalviewSplashActive" 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; z-index: 1000;">
<img style="width; 2rem; height: 2rem;" src="images/jalview_logo_small.svg" />
</div>
</div>