From: jprocter Date: Tue, 9 Feb 2010 17:37:02 +0000 (+0000) Subject: groupURL link prototype X-Git-Tag: Release_2_5~144 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=298ac6df4e5542ba4d5aa635831537e8dd887084;p=jalview.git groupURL link prototype --- diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index b5c2186..52ac6ad 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -330,7 +330,7 @@ public class IdPanel extends JPanel implements MouseListener, jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel, sq, - nlinks); + nlinks, new Vector(Preferences.groupURLLinks)); pop.show(this, e.getX(), e.getY()); return; diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 1b0391d..457638a 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -30,6 +30,7 @@ import jalview.commands.*; import jalview.datamodel.*; import jalview.io.*; import jalview.schemes.*; +import jalview.util.GroupUrlLink; import jalview.util.UrlLink; /** @@ -133,6 +134,8 @@ public class PopupMenu extends JPopupMenu // JMenuItem annotationMenuItem = new JMenuItem(); + JMenu groupLinksMenu; + /** * Creates a new PopupMenu object. * @@ -141,7 +144,18 @@ public class PopupMenu extends JPopupMenu * @param seq * DOCUMENT ME! */ - public PopupMenu(final AlignmentPanel ap, Sequence seq, Vector links) + public PopupMenu(final AlignmentPanel ap, Sequence seq, Vector links) + { + this(ap, seq, links, null); + } + /** + * + * @param ap + * @param seq + * @param links + * @param groupLinks + */ + public PopupMenu(final AlignmentPanel ap, Sequence seq, Vector links, Vector groupLinks) { // ///////////////////////////////////////////////////////// // If this is activated from the sequence panel, the user may want to @@ -384,6 +398,10 @@ public class PopupMenu extends JPopupMenu showText.setSelected(sg.getDisplayText()); showColourText.setSelected(sg.getColourText()); showBoxes.setSelected(sg.getDisplayBoxes()); + // add any groupURLs to the groupURL submenu and make it visible + if (groupLinks!=null && groupLinks.size()>0) { + buildGroupURLMenu(sg, groupLinks); + } } else { @@ -404,6 +422,7 @@ public class PopupMenu extends JPopupMenu if (links != null && links.size() > 0) { + JMenu linkMenu = new JMenu("Link"); Vector linkset = new Vector(); for (int i = 0; i < links.size(); i++) @@ -521,6 +540,122 @@ public class PopupMenu extends JPopupMenu } } } + + private void buildGroupURLMenu(SequenceGroup sg, Vector groupLinks) + { + + // TODO: usability: thread off the generation of group url content so root menu appears asap + // sequence only URLs + // ID/regex match URLs + groupLinksMenu = new JMenu("Group Link"); + JMenu[] linkMenus = new JMenu[] { null, new JMenu("IDS"), new JMenu("Sequences"), new JMenu("IDS and Sequences")}; // three types of url that might be created. + SequenceI[] seqs = ap.av.getSelectionAsNewSequence(); + String[][] idandseqs = GroupUrlLink.formStrings(seqs); + Hashtable commonDbrefs = new Hashtable(); + for (int sq = 0; sq0) + { + for (int d=0;d0) + { + groupLinksMenu.add(linkMenus[m]); + } + } + + groupMenu.add(groupLinksMenu); + } + } /** * add a show URL menu item to the given linkMenu