import java.awt.*;
import java.awt.event.*;
+
import javax.swing.*;
import MCview.*;
e.printStackTrace();
}
+ JMenuItem menuItem;
if (seq != null)
{
sequenceMenu.setText(sequence.getName());
- JMenuItem menuItem;
if (seq.getDatasetSequence().getPDBId() != null
&& seq.getDatasetSequence().getPDBId().size() > 0)
{
{
public void actionPerformed(ActionEvent e)
{
- Vector seqs = new Vector();
- for (int i = 0; i < ap.av.alignment.getHeight(); i++)
- {
- Vector pdbs = ap.av.alignment.getSequenceAt(i)
- .getDatasetSequence().getPDBId();
- if (pdbs == null)
- continue;
-
- for (int p = 0; p < pdbs.size(); p++)
- {
- PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
- if (p1.getId().equals(pdb.getId()))
- {
- if (!seqs.contains(ap.av.alignment.getSequenceAt(i)))
- seqs.addElement(ap.av.alignment.getSequenceAt(i));
-
- continue;
- }
- }
- }
-
- SequenceI[] seqs2 = new SequenceI[seqs.size()];
- seqs.toArray(seqs2);
-
- new AppJmol(pdb, seqs2, null, ap);
+ // TODO re JAL-860: optionally open dialog or provide a menu entry allowing user to open just one structure per sequence
+ new AppJmol(pdb, ap.av.collateForPDB(new PDBEntry[] { pdb })[0], null, ap);
// new PDBViewer(pdb, seqs2, null, ap, AppletFormatAdapter.FILE);
}
+
});
viewStructureMenu.add(menuItem);
});
add(menuItem);
}
-
+ }
+ }
+ // for the case when no sequences are even visible
+ if (ap.av.hasHiddenRows) {
+ {
menuItem = new JMenuItem("Reveal All");
menuItem.addActionListener(new ActionListener()
{
SequenceGroup sg = ap.av.getSelectionGroup();
- if (sg != null)
+ if (sg != null&& sg.getSize()>0)
{
groupName.setText("Name: "+sg.getName());
groupName.setText("Edit name and description of current group.");
{
buildGroupURLMenu(sg, groupLinks);
}
+ // Add a 'show all structures' for the current selection
+ Hashtable<String, PDBEntry> pdbe=new Hashtable<String,PDBEntry>();
+ SequenceI sqass=null;
+ for (SequenceI sq: ap.av.getSequenceSelection())
+ {
+ Vector<PDBEntry> pes = (Vector<PDBEntry>) sq.getDatasetSequence().getPDBId();
+ if (pes!=null) {
+ for (PDBEntry pe: pes)
+ {
+ pdbe.put(pe.getId(), pe);
+ if (sqass==null)
+ {
+ sqass = sq;
+ }
+ }
+ }
+ }
+ if (pdbe.size()>0)
+ {
+ final PDBEntry[] pe = pdbe.values().toArray(new PDBEntry[pdbe.size()]);
+ final JMenuItem gpdbview;
+ if (pdbe.size()==1)
+ {
+ structureMenu.add(gpdbview=new JMenuItem("View structure for "+sqass.getDisplayId(false)));
+ } else {
+ structureMenu.add(gpdbview=new JMenuItem("View all "+pdbe.size()+" structures."));
+ }
+ gpdbview.setToolTipText("Open a new Jmol view with all structures associated with the current selection and superimpose them using the alignment.");
+ gpdbview.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new AppJmol(ap, pe, ap.av.collateForPDB(pe));
+ }
+ });
+ }
}
else
{
structureMenu.setVisible(false);
}
- if (links != null && links.size() > 0)
+ if (seq !=null && links != null && links.size() > 0)
{
JMenu linkMenu = new JMenu("Link");