import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.WsParamSetI;
import jalview.ws.seqfetcher.DbSourceProxy;
-import jalview.ws.slivkaws.SlivkaWSDiscoverer;
+import jalview.ws2.client.api.WebServiceDiscovererI;
+import jalview.ws2.client.slivka.SlivkaWSDiscoverer;
+import jalview.ws2.gui.WebServicesMenuManager;
+
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
buildWebServicesMenu();
}
+ private WebServiceDiscovererI.ServicesChangeListener slivkaServiceChangeListener =
+ (discoverer, services) -> {
+ // run when slivka services change
+ var menu = AlignFrame.this.slivkaMenu;
+ menu.setServices(discoverer);
+ menu.setInProgress(discoverer.isRunning());
+ menu.setNoServices(services.isEmpty() && discoverer.isDone());
+ };
+
/* Set up intrinsic listeners for dynamically generated GUI bits. */
private void addServiceListeners()
{
if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true))
{
- WSDiscovererI discoverer = SlivkaWSDiscoverer.getInstance();
- discoverer.addServiceChangeListener(this);
+ WebServiceDiscovererI discoverer = SlivkaWSDiscoverer.getInstance();
+ discoverer.addServicesChangeListener(slivkaServiceChangeListener);
}
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
@Override
public void internalFrameClosed(InternalFrameEvent e) {
System.out.println("deregistering discoverer listener");
- SlivkaWSDiscoverer.getInstance().removeServiceChangeListener(AlignFrame.this);
+ SlivkaWSDiscoverer.getInstance().removeServicesChangeListener(slivkaServiceChangeListener);
Jws2Discoverer.getInstance().removeServiceChangeListener(AlignFrame.this);
Desktop.getInstance().removeJalviewPropertyChangeListener("services", legacyListener);
closeMenuItem_actionPerformed(true);
return tp;
}
+ private WebServicesMenuManager slivkaMenu = new WebServicesMenuManager("slivka", this);
+
/**
* Schedule the web services menu rebuild to the event dispatch thread.
*/
{
Cache.log.info("Building web service menu for slivka");
SlivkaWSDiscoverer discoverer = SlivkaWSDiscoverer.getInstance();
- JMenu submenu = new JMenu("Slivka");
- buildWebServicesMenu(discoverer, submenu);
- webService.add(submenu);
+ slivkaMenu.setServices(discoverer);
+ slivkaMenu.setInProgress(discoverer.isRunning());
+ slivkaMenu.setNoServices(discoverer.isDone() && !discoverer.hasServices());
+ webService.add(slivkaMenu.getMenu());
}
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
buildWebServicesMenu(jws2servs, submenu);
webService.add(submenu);
}
+ build_urlServiceMenu(webService);
build_fetchdbmenu(webService);
});
}