- try
- {
- urlset = urlLink.makeUrlStubs(ids, seqstr,
- "FromJalview" + System.currentTimeMillis(), false);
- } catch (UrlStringTooLongException e)
- {
- }
- if (urlset != null)
- {
- int type = urlLink.getGroupURLType() & 3;
- // first two bits ofurlLink type bitfield are sequenceids and sequences
- // TODO: FUTURE: ensure the groupURL menu structure can be generalised
- addshowLink(linkMenus[type], label
- + (((type & 1) == 1) ? ("("
- + (usingNames ? "Names" : ltarget) + ")") : ""),
- urlLink, urlset);
- addMenu = true;
- }
- }
- if (addMenu)
- {
- groupLinksMenu = new JMenu(
- MessageManager.getString("action.group_link"));
- for (int m = 0; m < linkMenus.length; m++)
- {
- if (linkMenus[m] != null
- && linkMenus[m].getMenuComponentCount() > 0)
- {
- groupLinksMenu.add(linkMenus[m]);
- }
- }
-
- groupMenu.add(groupLinksMenu);
- }
- }
-
- private void addshowLinks(JMenu linkMenu, Collection<List<String>> linkset)
- {
- for (List<String> linkstrset : linkset)
- {
- // split linkstr into label and url
- addshowLink(linkMenu, linkstrset.get(1), linkstrset.get(3));
- }
- }
-
- /**
- * add a show URL menu item to the given linkMenu
- *
- * @param linkMenu
- * @param label
- * - menu label string
- * @param url
- * - url to open
- */
- private void addshowLink(JMenu linkMenu, String label, final String url)
- {
- JMenuItem item = new JMenuItem(label);
- item.setToolTipText(MessageManager.formatMessage(
- "label.open_url_param", new Object[] { url }));
- item.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- new Thread(new Runnable()
- {
-
- @Override
- public void run()
- {
- showLink(url);
- }
-
- }).start();
- }
- });
-
- linkMenu.add(item);
- }
-
- /**
- * add a late bound groupURL item to the given linkMenu
- *
- * @param linkMenu
- * @param label
- * - menu label string
- * @param urlgenerator
- * GroupURLLink used to generate URL
- * @param urlstub
- * Object array returned from the makeUrlStubs function.
- */
- private void addshowLink(JMenu linkMenu, String label,
- final GroupUrlLink urlgenerator, final Object[] urlstub)
- {
- JMenuItem item = new JMenuItem(label);
- item.setToolTipText(MessageManager.formatMessage(
- "label.open_url_seqs_param",
- new Object[] { urlgenerator.getUrl_prefix(),
- urlgenerator.getNumberInvolved(urlstub) }));
- // TODO: put in info about what is being sent.
- item.addActionListener(new ActionListener()
+ try
+ {
+ urlset = urlLink.makeUrlStubs(ids, seqstr,
+ "FromJalview" + System.currentTimeMillis(), false);
+ } catch (UrlStringTooLongException e)
+ {
+ }
+ if (urlset != null)
+ {
+ int type = urlLink.getGroupURLType() & 3;
+ // first two bits ofurlLink type bitfield are sequenceids and sequences
+ // TODO: FUTURE: ensure the groupURL menu structure can be generalised
+ addshowLink(linkMenus[type],
+ label + (((type & 1) == 1)
+ ? ("(" + (usingNames ? "Names" : ltarget) + ")")
+ : ""),
+ urlLink, urlset);
+ addMenu = true;
+ }
+ }
+ if (addMenu)