1 package jalview.ws2.actions.alignment;
4 import java.util.Objects;
6 import jalview.api.AlignViewportI;
7 import jalview.viewmodel.AlignmentViewport;
8 import jalview.ws.params.ArgumentI;
9 import jalview.ws2.actions.BaseAction;
10 import jalview.ws2.actions.BaseTask;
11 import jalview.ws2.actions.PollingTaskExecutor;
12 import jalview.ws2.actions.api.TaskEventListener;
13 import jalview.ws2.actions.api.TaskI;
14 import jalview.ws2.api.Credentials;
15 import jalview.ws2.client.api.AlignmentWebServiceClientI;
18 * Implementation of the {@link BaseAction} that runs alignment services. This
19 * type of action requires {@link AlignmentWebServiceClientI} to retrieve
20 * alignment result from the server.
25 public class AlignmentAction extends BaseAction<AlignmentResult>
28 * A builder for AlignemntActions. Adds {@code client} and {@code submitGaps}
29 * parameters to the base builder.
33 public static class Builder extends BaseAction.Builder<AlignmentAction>
35 protected AlignmentWebServiceClientI client;
37 protected boolean submitGaps = false;
39 public Builder(AlignmentWebServiceClientI client)
42 Objects.requireNonNull(client);
46 public void submitGaps(boolean val)
51 public AlignmentAction build()
53 return new AlignmentAction(this);
57 public static Builder newBuilder(AlignmentWebServiceClientI client)
59 return new Builder(client);
62 protected final boolean submitGaps;
64 protected final AlignmentWebServiceClientI client;
66 public AlignmentAction(Builder builder)
69 submitGaps = builder.submitGaps;
70 client = builder.client;
74 public AlignmentTask createTask(AlignViewportI viewport,
75 List<ArgumentI> args, Credentials credentials)
77 return new AlignmentTask(
78 client, this, args, credentials, viewport, submitGaps);
82 * Returns if the action is active for the given viewport. Alignment services
83 * are non-interactive, so the action is never active.
86 public boolean isActive(AlignmentViewport viewport)