From: tcofoegbu Date: Tue, 28 Jul 2015 15:54:24 +0000 (+0100) Subject: JAL-857 converted jalview applet launch scripts to applet tags to prevent whole page... X-Git-Tag: Release_2_10_0~479^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cf06ee5d732af6cc874115aece1138adafca8ad7;p=jalview.git JAL-857 converted jalview applet launch scripts to applet tags to prevent whole page rewriting, fixed race condition bug affecting callback method of linked/scriptable applets, and added custom layout for embeddedWJmol page to deal with whole page rewrite bug --- diff --git a/examples/embeddedWJmol.html b/examples/embeddedWJmol.html index ca5b464..9b7389d 100644 --- a/examples/embeddedWJmol.html +++ b/examples/embeddedWJmol.html @@ -1,22 +1,194 @@ - - - - + + + + + + + + + + + + + + + - + + + + + + + + + +
+
+ +
+ + + + +
+
+ +
+
+
+
+
+
+
+
+
+ + + + + + + +
+ + - -
@@ -108,12 +278,71 @@ function genHref()

Structure and Alignment

This demo shows how JalviewLite and Jmol can be integrated with the JalviewLite javascript library.

-
+ + +
- -
- \ No newline at end of file +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ + + + diff --git a/examples/javascript/jalview.js b/examples/javascript/jalview.js index a3ff56b..31698b6 100644 --- a/examples/javascript/jalview.js +++ b/examples/javascript/jalview.js @@ -346,3 +346,37 @@ function _jmolMessagecallback(jmid, statmess) { } } + + + function lJvApp() { + setTimeout(function() { + //alert("in lJvApp"); + var jvapp = document.getElementById("jvapp"); + var jvfollower = document.getElementById("jvfollower"); + //console.log(">>>>>>>> lJvApp" + jvapp); + linkJvJmol(jvapp); + }, 100); + setConsole(document.getElementById("stdout")); + }; + + function lJvFollow() { + setTimeout(function() { + //alert("in lJvFollow"); + var jvapp = document.getElementById("jvapp"); + var jvfollower = document.getElementById("jvfollower"); + console.log(">>>>>>> lJvFollow" + jvfollower); + linkJvJmol(jvfollower); + }, 100); + }; + + function lJvA() { + setTimeout(function() { + //alert("lJvA"); + jvfollower = document.getElementById("jvA"); + setConsole(document.getElementById("stdout")); + //sep = jvfollower.getSeparator(); + //jvapp.setSeparator(""+jvapp.getSeparator()); + linkJvJmol(jvfollower, "jmolView", modeltofiles); + }, 100); + }; + diff --git a/examples/javascript/jvcontroller.js b/examples/javascript/jvcontroller.js index a604fce..885b2fa 100644 --- a/examples/javascript/jvcontroller.js +++ b/examples/javascript/jvcontroller.js @@ -18,15 +18,8 @@ */ - //var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets"; + var currentPage = "applets"; - var signedJars = "jalviewApplet.jar,JmolApplet-12.2.4.jar,java-json.jar,json_simple-1.1.jar"; - var unsignedJars = "u_jalviewApplet.jar,u_JmolApplet-12.2.4.jar,u_java-json.jar,u_json_simple-1.1.jar"; - setOrUpdateCookie('jv_applet_mode', 'false', '1'); - //var isSignedAppletMode = readCookie("jv_applet_mode"); - //var appletJars = (isSignedAppletMode === 'true') ? signedJars : unsignedJars; - //alert(unsigned); - function createAppletTag(code, name, archive, width, height, params){ var app = document.createElement('applet'); @@ -77,45 +70,40 @@ var newPage = url.substring(start + 1, end); var page = ((start === -1) ? currentPage : newPage); //alert("page:" + page); - $('#header').load("includes/header_jv.html"); - $('#content').load(page+".html"); - $('#nav').load("includes/nav_jv.html"); - $('#footer').load("includes/footer_jv.html"); - $('#'+ currentPage).addClass('active-trail active'); + if(page === "embeddedWJmol"){ + // do nothing embeddedWJmol page already include + + $('#header').load("includes/header_jv.html"); + //$('#content').load(page + ".html"); + $('#nav').load("includes/nav_jv.html"); + $('#footer').load("includes/footer_jv.html"); + $('#'+ currentPage).addClass('active-trail active'); + }else{ + $('#header').load("includes/header_jv.html"); + $('#content').load(page + ".html"); + $('#nav').load("includes/nav_jv.html"); + $('#footer').load("includes/footer_jv.html"); + $('#'+ currentPage).addClass('active-trail active'); + } }); - $(document).ready(function(){ - //var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets.html"; - //updateLinks(currentPage); - var params = [["file","uniref50.fa"], - ["treeFile","ferredoxin.nw"], - ["userDefinedColour","C=yellow; R,K,H=FF5555; D,E=5555F"], - ["sortByTree","True"], - ["showSequenceLogo","true"], - ["showGroupConsensus","true"], - ["showFullId","false"], - ["linkLabel_1","Uniprot"], - ["linkUrl_1","http://www.uniprot.org/uniprot/$SEQUENCE_ID$"], - ["linkLabel_2","EMBL-EBI Search"], - ["linkUrl_2","http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$"], - ["APPLICATION_URL","http://www.jalview.org/services/launchApp"]]; - var app = createAppletTag('jalview.bin.JalviewLite','',appletJars,'140','35', params); - console.log('—————————> app ———————> ' + app); - //var appDiv = document.getElementById("applet_div"); - //var appDiv = document.getElementById("applet_div"); - //appDiv.appendChild(app); - $("
I'm new box by appendTo
").appendTo('.applet_div'); - //$(‘.applet_div').append(app); - }); function doSubmit(target){ - //setOrUpdateCookie('current_page', target, '1'); - //alert('current page : ' + readCookie("current_page")); var currentPage = target+'.html'; - $('#content').load(currentPage); + //alert("page:" + target); + if(target == "embeddedWJmol"){ + //loadJMolPage(); + window.location.href = 'embeddedWJmol.html#' + target; + $('#content').load(currentPage); + }else{ + window.location.href = 'index.html#' + target; + $('#content').load(currentPage); + } updateLinks(target); } + + function updateLinks(target) { var ul = document.getElementById("menu"); var items = ul.getElementsByTagName("li"); @@ -139,3 +127,4 @@ function removeClass(ele,cls) { ele.className=ele.className.replace(reg,' '); } } + diff --git a/examples/linkedapplets_ng.html b/examples/linkedapplets_ng.html index 5786961..5da9e59 100644 --- a/examples/linkedapplets_ng.html +++ b/examples/linkedapplets_ng.html @@ -26,94 +26,61 @@ + + + + - - - -

JalviewLite Linked Applets Demo

The two applets below use JalviewLite's javascript API to exchange events about the currently selected region and mouse position in the alignment.

- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +