import java.awt.Rectangle;
import java.io.*;
+import java.lang.reflect.InvocationTargetException;
import java.net.*;
import java.util.*;
import java.util.jar.*;
{
if (frames[f] instanceof AppJmol)
{
+ // TODO: revise schema to allow many:one PDB id binding to viewer
jmol = (AppJmol) frames[f];
- if (!jmol.pdbentry.getId().equals(entry.getId())
+ if (!jmol.jmb.pdbentry[0].getId().equals(entry.getId())
&& !(entry.getId().length() > 4 && entry.getId()
.toLowerCase().startsWith(
- jmol.pdbentry.getId().toLowerCase())))
+ jmol.jmb.pdbentry[0].getId().toLowerCase())))
continue;
- matchedFile = jmol.pdbentry.getFile(); // record the file so we
+ matchedFile = jmol.jmb.pdbentry[0].getFile(); // record the file so we
// can get at it if the ID
// match is ambiguous (e.g.
// 1QIP==1qipA)
state.setWidth(jmol.getWidth());
state.setHeight(jmol.getHeight());
state.setViewId(jmol.getViewId());
- String statestring = jmol.viewer.getStateInfo();
+ String statestring = jmol.jmb.viewer.getStateInfo();
if (state != null)
{
state.setContent(statestring.replaceAll("\n", ""));
}
- for (int s = 0; s < jmol.sequence.length; s++)
+ for (int s = 0; s < jmol.jmb.sequence.length; s++)
{
- if (jal.findIndex(jmol.sequence[s]) > -1)
+ if (jal.findIndex(jmol.jmb.sequence[s]) > -1)
{
pdb.addStructureState(state);
}
if (newFileLoc != null)
{
- new AppJmol(pdbFile, ids[p].getId(), seq, af.alignPanel,
- newFileLoc.toString(), new java.awt.Rectangle(x,
- y, width, height), sviewid);
+ int histbug = newFileLoc.indexOf("history = ");
+ histbug+=10;
+ int diff = histbug==-1 ? -1 : newFileLoc.indexOf(";",histbug);
+ String val = (diff==-1) ? null : newFileLoc.substring(histbug,diff);
+ if (val!=null && val.length()>=4)
+ {
+ if (val.contains("e")) {
+ if (val.trim().equals("true")) {
+ val = "1";
+ } else {
+ val = "0";
+ }
+ newFileLoc.replace(histbug, diff, val);
+ }
+ }
+ final String pdbf=pdbFile, id=ids[p].getId(), fileloc=newFileLoc.toString(),vid=sviewid;
+ final SequenceI[] sq=seq;
+ final AlignFrame alf = af;
+ final java.awt.Rectangle rect = new java.awt.Rectangle(x,
+ y, width, height);
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ new AppJmol(pdbf, id, sq, alf.alignPanel,
+ fileloc, rect, vid);
+ }
+ });
+ }
+ catch (InvocationTargetException ex)
+ {
+ System.err.println("Unexpected error when opening Jmol view.");
+ ex.printStackTrace();
+ } catch (InterruptedException e)
+ {
+ // e.printStackTrace();
+ }
}
}
.setMapping(seq, null, pdbFile,
jalview.io.AppletFormatAdapter.FILE);
- ((AppJmol) comp).addSequence(seq);
+ ((AppJmol) comp).jmb.addSequence(seq);
}
}
}