From d982e0264da4cd35cb993144754e797db11c8c48 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 27 Feb 2007 13:39:49 +0000 Subject: [PATCH] Launch applet jmol --- src/jalview/bin/JalviewLite.java | 52 +++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index e6bb685..0623193 100755 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -37,6 +37,8 @@ public class JalviewLite extends Applet { + + /////////////////////////////////////////// //The following public methods maybe called //externally, eg via javascript in HTML page @@ -147,11 +149,25 @@ public class JalviewLite boolean embedded = false; + public boolean jmolAvailable = false; + /** * init method for Jalview Applet */ public void init() { + try + { + Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter", + true, Thread.currentThread().getContextClassLoader()); + + jmolAvailable = true; + } + catch (java.lang.ClassNotFoundException ex) + { + System.out.println("Jmol not found - Use MCview for structures"); + } + int r = 255; int g = 255; int b = 255; @@ -489,28 +505,41 @@ public class JalviewLite } } + param = getParameter("PDBFILE"); if (param != null) { - if (inArchive(param)) - { - protocol = AppletFormatAdapter.CLASSLOADER; - } - else + + PDBEntry pdb = new PDBEntry(); + + if (!inArchive(param) || jmolAvailable) { - protocol = AppletFormatAdapter.URL; param = addProtocol(param); } + pdb.setFile(param); + String sequence = applet.getParameter("PDBSEQ"); if (sequence != null) { - new MCview.AppletPDBViewer(param, protocol, - (Sequence) currentAlignFrame. - getAlignViewport().getAlignment(). - findName(sequence), - currentAlignFrame.getSeqcanvas()); + if (jmolAvailable) + new jalview.appletgui.AppletJmol(pdb, + new SequenceI[] + { (Sequence) currentAlignFrame. + getAlignViewport().getAlignment(). + findName(sequence)}, + currentAlignFrame.alignPanel, + protocol); + else + + new MCview.AppletPDBViewer(pdb, + new SequenceI[] + { (Sequence) currentAlignFrame. + getAlignViewport().getAlignment(). + findName(sequence)}, + currentAlignFrame.alignPanel, + protocol); } } @@ -552,6 +581,5 @@ public class JalviewLite return file; } - } } -- 1.7.10.2