public class CompositeRetrieveCallback extends RetrieveCallback
RetrieveCallback that is suitable for a task that consists of several subtasks.
You specify the relative duration of each subtask, and then the subtasks' setProgress()
calls with values between 0 and 1 are translated to reflect the overall progress on the whole
(combined) task. In other words, each subtask reports progress as if it were the whole task,
and the CompositeRetrieveCallback translates this into overall progress.
As the combined retrieve callback cannot know which subtask it is currently being called from,
you have to explicitly let it know when a new subtask starts, by calling
beginSubTask(). Thus when the constructor is passed an array of N doubles as its second
argument, beginSubTask() should be called precisely N times.
ProgressListener.WrapperEMPTY| Constructor and Description |
|---|
CompositeRetrieveCallback(RetrieveCallback internalCallback,
double... operationDuration)
construct a new composite RetrieveCallback.
|
CompositeRetrieveCallback(RetrieveCallback internalCallback,
int numberOfEvenlyWeightedSubTasks)
Construct a CompositeProgressListener with a number of evenly weighted subtasks.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
_add(AnnotatedPluginDocument document,
Map<String,Object> searchResultProperties)
Report back one retrieved document.
|
protected void |
_add(PluginDocument document,
Map<String,Object> searchResultProperties)
Report back one retrieved document.
|
protected void |
_setProgress(double fractionCompleted)
Set progress, taking progress of current task and completion of previous tasks into account.
|
void |
beginSubTask()
begin a new subtask.
|
void |
beginSubTask(String message)
Convenience method to start the next task AND set a new message.
|
_isCanceled, _setImage, _setIndeterminateProgress, _setMessage, _setStatus, acceptsChangesAfterRetrieveCompletes, add, add, addFeedbackAction, addFeedbackAction, addSearchCancelledListener, isCanceled, issueWarning, notifyListenersSearchCancelled, remove, removeFeedbackAction, removeSearchCancelledListener, setFinalStatus, setFolderViewDocument, setPropertyFields, setSearchResumptionIdentifier, setStatus, setTitlecreateSplitProgress, createSplitProgress, forCancelable, getSplitProgress, setImage, setIndeterminateProgress, setMessage, setProgress, setProgress, setProgresspublic CompositeRetrieveCallback(RetrieveCallback internalCallback, int numberOfEvenlyWeightedSubTasks)
internalCallback - the RetrieveCallback that all progress reports are forwarded to after adjusting them for the currently active sub-tasknumberOfEvenlyWeightedSubTasks - the number of evenly weighted sub-tasks.public CompositeRetrieveCallback(RetrieveCallback internalCallback, double... operationDuration)
internalCallback - the RetrieveCallback that all progress reports are forwarded to after adjusting them for the currently active sub-taskoperationDuration - a list of relative weightings to give each sub task.protected void _add(PluginDocument document, Map<String,Object> searchResultProperties)
_add in class RetrieveCallbackdocument - retrieved document; must not be nullsearchResultProperties - properties associated with this document for this particular search.
Must not be null, but may be empty if no properties are relevant. This is used in situations
such as blast where the evalue returned is not actually a property of the document, but
is associated with the document for this given search only. The properties must be valid
fields and values returned by RetrieveCallback.setPropertyFields(java.util.List<com.biomatters.geneious.publicapi.documents.DocumentField>, com.biomatters.geneious.publicapi.documents.DocumentField).
Geneious code can "pause" the operation by delaying the return from add.protected void _add(AnnotatedPluginDocument document, Map<String,Object> searchResultProperties)
_add in class RetrieveCallbackdocument - retrieved annotated document; must not be nullsearchResultProperties - may be null (null will be translated to Collections.emptyMap() before calling
_add(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument, java.util.Map).protected void _setProgress(double fractionCompleted)
_setProgress in class RetrieveCallbackfractionCompleted - the fraction of the current task that has been completedpublic void beginSubTask()
public void beginSubTask(String message)
message - message to set