1 package jalview.ws2.operations;
3 import java.util.ArrayList;
4 import java.util.Collections;
6 import java.util.concurrent.CompletionStage;
8 import javax.swing.JCheckBoxMenuItem;
9 import javax.swing.JMenu;
10 import javax.swing.JMenuItem;
11 import javax.swing.event.MenuEvent;
12 import javax.swing.event.MenuListener;
14 import jalview.api.AlignCalcManagerI2;
15 import jalview.api.AlignmentViewPanel;
16 import jalview.datamodel.AlignmentAnnotation;
17 import jalview.gui.AlignFrame;
18 import jalview.gui.AlignViewport;
19 import jalview.gui.WsJobParameters;
20 import jalview.io.FeaturesFile;
21 import jalview.util.Format;
22 import jalview.util.MessageManager;
23 import jalview.ws.params.ArgumentI;
24 import jalview.ws.params.ParamDatastoreI;
25 import jalview.ws.params.WsParamSetI;
26 import jalview.ws2.MenuEntryProviderI;
27 import jalview.ws2.ResultSupplier;
28 import jalview.ws2.PollingTaskExecutor;
29 import jalview.ws2.WebServiceI;
30 import jalview.ws2.gui.AnnotationMenuBuilder;
37 public class AnnotationOperation implements Operation
39 final WebServiceI service;
41 final String typeName;
43 final ResultSupplier<List<AlignmentAnnotation>> annotationSupplier;
45 final ResultSupplier<FeaturesFile> featuresSupplier;
47 boolean alignmentAnalysis = false;
49 boolean interactive = false;
52 * Is it fine to get rid of AlignAnalysisUIText?
55 public AnnotationOperation(WebServiceI service,
56 ResultSupplier<List<AlignmentAnnotation>> annotSupplier,
57 ResultSupplier<FeaturesFile> featSupplier, String operationName)
59 this.service = service;
60 this.annotationSupplier = annotSupplier;
61 this.featuresSupplier = featSupplier;
62 this.typeName = operationName;
66 public String getName()
68 return service.getName();
72 public String getDescription()
74 return service.getDescription();
78 public String getTypeName()
84 public String getHostName()
86 return service.getHostName();
90 public boolean hasParameters()
92 return service.hasParameters();
96 public ParamDatastoreI getParamStore()
98 return service.getParamStore();
102 public int getMinSequences()
108 public int getMaxSequences()
110 return Integer.MAX_VALUE;
114 public boolean canSubmitGaps()
120 public boolean isProteinOperation()
126 public boolean isNucleotideOperation()
132 public boolean isInteractive()
137 public void setInteractive(boolean value)
139 this.interactive = value;
143 public boolean isAlignmentAnalysis()
145 return alignmentAnalysis;
148 public void setAlignmentAnalysis(boolean value)
150 this.alignmentAnalysis = value;
154 public boolean getFilterNonStandardSymbols()
160 public boolean getNeedsAlignedSequences()
166 public MenuEntryProviderI getMenuBuilder()
168 return new AnnotationMenuBuilder(this);
172 private CompletionStage<List<ArgumentI>> openEditParamsDialog(
173 WebServiceI service, WsParamSetI preset, List<ArgumentI> arguments)
175 WsJobParameters jobParams;
176 if (preset == null && arguments != null && arguments.size() > 0)
177 jobParams = new WsJobParameters(service.getParamStore(), preset,
180 jobParams = new WsJobParameters(service.getParamStore(), preset,
184 jobParams.setName(MessageManager.getString(
185 "label.adjusting_parameters_for_calculation"));
187 var stage = jobParams.showRunDialog();
188 return stage.thenApply((startJob) -> {
191 if (jobParams.getPreset() == null)
192 return jobParams.getJobParams();
194 return jobParams.getPreset().getArguments();