From b0e1b14e744426d4dbd682805aa8f3f2d5747e53 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 10 Nov 2005 11:05:24 +0000 Subject: [PATCH] PDB implementation updated --- src/jalview/gui/PopupMenu.java | 66 ++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 6055230..b9d379c 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -63,7 +63,6 @@ public class PopupMenu extends JPopupMenu JMenuItem sequenceName = new JMenuItem(); Sequence sequence; JMenuItem unGroupMenuItem = new JMenuItem(); - JMenuItem pdbMenuItem = new JMenuItem(); JMenuItem outline = new JMenuItem(); JRadioButtonMenuItem nucleotideMenuItem = new JRadioButtonMenuItem(); JMenu colourMenu = new JMenu(); @@ -77,7 +76,7 @@ public class PopupMenu extends JPopupMenu * @param ap DOCUMENT ME! * @param seq DOCUMENT ME! */ - public PopupMenu(AlignmentPanel ap, Sequence seq) + public PopupMenu(final AlignmentPanel ap, Sequence seq) { /////////////////////////////////////////////////////////// // If this is activated from the sequence panel, the user may want to @@ -112,9 +111,27 @@ public class PopupMenu extends JPopupMenu e.printStackTrace(); } - if ((seq == null) || (seq.getPDBId() == null)) + + if ((seq != null) + && seq.getDatasetSequence().getPDBId() != null) { - pdbMenuItem.setVisible(false); + java.util.Enumeration e = seq.getDatasetSequence().getPDBId().elements(); + while(e.hasMoreElements()) + { + + final PDBEntry pdb = (PDBEntry)e.nextElement(); + JMenuItem pdbMenuItem = new JMenuItem(); + pdbMenuItem.setText("View PDB entry: "+pdb.getId()); + pdbMenuItem.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + PDBViewer viewer = new PDBViewer(pdb, sequence, ap.seqPanel.seqCanvas); + } + }); + sequenceMenu.add(pdbMenuItem); + } + } SequenceGroup sg = ap.av.getSelectionGroup(); @@ -261,14 +278,7 @@ public class PopupMenu extends JPopupMenu unGroupMenuItem_actionPerformed(e); } }); - pdbMenuItem.setText("View PDB structure"); - pdbMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - pdbMenuItem_actionPerformed(e); - } - }); + outline.setText("Border colour"); outline.addActionListener(new java.awt.event.ActionListener() { @@ -325,7 +335,6 @@ public class PopupMenu extends JPopupMenu groupMenu.addSeparator(); groupMenu.add(outline); sequenceMenu.add(sequenceName); - sequenceMenu.add(pdbMenuItem); colourMenu.add(noColourmenuItem); colourMenu.add(clustalColour); colourMenu.add(BLOSUM62Colour); @@ -830,37 +839,6 @@ public class PopupMenu extends JPopupMenu refresh(); } - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - void pdbMenuItem_actionPerformed(ActionEvent e) - { - if (sequence.getPDBId() == null) - { - return; - } - - try - { - EBIFetchClient ebi = new EBIFetchClient(); - String[] result = ebi.fetchData("pdb:" + sequence.getPDBId(), null, - null); - - PDBfile pdb = new PDBfile(result); - - rotCanvas rc = new rotCanvas(pdb, sequence, ap.av); - JInternalFrame frame = new JInternalFrame(); - frame.setContentPane(rc); - Desktop.addInternalFrame(frame, - sequence.getName() + " " + sequence.getPDBId(), 400, 400); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } /** * DOCUMENT ME! -- 1.7.10.2