- param = applet.getParameter("PDBFILE");
- }
-
- if (param != null)
- {
- PDBEntry pdb = new PDBEntry();
-
- String seqstring;
- SequenceI[] seqs = null;
- String[] chains = null;
-
- StringTokenizer st = new StringTokenizer(param, " ");
-
- if (st.countTokens() < 2)
- {
- String sequence = applet.getParameter("PDBSEQ");
- if (sequence != null)
- {
- seqs = new SequenceI[]
- { matcher == null ? (Sequence) newAlignFrame
- .getAlignViewport().getAlignment()
- .findName(sequence) : matcher.findIdMatch(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(matcher == null ? (Sequence) newAlignFrame
- .getAlignViewport().getAlignment()
- .findName(seqstring) : matcher
- .findIdMatch(seqstring));
- }
-
- seqs = new SequenceI[tmp.size()];
- tmp.copyInto(seqs);
- if (tmp2.size() == tmp.size())
- {
- chains = new String[tmp2.size()];
- tmp2.copyInto(chains);
- }
- }
- param = setProtocolState(param);
-
- if (// !jmolAvailable
- // &&
- protocol == AppletFormatAdapter.CLASSLOADER
- && !useXtrnalSviewer)
- {
- // Re: JAL-357 : the bug isn't a problem if we are using an
- // external viewer!
- // TODO: verify this Re:
- // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
- // This exception preserves the current behaviour where, even if
- // the local pdb file was identified in the class loader
- protocol = AppletFormatAdapter.URL; // this is probably NOT
- // CORRECT!
- param = addProtocol(param); //
- }
-
- pdb.setFile(param);
-
- if (seqs != null)
- {
- for (int i = 0; i < seqs.length; i++)
- {
- if (seqs[i] != null)
- {
- ((Sequence) seqs[i]).addPDBId(pdb);
- StructureSelectionManager.getStructureSelectionManager(
- applet).registerPDBEntry(pdb);
- }
- else
- {
- if (JalviewLite.debug)
- {
- // this may not really be a problem but we give a warning
- // anyway
- System.err
- .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "
- + i + ")");
- }
- }
- }
-
- if (!alignPdbStructures)
- {
- newAlignFrame.newStructureView(applet, pdb, seqs, chains,
- protocol);
- }
- else
- {
- pdbs.addElement(new Object[]
- { pdb, seqs, chains, new String(protocol) });
- }
- }