+
+ // ////////////////////////////////
+ // /StructureListener
+ public String[] getPdbFile()
+ {
+ return new String[] { pdbentry.getFile() };
+ }
+
+ String lastMessage;
+
+ public void mouseOverStructure(int pdbResNum, String chain)
+ {
+ if (lastMessage == null || !lastMessage.equals(pdbResNum + chain))
+ {
+ ssm.mouseOverStructure(pdbResNum, chain, pdbentry.getFile());
+ }
+
+ lastMessage = pdbResNum + chain;
+ }
+
+ StringBuffer resetLastRes = new StringBuffer();
+
+ StringBuffer eval = new StringBuffer();
+
+ /**
+ * Highlight the specified atoms in the structure.
+ *
+ * @param atoms
+ */
+ @Override
+ public void highlightAtoms(List<AtomSpec> atoms)
+ {
+ if (!seqColoursReady)
+ {
+ return;
+ }
+
+ for (AtomSpec atom : atoms)
+ {
+ int atomIndex = atom.getAtomIndex();
+ if (highlightRes != null
+ && highlightRes.contains((atomIndex - 1) + ""))
+ {
+ continue;
+ }
+
+ highlightAtom(atomIndex);
+ }
+
+ redrawneeded = true;
+ repaint();
+ }
+
+ /**
+ * Highlight the atom at the specified index.
+ *
+ * @param atomIndex
+ */
+ protected void highlightAtom(int atomIndex)
+ {
+ int index = -1;
+ Bond tmpBond;
+ for (index = 0; index < mainchain.bonds.size(); index++)
+ {
+ tmpBond = mainchain.bonds.elementAt(index);
+ if (tmpBond.at1.atomIndex == atomIndex)
+ {
+ if (highlightBond1 != null)
+ {
+ highlightBond1.at2.isSelected = false;
+ }
+
+ if (highlightBond2 != null)
+ {
+ highlightBond2.at1.isSelected = false;
+ }
+
+ highlightBond1 = null;
+ highlightBond2 = null;
+
+ if (index > 0)
+ {
+ highlightBond1 = mainchain.bonds.elementAt(index - 1);
+ highlightBond1.at2.isSelected = true;
+ }
+
+ if (index != mainchain.bonds.size())
+ {
+ highlightBond2 = mainchain.bonds.elementAt(index);
+ highlightBond2.at1.isSelected = true;
+ }
+
+ break;
+ }
+ }
+ }
+
+ public Color getColour(int atomIndex, int pdbResNum, String chain,
+ String pdbfile)
+ {
+ return Color.white;
+ // if (!pdbfile.equals(pdbentry.getFile()))
+ // return null;
+
+ // return new Color(viewer.getAtomArgb(atomIndex));
+ }
+
+ public void updateColours(Object source)
+ {
+ colourBySequence();
+ redrawneeded = true;
+ repaint();
+ }
+
+ @Override
+ public void releaseReferences(Object svl)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isListeningFor(SequenceI seq)
+ {
+ if (sequence != null)
+ {
+ for (SequenceI s : sequence)
+ {
+ if (s == seq)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }