JalviewJS embeddable AlignFrame; specifiable application properties
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Sun, 24 Mar 2019 10:57:05 +0000 (05:57 -0500)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Sun, 24 Mar 2019 10:57:05 +0000 (05:57 -0500)
site-resources/jalview_bin_JalviewJS_embedded.html [new file with mode: 0644]
src/jalview/gui/AlignFrame.java
src/jalview/jbgui/GAlignFrame.java

diff --git a/site-resources/jalview_bin_JalviewJS_embedded.html b/site-resources/jalview_bin_JalviewJS_embedded.html
new file mode 100644 (file)
index 0000000..6650720
--- /dev/null
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>SwingJS test JalviewJS2</title><meta charset="utf-8" />
+<script src="swingjs/swingjs2.js"></script>
+<script>
+if (!self.SwingJS)alert('swingjs2.js was not found. It needs to be in swingjs folder in the same directory as ' + document.location.href)
+Info = {
+  code: null,
+  main: "jalview.bin.JalviewJS2",
+  core: "NONE",
+  readyFunction: null,
+       serverURL: 'https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol2.php',
+       j2sPath: 'swingjs/j2s',
+       console:'sysoutdiv',
+       allowjavascript: true,
+       
+       //JalviewJS-specific:
+       jalview_SCREEN_WIDTH: 300, // desktop width
+       jalview_SCREEN_HEIGHT: 1,  // desktop height -- 0 to hide
+       jalview_SCREEN_X: 10,
+       jalview_SCREEN_Y: 10,
+       jalview_EMBEDDED: true
+       
+}
+</script>
+</head>
+<body>
+<div id="align-frame-div" style="position:absolute;left:100px;top:100px;width:600px;height:400px;">
+The alignment frame will appear here momentarily...
+</div>
+
+
+<script>
+SwingJS.getApplet('testApplet', Info)
+getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))}
+</script>
+
+
+<div style="position:absolute;left:900px;top:30px;width:600px;height:300px;">
+<div id="sysoutdiv" style="border:1px solid green;width:100%;height:95%;overflow:auto"></div>
+This is System.out. <a href="javascript:testApplet._clearConsole()">clear it</a> <br>Add ?j2snocore to URL to see full class list; ?j2sdebug to use uncompressed j2s/core files <br><a href="javascript:getClassList()">get _j2sClassList.txt</a>
+</div>
+</body>
+</html>
index 395fd98..ab779a1 100644 (file)
@@ -280,7 +280,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width,
           int height, String sequenceSetId, String viewId)
   {
-    setSize(width, height);
+    setSize(width, height); // embedding div can override this width and height if desired
 
     if (al.getDataset() == null)
     {
index 2e6aab8..ac2a25c 100755 (executable)
@@ -211,6 +211,7 @@ public class GAlignFrame extends JInternalFrame
   {
     try
     {
+      setName("align-frame"); // for embedding using id= (getName() + "-div") (frame position will be ignored)
       jbInit();
       setJMenuBar(alignFrameMenuBar);