From 2e87920be1283b0dfab1e0dd5bf4127493c96241 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 14 Sep 2015 09:39:06 +0100 Subject: [PATCH] JAL-1684 align added alignment to match original in split frame --- src/jalview/bin/JalviewLite.java | 48 +++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 3024e66..7112381 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -92,7 +92,7 @@ public class JalviewLite extends Applet implements } // ///////////////////////////////////////// - // The following public methods maybe called + // The following public methods may be called // externally, eg via javascript in HTML page /* * (non-Javadoc) @@ -956,11 +956,16 @@ public class JalviewLite extends Applet implements } } - /* - * (non-Javadoc) - * + /** + * Callable from javascript to register a javascript function to pass events + * to a structure viewer. + * + * @param listener + * the name of a javascript function + * @param modelSet + * a token separated list of PDB file names listened for * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String, - * java.lang.String) + * java.lang.String) */ public void setStructureListener(String listener, String modelSet) { @@ -1345,9 +1350,10 @@ public class JalviewLite extends Applet implements /** * init method for Jalview Applet */ + @Override public void init() { - // remove any handlers that might be hanging around from an earlier instance + debug = TRUE.equalsIgnoreCase(getParameter("debug")); try { if (debug) @@ -1370,17 +1376,12 @@ public class JalviewLite extends Applet implements ex.printStackTrace(); } } - /** - * turn on extra applet debugging - */ - debug = TRUE.equalsIgnoreCase(getParameter("debug")); + if (debug) { - System.err.println("JalviewLite Version " + getVersion()); System.err.println("Build Date : " + getBuildDate()); System.err.println("Installation : " + getInstallation()); - } String externalsviewer = getParameter("externalstructureviewer"); if (externalsviewer != null) @@ -1885,8 +1886,11 @@ public class JalviewLite extends Applet implements { AlignmentI al1 = af.viewport.getAlignment(); AlignmentI al2 = af2.viewport.getAlignment(); - if (AlignmentUtils.isMappable(al1, al2)) + AlignmentI cdna = al1.isNucleotide() ? al1 : al2; + AlignmentI prot = al1.isNucleotide() ? al2 : al1; + if (AlignmentUtils.mapProteinAlignmentToCdna(prot, cdna)) { + al2.alignAs(al1); SplitFrame sf = new SplitFrame(af, af2); sf.addToDisplay(embedded, JalviewLite.this); return; @@ -2352,26 +2356,26 @@ public class JalviewLite extends Applet implements /** * Discovers whether the given file is in the Applet Archive * - * @param file + * @param f * String * @return boolean */ - boolean inArchive(String file) + boolean inArchive(String f) { // This might throw a security exception in certain browsers // Netscape Communicator for instance. try { - boolean rtn = (getClass().getResourceAsStream("/" + file) != null); + boolean rtn = (getClass().getResourceAsStream("/" + f) != null); if (debug) { - System.err.println("Resource '" + file + "' was " - + (rtn ? "" : "not") + " located by classloader."); + System.err.println("Resource '" + f + "' was " + + (rtn ? "" : "not ") + "located by classloader."); } return rtn; } catch (Exception ex) { - System.out.println("Exception checking resources: " + file + " " + System.out.println("Exception checking resources: " + f + " " + ex); return false; } @@ -2512,8 +2516,9 @@ public class JalviewLite extends Applet implements * @param separator * @return elements separated by separator */ - public String[] separatorListToArray(String list, String separator) + public static String[] separatorListToArray(String list, String separator) { + // TODO use StringUtils version (slightly different...) int seplen = separator.length(); if (list == null || list.equals("") || list.equals(separator)) { @@ -2579,8 +2584,9 @@ public class JalviewLite extends Applet implements * @param separator * @return concatenated string */ - public String arrayToSeparatorList(String[] list, String separator) + public static String arrayToSeparatorList(String[] list, String separator) { + // TODO use StringUtils version StringBuffer v = new StringBuffer(); if (list != null && list.length > 0) { -- 1.7.10.2