import org.jmol.api.JmolStatusListener;
import org.jmol.api.JmolViewer;
import org.jmol.c.CBK;
-import org.jmol.popup.JmolGenericPopup;
import org.jmol.script.T;
import org.jmol.viewer.JC;
import org.jmol.viewer.Viewer;
*/
private boolean associateNewStructs = false;
- Vector atomsPicked = new Vector();
+ Vector<String> atomsPicked = new Vector<String>();
- public Vector chainNames;
+ public Vector<String> chainNames;
- Hashtable chainFile;
-
- StringBuffer eval = new StringBuffer();
+ Hashtable<String, String> chainFile;
public String fileLoadingError;
*/
int frameNo = 0;
- protected JmolGenericPopup jmolpopup;
+ // protected JmolGenericPopup jmolpopup; // not used - remove?
String lastCommand;
* @param chainList
* list of chains to make visible
*/
- public void centerViewer(Vector chainList)
+ public void centerViewer(Vector<String> chainList)
{
- StringBuffer cmd = new StringBuffer();
- String lbl;
+ StringBuilder cmd = new StringBuilder(128);
int mlength, p;
- for (int i = 0, iSize = chainList.size(); i < iSize; i++)
+ for (String lbl : chainList)
{
mlength = 0;
- lbl = (String) chainList.elementAt(i);
do
{
p = mlength;
} while (p < mlength && mlength < (lbl.length() - 2));
// TODO: lookup each pdb id and recover proper model number for it.
cmd.append(":" + lbl.substring(mlength + 1) + " /"
- + (1 + getModelNum((String) chainFile.get(lbl))) + " or ");
+ + (1 + getModelNum(chainFile.get(lbl))) + " or ");
}
if (cmd.length() > 0)
{
jmolHistory(false);
if (lastCommand == null || !lastCommand.equals(command))
{
+ System.out.println(command);
viewer.evalStringQuiet(command + "\n");
}
jmolHistory(true);
* using the getFeatureRenderer() and getSequenceRenderer() renderers but only
* if colourBySequence is enabled.
*/
- public void colourBySequence(boolean showFeatures,
- jalview.api.AlignmentViewPanel alignmentv)
+ public void colourBySequence(AlignmentViewPanel alignmentv)
{
+ boolean showFeatures = alignmentv.getAlignViewport()
+ .isShowSequenceFeatures();
if (!colourBySequence || !isLoadingFinished())
{
return;
public void handlePopupMenu(int x, int y)
{
// jmolpopup.show(x, y);
- jmolpopup.jpiShow(x, y);
+ // jmolpopup.jpiShow(x, y);
}
/**
// look up file model number for this pdbfile
int mdlNum = 0;
- String fn;
// may need to adjust for URLencoding here - we don't worry about that yet.
while (mdlNum < modelFileNames.length
&& !pdbfile.equals(modelFileNames[mdlNum]))
{
- // System.out.println("nomatch:"+pdbfile+"\nmodelfn:"+fn);
mdlNum++;
}
if (mdlNum == modelFileNames.length)
viewer.evalStringQuiet(resetLastRes.toString());
}
- eval.setLength(0);
- eval.append("select " + pdbResNum); // +modelNum
+ StringBuilder cmd = new StringBuilder(64);
+ cmd.append("select " + pdbResNum); // +modelNum
resetLastRes.setLength(0);
resetLastRes.append("select " + pdbResNum); // +modelNum
- eval.append(":");
+ cmd.append(":");
resetLastRes.append(":");
if (!chain.equals(" "))
{
- eval.append(chain);
+ cmd.append(chain);
resetLastRes.append(chain);
}
{
- eval.append(" /" + (mdlNum + 1));
+ cmd.append(" /" + (mdlNum + 1));
resetLastRes.append("/" + (mdlNum + 1));
}
- eval.append(";wireframe 100;" + eval.toString() + " and not hetero;");
+ cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;");
resetLastRes.append(";wireframe 0;" + resetLastRes.toString()
+ " and not hetero; spacefill 0;");
- eval.append("spacefill 200;select none");
+ cmd.append("spacefill 200;select none");
- viewer.evalStringQuiet(eval.toString());
+ viewer.evalStringQuiet(cmd.toString());
jmolHistory(true);
}
fileLoadingError = null;
String[] oldmodels = modelFileNames;
modelFileNames = null;
- chainNames = new Vector();
- chainFile = new Hashtable();
+ chainNames = new Vector<String>();
+ chainFile = new Hashtable<String, String>();
boolean notifyLoaded = false;
String[] modelfilenames = getPdbFile();
// first check if we've lost any structures
String fileName = modelfilenames[modelnum];
boolean foundEntry = false;
MCview.PDBfile pdb = null;
- String pdbfile = null, pdbfhash = null;
+ String pdbfile = null;
// model was probably loaded inline - so check the pdb file hashcode
if (loadedInline)
{
// 'best guess'
pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])
+ ".0", "PDB");
- pdbfhash = "" + pdbfile.hashCode();
}
// search pdbentries and sequences to find correct pdbentry for this
// model
}
// FILE LOADED OK
// so finally, update the jmol bits and pieces
- if (jmolpopup != null)
- {
- // potential for deadlock here:
- // jmolpopup.updateComputedMenus();
- }
+ // if (jmolpopup != null)
+ // {
+ // // potential for deadlock here:
+ // // jmolpopup.updateComputedMenus();
+ // }
if (!isLoadingFromArchive())
{
viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off");