From 31ee6e439fa0e6432e812089e092df0cee1eb223 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 23 Sep 2019 09:15:32 +0100 Subject: [PATCH] =?utf8?q?JAL-3070=20match=20AbstractJabaCalcWorker=E2=80=99?= =?utf8?q?s=20annotation=20service=20interface=20with=20class=20from=20the=20?= =?utf8?q?aaui=20field=20to=20enable/disable=20tick=20box?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/ws/jws2/AbstractJabaCalcWorker.java | 6 ++++++ src/jalview/ws/jws2/Jws2ClientFactory.java | 26 ++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java index 422b4ef..fae8089 100644 --- a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java +++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java @@ -39,6 +39,7 @@ import jalview.util.MessageManager; import jalview.workers.AlignCalcWorker; import jalview.ws.api.CancellableI; import jalview.ws.api.JobId; +import jalview.ws.api.SequenceAnnotationServiceI; import jalview.ws.api.WSAnnotationCalcManagerI; import jalview.ws.gui.AnnotationWsJob; import jalview.ws.jws2.dm.AAConSettings; @@ -763,4 +764,9 @@ public class AbstractJabaCalcWorker extends AlignCalcWorker } } + public SequenceAnnotationServiceI getService() + { + return annotService; + } + } diff --git a/src/jalview/ws/jws2/Jws2ClientFactory.java b/src/jalview/ws/jws2/Jws2ClientFactory.java index 4af8124..2a3b4a5 100644 --- a/src/jalview/ws/jws2/Jws2ClientFactory.java +++ b/src/jalview/ws/jws2/Jws2ClientFactory.java @@ -134,18 +134,28 @@ public class Jws2ClientFactory { aaConEnabled.setEnabled(false); modifyParams.setEnabled(false); + return; } List aaconClient = alignFrame.getViewport() - .getCalcManager() - .getRegisteredWorkersOfClass(aaui.getClient()); - if (aaconClient != null && aaconClient.size() > 0) - { - aaConEnabled.setSelected(true); - } - else + .getCalcManager().getRegisteredWorkersOfClass( + AbstractJabaCalcWorker.class); + + boolean serviceEnabled = false; + if (aaconClient != null) { - aaConEnabled.setSelected(false); + for (AlignCalcWorkerI _worker : aaconClient) + { + AbstractJabaCalcWorker worker = (AbstractJabaCalcWorker) _worker; + // this could be cleaner ? + if (worker.hasService() + && aaui.getClient() + .equals(worker.getService().getClass())) + { + serviceEnabled = true; + } + } } + aaConEnabled.setSelected(serviceEnabled); } @Override -- 1.7.10.2