From: hansonr Date: Sat, 18 May 2019 06:16:14 +0000 (-0500) Subject: Jalview-JS/JAL-3253-applet adds shell JalviewJSApi methods to Jalview X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=be94287924736b46264674a189fd1719d38273ad;p=jalview.git Jalview-JS/JAL-3253-applet adds shell JalviewJSApi methods to Jalview A starting point for introducing a JavaScript API for Jalview. JalviewApplet.js now automatically creates a "LiveConnect-like" set of unqualified methods when the main class has a getInstance() method, using reflection to get that instance's method list and then using that list to create an interface that allows overloading of methods (as long as they have a different arity. So, for example, if Jalview is started as the "jalview1" applet (using the or tag), then we have: Jalview1.setSelectionListener(alignFrame, listener) Jalview1.setSelectionListener(listener) and about 50 other methods. To keep this simple, all methods that are not private, not static, and that do not start with $ are included in the interface. --- diff --git a/site-resources/swingjs/JalviewApplet.js b/site-resources/swingjs/JalviewApplet.js index 872f8a0..f410ec3 100644 --- a/site-resources/swingjs/JalviewApplet.js +++ b/site-resources/swingjs/JalviewApplet.js @@ -12,7 +12,7 @@ $(document).ready(function() { Jalview.processAllAppletElements = function(PageInfo) { - var applets = document.getElementsByTagName("applet") || document.getElementsByTagName("jvapplet"); + var applets = document.getElementsByTagName("applet"); var apps=[]; for (var i = 0; i < applets.length; i++) apps[i] = applets[i]; @@ -23,50 +23,38 @@ Jalview.processAllAppletElements = function(PageInfo) { Jalview.processAppletElement = function(element, UserInfo) { - // This code is specifically for processing the or tag. - - // To set Jalview application tags, use Info.args="......." - - // To set preferences, use "jalview_" prefix with all-upper-case names: - - //Info.jalview_SCREEN_X= 10,Info.jalview_SCREEN_Y= 10; - //Info.jalview_EMBEDDED= true; - //Info.jalview_SCREEN_WIDTH = 400; - //Info.jalview_SCREEN_HEIGHT = 100; - -var text = element.outerHTML; -var code = element.getAttribute("code"); -var parent = element.parentElement; -if (code != "jalview.bin.JalviewLite" && text.indexOf("