import jalview.util.MessageManager;
import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.dm.AAConSettings;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.AutoCalcSetting;
import jalview.ws.uimodel.AlignAnalysisUIText;
@Override
public void actionPerformed(ActionEvent arg0)
{
+
List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
- .getCalcManager()
- .getRegisteredWorkersOfClass(aaui.getClient());
- if (aaconClient != null && aaconClient.size() > 0)
- {
- removeCurrentAAConWorkerFor(aaui, alignFrame);
- }
- else
+ .getCalcManager().getRegisteredWorkersOfClass(
+ SeqAnnotationServiceCalcWorker.class);
+ if (aaconClient != null)
{
- buildCurrentAAConWorkerFor(aaui, alignFrame);
-
+ for (AlignCalcWorkerI worker : aaconClient)
+ {
+ if (((SeqAnnotationServiceCalcWorker) worker).getService()
+ .getClass().equals(aaui.getClient()))
+ {
+ removeCurrentAAConWorkerFor(aaui, alignFrame);
+ return;
+ }
+ }
}
+ buildCurrentAAConWorkerFor(aaui, alignFrame);
}
});
boolean serviceEnabled = false;
if (aaconClient != null)
{
+ // NB code duplicatino again!
for (AlignCalcWorkerI _worker : aaconClient)
{
SeqAnnotationServiceCalcWorker worker = (SeqAnnotationServiceCalcWorker) _worker;
throw new Error(
MessageManager.getString("error.no_aacon_service_found"));
}
- return new AAConSettings(true, service, null, null);
+ return service instanceof Jws2Instance
+ ? new AAConSettings(true, service, null, null)
+ : new AutoCalcSetting(service, null, null, true);
}
private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui,
import java.util.ArrayList;
import java.util.List;
-public abstract class AutoCalcSetting
+public class AutoCalcSetting
{
protected boolean autoUpdate;
}
/**
+ * default WsParamFile generator method - clients with custom formats should
+ * override and implement their own
*
* @return stringified representation of the parameters for this setting
*/
- public abstract String getWsParamFile();
-
+ public String getWsParamFile()
+ {
+ List<ArgumentI> opts = null;
+ if (jobArgset != null)
+ {
+ opts = jobArgset;
+ }
+ else
+ {
+ if (preset != null)
+ {
+ opts = preset.getArguments();
+ }
+ }
+ if (opts == null || opts.size() == 0)
+ {
+ return "";
+ }
+ StringBuffer pset = new StringBuffer();
+ for (ArgumentI ps : opts)
+ {
+ pset.append(ps.getName() + "\t" + ps.getValue());
+ pset.append("\n");
+ }
+ return pset.toString();
+ }
public ServiceWithParameters getService()
{
return service;