X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalviewLite.java;h=df11327c055dc66112b34ecbe5ee9170606f2f02;hb=7c69a7becdaa610db196fac609d978b165a801f2;hp=ffdbb1b3b6930101f0b1ccb09c3c56ebd46b60cd;hpb=4aa1854d47a868ddd53a7eb8538ed11f2e36d9ff;p=jalview.git diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index ffdbb1b..df11327 100755 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -157,19 +157,6 @@ public class JalviewLite */ public void init() { - try - { - if (!System.getProperty("java.version").startsWith("1.1")) - { - Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter"); - jmolAvailable = true; - } - } - catch (java.lang.ClassNotFoundException ex) - { - System.out.println("Jmol not available - Using MCview for structures"); - } - int r = 255; int g = 255; int b = 255; @@ -217,6 +204,9 @@ public class JalviewLite } } + LoadJmolThread jmolAvailable = new LoadJmolThread(); + jmolAvailable.start(); + final JalviewLite applet = this; if (getParameter("embedded") != null && getParameter("embedded").equalsIgnoreCase("true")) @@ -246,33 +236,6 @@ public class JalviewLite } } - public static void main(String[] args) - { - if (args.length != 1) - { - System.out.println("\nUsage: java -jar jalviewApplet.jar fileName\n"); - System.exit(1); - } - - String format = new jalview.io.IdentifyFile().Identify(args[0], - AppletFormatAdapter.FILE); - - Alignment al = null; - try - { - al = new AppletFormatAdapter().readFile(args[0], AppletFormatAdapter.FILE, - format); - } - catch (java.io.IOException ex) - { - ex.printStackTrace(); - } - if ( (al != null) && (al.getHeight() > 0)) - { - AlignFrame af = new AlignFrame(al, null, args[0], false); - af.statusBar.setText("Successfully loaded file " + args[0]); - } - } /** * Initialises and displays a new java.awt.Frame @@ -345,9 +308,29 @@ public class JalviewLite g.drawString("Jalview Applet", 50, this.getSize().height / 2 - 30); g.drawString("Loading Data...", 50, this.getSize().height / 2); } + } + + class LoadJmolThread extends Thread + { + public void run() + { + try + { + if (!System.getProperty("java.version").startsWith("1.1")) + { + Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter"); + jmolAvailable = true; + } + } + catch (java.lang.ClassNotFoundException ex) + { + System.out.println("Jmol not available - Using MCview for structures"); + } + } } + class LoadingThread extends Thread { @@ -380,6 +363,11 @@ public class JalviewLite public void run() { + startLoading(); + } + + private void startLoading() + { Alignment al = null; try { @@ -507,67 +495,115 @@ public class JalviewLite } } + /* + - param = getParameter("PDBFILE"); - if (param != null) - { + - PDBEntry pdb = new PDBEntry(); + + */ - String seqstring; - SequenceI [] seqs = null; - if(param.indexOf(" ")>-1) + int pdbFileCount = 0; + do{ + if (pdbFileCount > 0) + param = getParameter("PDBFILE" + pdbFileCount); + else + param = getParameter("PDBFILE"); + + if (param != null) { - seqstring = param.substring(param.indexOf(" ")+1); - param = param.substring(0, param.indexOf(" ")); - StringTokenizer st = new StringTokenizer(seqstring); - Vector tmp = new Vector(); - while(st.hasMoreTokens()) + PDBEntry pdb = new PDBEntry(); + + String seqstring; + SequenceI[] seqs = null; + String [] chains = null; + + StringTokenizer st = new StringTokenizer(param, " "); + + if (st.countTokens() < 2) { - tmp.addElement((Sequence) currentAlignFrame. - getAlignViewport().getAlignment(). - findName(st.nextToken())); - } + String sequence = applet.getParameter("PDBSEQ"); + if (sequence != null) + seqs = new SequenceI[] + { + (Sequence) currentAlignFrame. + getAlignViewport().getAlignment(). + findName(sequence)}; - seqs = new SequenceI[tmp.size()]; - tmp.copyInto(seqs); - } - else - { - String sequence = applet.getParameter("PDBSEQ"); - if (sequence != null) - seqs = new SequenceI[] - { - (Sequence) currentAlignFrame. - getAlignViewport().getAlignment(). - findName(sequence)}; - } + } + else + { + param = st.nextToken(); + Vector tmp = new Vector(); + Vector tmp2 = new Vector(); + + while (st.hasMoreTokens()) + { + seqstring = st.nextToken(); + StringTokenizer st2 = new StringTokenizer(seqstring,"="); + if(st2.countTokens()>1) + { + //This is the chain + tmp2.addElement(st2.nextToken()); + seqstring = st2.nextToken(); + } + tmp.addElement( (Sequence) currentAlignFrame. + getAlignViewport().getAlignment(). + findName(seqstring)); + } + + seqs = new SequenceI[tmp.size()]; + tmp.copyInto(seqs); + if(tmp2.size()==tmp.size()) + { + chains = new String[tmp2.size()]; + tmp2.copyInto(chains); + } + } - if (!inArchive(param) || jmolAvailable) - { - param = addProtocol(param); - } + if (inArchive(param) && !jmolAvailable) + { + protocol = AppletFormatAdapter.CLASSLOADER; + } + else + { + protocol = AppletFormatAdapter.URL; + param = addProtocol(param); + } - pdb.setFile(param); + pdb.setFile(param); - for(int i=0; i