final JMenu seqsrchmenu = new JMenu(
"Sequence Database Search");
final JMenu analymenu = new JMenu(
- "Analyse Alignment");
+ "Analysis");
if (Cache.getDefault("SHOW_JWS1_SERVICES", true)
&& Discoverer.services != null
{
if (jws2servs.hasServices())
{
- JMenu jws2men = new JMenu("Jaba Web Services");
jws2servs.attachWSMenuEntry(msawsmenu, me);
-// for (int i = 0, iSize = jws2men.getMenuComponentCount(); i < iSize; i++)
-// {
-// msawsmenu.add(jws2men.getMenuComponent(i));
-// }
}
}
}
- if (msawsmenu.getMenuComponentCount()>0)
- wsmenu.add(msawsmenu);
- if (secstrmenu.getMenuComponentCount()>0)
- wsmenu.add(secstrmenu);
- if (analymenu.getMenuComponentCount()>0)
- wsmenu.add(analymenu);
- if (seqsrchmenu.getMenuComponentCount()>0)
- wsmenu.add(seqsrchmenu);
+ // Add all submenus in the order they should appear on the web services menu
+ wsmenu.add(msawsmenu);
+ wsmenu.add(secstrmenu);
+ wsmenu.add(analymenu);
+ // No search services yet
+ // wsmenu.add(seqsrchmenu);
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
{
try
{
-
- resetWebServiceMenu();
- // finally, add the whole shebang onto the webservices menu
+ webService.removeAll();
+ // first, add discovered services onto the webservices menu
if (wsmenu.size() > 0)
{
for (int i = 0, j = wsmenu.size(); i < j; i++)
}
else
{
- me.webService.add(me.webServiceNoServices);
+ webService.add(me.webServiceNoServices);
}
+ build_urlServiceMenu(me.webService);
+ build_fetchdbmenu(webService);
} catch (Exception e)
{
}
}
- /**
- * empty the web service menu and add any ad-hoc functions not dynamically
- * discovered.
- *
- */
- private void resetWebServiceMenu()
- {
- webService.removeAll();
- build_fetchdbmenu(webService);
- build_urlServiceMenu(webService);
- }
/**
* construct any groupURL type service menu entries.
*/
private void build_urlServiceMenu(JMenu webService)
{
- if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
- {
- jalview.ws.EnfinEnvision2OneWay.getInstance().attachWSMenuEntry(
- webService, this);
- }
// TODO: remove this code when 2.7 is released
// DEBUG - alignmentView
/*
// TODO: refactor to RestClient discoverer and merge menu entries for
// rest-style services with other types of analysis/calculation service
// SHmmr test client - still being implemented.
+ // DEBUG - alignmentView
for (jalview.ws.rest.RestClient client: jalview.ws.rest.RestClient.getRestClients()) {
client.attachWSMenuEntry(JvSwingUtils.findOrCreateMenu(webService, client.getAction()), this);
}
- // DEBUG - alignmentView
+
+ if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
+ {
+ jalview.ws.EnfinEnvision2OneWay.getInstance().attachWSMenuEntry(
+ webService, this);
+ }
}
/*
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JMenu;
+import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
return getLabelFont(false,false);
}
+ /**
+ * clean up a swing menu.
+ * Removes any empty submenus without selection listeners.
+ * @param webService
+ */
+ public static void cleanMenu(JMenu webService)
+ {
+ for (int i=0;i<webService.getItemCount(); )
+ {
+ JMenuItem item = webService.getItem(i);
+ if (item instanceof JMenu && ((JMenu)item).getItemCount()==0)
+ {
+ webService.remove(i);
+ } else {
+ i++;
+ }
+ }
+ }
+
}