--- /dev/null
+package jalview.ws2.actions.annotation;
+
+import java.util.List;
+import java.util.Objects;
+
+import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.params.ArgumentI;
+import jalview.ws2.actions.BaseAction;
+import jalview.ws2.actions.api.TaskEventListener;
+import jalview.ws2.actions.api.TaskI;
+import jalview.ws2.api.Credentials;
+import jalview.ws2.client.api.AnnotationWebServiceClientI;
+
+public class AnnotationAction extends BaseAction<AnnotationResult>
+{
+ /**
+ * A builder of {@link AnnotationAction} instances.
+ */
+ public static class Builder extends BaseAction.Builder<AnnotationAction>
+ {
+ protected AnnotationWebServiceClientI client;
+
+ protected boolean alignmentAnalysis = false;
+
+ protected boolean requireAlignedSequences = false;
+
+ protected boolean filterSymbols = true;
+
+ public Builder(AnnotationWebServiceClientI client)
+ {
+ super();
+ Objects.requireNonNull(client);
+ this.client = client;
+ }
+
+ /**
+ * Set if action is an alignment analysis action.
+ */
+ public void alignmentAnalysis(boolean val)
+ {
+ alignmentAnalysis = val;
+ }
+
+ /**
+ * Set if action require aligned sequences.
+ */
+ public void requireAlignedSequences(boolean val)
+ {
+ requireAlignedSequences = val;
+ }
+
+ /**
+ * Set if action requires non-standard residues to be filtered out
+ */
+ public void filterSymbols(boolean val)
+ {
+ filterSymbols = val;
+ }
+
+ public AnnotationAction build()
+ {
+ return new AnnotationAction(this);
+ }
+ }
+
+ public static Builder newBuilder(AnnotationWebServiceClientI client)
+ {
+ return new Builder(client);
+ }
+
+ protected final AnnotationWebServiceClientI client;
+
+ protected final boolean alignmentAnalysis;
+
+ protected final boolean requireAlignedSequences;
+
+ protected final boolean filterSymbols;
+
+ protected AnnotationAction(Builder builder)
+ {
+ super(builder);
+ client = builder.client;
+ alignmentAnalysis = builder.alignmentAnalysis;
+ requireAlignedSequences = builder.requireAlignedSequences;
+ filterSymbols = builder.filterSymbols;
+ }
+
+ @Override
+ public TaskI<AnnotationResult> perform(AlignmentViewport viewport,
+ List<ArgumentI> args, Credentials credentials,
+ TaskEventListener<AnnotationResult> handler)
+ {
+ var task = new AnnotationTask(client, this, args, credentials, viewport,
+ handler);
+ task.start(viewport.getCalcManager());
+ return task;
+ }
+
+ /**
+ * Return if this action is an alignment analysis service.
+ */
+ public boolean isAlignmentAnalysis()
+ {
+ return alignmentAnalysis;
+ }
+
+ /**
+ * Return if this action require sequences to be aligned.
+ */
+ public boolean getRequireAlignedSequences()
+ {
+ return requireAlignedSequences;
+ }
+
+ /**
+ * Return if this action require non-standard symbols to be filtered out.
+ */
+ public boolean getFilterSymbols()
+ {
+ return filterSymbols;
+ }
+
+ @Override
+ public boolean isActive(AlignmentViewport viewport)
+ {
+ return false;
+ }
+}