JAL-3878 Add RNAalifold service discovery.
[jalview.git] / src / jalview / ws2 / operations / AnnotationOperation.java
1 package jalview.ws2.operations;
2
3 import java.util.ArrayList;
4 import java.util.Collections;
5 import java.util.List;
6 import java.util.concurrent.CompletionStage;
7
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;
13
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;
31
32 /**
33  *
34  * @author mmwarowny
35  *
36  */
37 public class AnnotationOperation implements Operation
38 {
39   final WebServiceI service;
40
41   final String typeName;
42
43   final ResultSupplier<List<AlignmentAnnotation>> annotationSupplier;
44
45   final ResultSupplier<FeaturesFile> featuresSupplier;
46
47   boolean alignmentAnalysis = false;
48
49   boolean interactive = false;
50
51   private boolean isProtOperation = true;
52
53   private boolean isNucOperation = true;
54
55   /*
56    * Is it fine to get rid of AlignAnalysisUIText?
57    */
58
59   public AnnotationOperation(WebServiceI service,
60       ResultSupplier<List<AlignmentAnnotation>> annotSupplier,
61       ResultSupplier<FeaturesFile> featSupplier, String operationName)
62   {
63     this.service = service;
64     this.annotationSupplier = annotSupplier;
65     this.featuresSupplier = featSupplier;
66     this.typeName = operationName;
67   }
68
69   @Override
70   public String getName()
71   {
72     return service.getName();
73   }
74
75   @Override
76   public String getDescription()
77   {
78     return service.getDescription();
79   }
80
81   @Override
82   public String getTypeName()
83   {
84     return typeName;
85   }
86
87   @Override
88   public String getHostName()
89   {
90     return service.getHostName();
91   }
92
93   @Override
94   public boolean hasParameters()
95   {
96     return service.hasParameters();
97   }
98
99   @Override
100   public ParamDatastoreI getParamStore()
101   {
102     return service.getParamStore();
103   }
104
105   @Override
106   public int getMinSequences()
107   {
108     return 0;
109   }
110
111   @Override
112   public int getMaxSequences()
113   {
114     return Integer.MAX_VALUE;
115   }
116
117   @Override
118   public boolean canSubmitGaps()
119   {
120     return false;
121   }
122
123   @Override
124   public boolean isProteinOperation()
125   {
126     return isProtOperation;
127   }
128
129   public void setProteinOperation(boolean value)
130   {
131     isProtOperation = value;
132   }
133
134   @Override
135   public boolean isNucleotideOperation()
136   {
137     return isNucOperation;
138   }
139
140   public void setNucleotideOperation(boolean value)
141   {
142     isNucOperation = value;
143   }
144
145   @Override
146   public boolean isInteractive()
147   {
148     return interactive;
149   }
150
151   public void setInteractive(boolean value)
152   {
153     this.interactive = value;
154   }
155
156   @Override
157   public boolean isAlignmentAnalysis()
158   {
159     return alignmentAnalysis;
160   }
161
162   public void setAlignmentAnalysis(boolean value)
163   {
164     this.alignmentAnalysis = value;
165   }
166
167   @Override
168   public boolean getFilterNonStandardSymbols()
169   {
170     return false;
171   }
172
173   @Override
174   public boolean getNeedsAlignedSequences()
175   {
176     return false;
177   }
178
179   @Override
180   public MenuEntryProviderI getMenuBuilder()
181   {
182     return new AnnotationMenuBuilder(this);
183   }
184
185 }