public abstract static class DocumentOperation.Wrapper extends DocumentOperation
DocumentOperation.getUniqueId()) to the wrapped operation.DocumentOperation.OperationCallback, DocumentOperation.Wrapper| Modifier | Constructor and Description |
|---|---|
protected |
DocumentOperation.Wrapper(DocumentOperation wrappedOperation)
Constructs a new wrapper operation
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRunOnGeneiousServer()
Returns true if this operation supports being run on a GeneiousServer.
|
boolean |
canRunOnLocalGeneious() |
GeneiousActionOptions |
getActionOptions()
GeneiousActionOptions contains all the important status information including
name, description, icon, where the action is displayed in the interface etc.
|
double |
getFractionOfTimeToSaveResults()
Returns an approximate fraction of the total operation time which will probably be required to save the generated document(s).
|
Options |
getGeneralOptions()
Gets some Options that work for this document operation when invoked on any set of input sequences.
|
String |
getHelp()
Help for this operation in the form of HTML or plain text.
|
Options |
getOptions(AnnotatedPluginDocument... documents)
Provides some options applicable to this document operation to the user.
|
Options |
getOptions(DocumentOperationInput operationInput)
More powerful alternative to
DocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[])
which may provide additional values such as the location the operation is run and the
currently selected region of any sequence in the documents. |
Options |
getOptions(org.jdom.Element optionsElement,
List<AnnotatedPluginDocument> inputDocuments,
List<AnnotatedPluginDocument> additionalParentDocuments)
Recreates some options for rerunning an earlier operation to recreate descendant documents.
|
Options |
getOptions(SequenceSelection sequenceSelection,
AnnotatedPluginDocument... documents)
More powerful alternative to
DocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[])
which may provide the currently selected region of any sequence in the documents. |
String |
getOrderDependentOperationMessage()
Support for operations caring about the order of similarily typed documents.
|
DocumentSelectionSignature[] |
getSelectionSignatures()
Specifies the type of documents this operation accepts as input.
|
boolean |
isDocumentGenerator()
Does this DocumentOperation generate documents? (i.e.
|
boolean |
loadDocumentsBeforeRunningOperation()
Returns true if this operation requires that the caller load the
PluginDocuments of all input
AnnotatedPluginDocuments and the PluginDocuments of all referenced AnnotatedPluginDocuments
into memory before invoking performOperation. |
boolean |
loadDocumentsBeforeShowingOptions()
Returns true if this operation requires that the caller load the
PluginDocuments of all input
AnnotatedPluginDocuments and the PluginDocuments of all referenced AnnotatedPluginDocuments
into memory before invoking getOptions. |
List<AnnotatedPluginDocument> |
performOperation(AnnotatedPluginDocument[] annotatedDocuments,
ProgressListener progressListener,
Options options)
Create document(s) from a set of documents.
|
List<AnnotatedPluginDocument> |
performOperation(AnnotatedPluginDocument[] annotatedDocuments,
ProgressListener progressListener,
Options options,
SequenceSelection sequenceSelection)
|
void |
performOperation(AnnotatedPluginDocument[] annotatedDocuments,
ProgressListener progressListener,
Options options,
SequenceSelection sequenceSelection,
DocumentOperation.OperationCallback callback)
Do not use.
|
getLocationOptions, getOptions, getUniqueId, performOperation, performOperationprotected DocumentOperation.Wrapper(DocumentOperation wrappedOperation)
wrappedOperation - the oepration to wrappublic GeneiousActionOptions getActionOptions()
DocumentOperationgetActionOptions in class DocumentOperationpublic String getHelp()
DocumentOperationOptions.getOptionsHelp()
on the Options returned from getOptionsgetHelp in class DocumentOperationOptions.getOptionsHelp()public DocumentSelectionSignature[] getSelectionSignatures()
DocumentOperation
return new DocumentSelectionSignature[] {new DocumentSelectionSignature(NucleotideSequenceDocument.class,1,2)}}
DocumentSelectionSignature.forNucleotideSequences(int, int, boolean) instead
when the operation may accept either stand-alone sequences or SequenceListDocuments
as input.
If an operation accepts no documents as input, it should return an empty array and the operation will
always be enabled but won't be passed any documents as input.getSelectionSignatures in class DocumentOperationpublic Options getOptions(AnnotatedPluginDocument... documents) throws DocumentOperationException
DocumentOperationDocumentOperation.performOperation(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[], jebl.util.ProgressListener, com.biomatters.geneious.publicapi.plugin.Options) will not be called
The same Options object will be passed to performOperation if the user clicks "Ok". The necessary values
can then be extracted from it.
Example 1: Use Options class directly.
public Options getOptions(final AnnotatedPluginDocument[] documents) throws DocumentOperationException {
Options options = new Options(getClass());
options.addBooleanOption("optionName", "text displayed the user", true);
return options;
}
public List<AnnotatedPluginDocument> performOperation(AnnotatedPluginDocument[] documentListx,
ProgressListener progressListener, Options options) throws DocumentOperationException {
boolean checkboxSelected=(Boolean)options.getValue("optionName");
...
}
Example 2: Subclass Options. Useful for more complicated options where you want to improve code separation and avoid referring to options via their String names.
private static class MyOptions extends Options {
private BooleanOption sampleOption;
public MyOptions() {
sampleOption=addBooleanOption("sampleOption", "text displayed the user", true);
}
public boolean isSampleOption() {
return sampleOption.getValue();
}
}
public Options getOptions(final AnnotatedPluginDocument[] documents) throws DocumentOperationException {
return new MyOptions();
}
public List<AnnotatedPluginDocument> performOperation(AnnotatedPluginDocument[] documentList, ProgressListener progressListener, Options options) throws DocumentOperationException {
MyOptions myOptions= (MyOptions) options; // Since an instance of MyOptions is always returned from getOptions, this cast is always valid.
boolean sampleOptionSelected = myOptions.isSampleOption();
...
}
For more information, see Options.
This method may be invoked from either the swing thread or a non-swing thread.getOptions in class DocumentOperationdocuments - the currently selected documents so that the panel can contain different
options depending on these. This can be ignored in most cases.DocumentOperationException - if obtaining the options for this operation is unsuccessful for any reasonpublic Options getOptions(SequenceSelection sequenceSelection, AnnotatedPluginDocument... documents) throws DocumentOperationException
DocumentOperationDocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[])
which may provide the currently selected region of any sequence in the documents. eg. if a region of a sequence
is slected in the Sequence View then the selection will be passed in.
This method may be invoked from either the swing thread or a non-swing thread.getOptions in class DocumentOperationsequenceSelection - the currently selected region of any sequence in the documents, never null but may be an empty selectiondocuments - the currently selected documents so that the panel can contain different
options depending on these. This can be ignored in most cases.DocumentOperationException - if the obtaining the options for this operation is unsuccessful for any reasonDocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[])public Options getOptions(DocumentOperationInput operationInput) throws DocumentOperationException
DocumentOperationDocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[])
which may provide additional values such as the location the operation is run and the
currently selected region of any sequence in the documents. eg. if a region of a sequence is selected in the Sequence View then the selection will be passed in.
Operations that have Options that need to change state depending on which GeneiousService
the operation is run on should implement this method and register a listener on
the results of DocumentOperationInput.getLocationOptions() by calling OperationLocationOptions.addLocationChangedListener(com.biomatters.geneious.publicapi.plugin.OperationLocationOptions.LocationChangedListener)
This method may be invoked from either the swing thread or a non-swing thread.getOptions in class DocumentOperationoperationInput - the data being used as input to the operation. This contains information such as the selected documents.DocumentOperationException - if the obtaining the options for this operation is unsuccessful for any reasonDocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[])public Options getGeneralOptions() throws DocumentOperationException
DocumentOperationgetGeneralOptions in class DocumentOperationOptions.valuesToXML(String) and Options.valuesFromXML(org.jdom.Element)DocumentOperationException - if this document operation does not support general options.public String getOrderDependentOperationMessage()
DocumentOperationgetOrderDependentOperationMessage in class DocumentOperationpublic List<AnnotatedPluginDocument> performOperation(AnnotatedPluginDocument[] annotatedDocuments, ProgressListener progressListener, Options options) throws DocumentOperationException
DocumentOperationdocuments
to save a handle for the constructing set.
Note: The operation will be run in a non AWT thread. If you need to perform user interface
interaction in addition to the options provided in the optionsPanel (for example prompting for user input)
then you need to place this inside a ThreadUtilities.invokeAndWait() function call.
WARNING: Geneious may call this function multiple times simultaneously.
Therefore, any implementation should not store its internal state
within instance fields.performOperation in class DocumentOperationannotatedDocuments - the documents to apply the operation to. These must be the same documents as those passed to DocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[]).progressListener - report progress for slow operations. If the progressListener requests that the operation cancels, the operation may choose to throw a DocumentOperationException.Canceledoptions - the options returned from getOptionsDocumentUtilities.createAnnotatedPluginDocument(com.biomatters.geneious.publicapi.documents.PluginDocument)DocumentOperationException - when something goes wrong.public void performOperation(AnnotatedPluginDocument[] annotatedDocuments, ProgressListener progressListener, Options options, SequenceSelection sequenceSelection, DocumentOperation.OperationCallback callback) throws DocumentOperationException
DocumentOperationDocumentOperation.performOperation(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[], jebl.util.ProgressListener, Options)
which may provide the currently selected region of any sequence in the documents. eg. if a region of a sequence
is slected in the Sequence View then the selection will be passed in.
It also provides a callback which allows you to specify points from which this operation can be resumed, and to return documents while the operation is in progress.performOperation in class DocumentOperationannotatedDocuments - the documents to apply the operation to. These must be the same documents as those passed to DocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[]).progressListener - report progress for slow operations. If the progressListener requests that the operation cancels, the operation may choose to throw a DocumentOperationException.Canceledoptions - the options returned from getOptionssequenceSelection - the currently selected region of any sequence in the documents, never null but may be an empty selectioncallback - provides a mechanism to specify persistent data so that the operation can be resumed, and also a mechanism to return documents while the operation is in progress (see DocumentOperation.OperationCallback)DocumentOperationException - when something goes wrong.public List<AnnotatedPluginDocument> performOperation(AnnotatedPluginDocument[] annotatedDocuments, ProgressListener progressListener, Options options, SequenceSelection sequenceSelection) throws DocumentOperationException
DocumentOperationDocumentOperation.performOperation(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[], jebl.util.ProgressListener, Options, SequenceSelection, com.biomatters.geneious.publicapi.plugin.DocumentOperation.OperationCallback) . Does not return intermediate documents.performOperation in class DocumentOperationannotatedDocuments - the documents to apply the operation to. These must be the same documents as those passed to DocumentOperation.getOptions(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[]).progressListener - report progress for slow operations. If the progressListener requests that the operation cancels, the operation may choose to throw a DocumentOperationException.Canceledoptions - the options returned from getOptionssequenceSelection - the currently selected region of any sequence in the documents, never null but may be an empty selectionDocumentOperation.performOperation(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[], jebl.util.ProgressListener, Options, SequenceSelection, com.biomatters.geneious.publicapi.plugin.DocumentOperation.OperationCallback).DocumentOperationException - if something goes wrongpublic Options getOptions(org.jdom.Element optionsElement, List<AnnotatedPluginDocument> inputDocuments, List<AnnotatedPluginDocument> additionalParentDocuments) throws DocumentOperationException
DocumentOperationDocumentOperation.OperationCallback.setOptionsForActivelyLinkedDescendants(org.jdom.Element, java.util.List, java.util.List)
An operation that is rerun must generate the same number of documents and those documents must be in the same order to ensure actively links correctly workgetOptions in class DocumentOperationoptionsElement - some options XML previously specified in DocumentOperation.OperationCallback.setOptionsForActivelyLinkedDescendants(org.jdom.Element, java.util.List, java.util.List)inputDocuments - the input documents to the operation (the parent documents specified in DocumentOperation.OperationCallback.setOptionsForActivelyLinkedDescendants(org.jdom.Element, java.util.List, java.util.List))additionalParentDocuments - any additional parent documents that shouldn't be passed into the performOperation directly, but that are still needed by the operation.DocumentOperationException - if obtaining the options for this operation is unsuccessful for any reasonpublic boolean isDocumentGenerator()
DocumentOperationDocumentOperation.performOperation(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[], jebl.util.ProgressListener, Options).
This is used so that Geneious knows whether to prompt the user for a destination
for the documents that may be generated before starting the operation.
If this DocumentOperation sometimes generates documents, then this method should return true.
The default implementation returns true.isDocumentGenerator in class DocumentOperationpublic boolean loadDocumentsBeforeShowingOptions()
DocumentOperationPluginDocuments of all input
AnnotatedPluginDocuments and the PluginDocuments of all referenced AnnotatedPluginDocuments
into memory before invoking getOptions.
The default implementation returns false.loadDocumentsBeforeShowingOptions in class DocumentOperationPluginDocuments of all input
AnnotatedPluginDocuments and the PluginDocuments of all referenced AnnotatedPluginDocuments
into memory before invoking the getOptions.DocumentOperation.loadDocumentsBeforeRunningOperation()public boolean loadDocumentsBeforeRunningOperation()
DocumentOperationPluginDocuments of all input
AnnotatedPluginDocuments and the PluginDocuments of all referenced AnnotatedPluginDocuments
into memory before invoking performOperation.
The default implementation returns true.loadDocumentsBeforeRunningOperation in class DocumentOperationPluginDocuments of all input
AnnotatedPluginDocuments and the PluginDocuments of all referenced AnnotatedPluginDocuments
into memory before invoking performOperation.DocumentOperation.loadDocumentsBeforeShowingOptions()public double getFractionOfTimeToSaveResults()
DocumentOperationperformOperation
will take the progress bar up to 95% and then Geneious will fill in the remaining 5% as the document is saved to the user's local database.getFractionOfTimeToSaveResults in class DocumentOperationpublic boolean canRunOnLocalGeneious()
canRunOnLocalGeneious in class DocumentOperationpublic boolean canRunOnGeneiousServer()
DocumentOperationOptions.valuesFromXML(org.jdom.Element) with the element obtained from Options.valuesToXML(String).DocumentOperation.OperationCallback
or as an element in the return list.GeneiousServices directly.Geneious.isServer()
when the operation is being run to see if it is running on the a Geneious Server. If running on Geneious Server
then the path of the bundled executable should always be used rather than a path specified by the user.canRunOnGeneiousServer in class DocumentOperation