*/
public class DBRefFetcher implements Runnable
{
+ public interface FetchFinishedListenerI
+ {
+ void finished();
+ }
+
+ private List<FetchFinishedListenerI> listeners;
+
SequenceI[] dataset;
IProgressIndicator progressWindow;
*/
private boolean trimDsSeqs = true;
- public DBRefFetcher()
- {
- }
-
/**
* Creates a new DBRefFetcher object and fetches from the currently selected
* set of databases, if this is null then it fetches based on feature settings
IProgressIndicator progressIndicatorFrame,
DbSourceProxy[] sources, FeatureSettings featureSettings, boolean isNucleotide)
{
+ listeners = new ArrayList<FetchFinishedListenerI>();
this.progressWindow = progressIndicatorFrame;
alseqs = new SequenceI[seqs.length];
SequenceI[] ds = new SequenceI[seqs.length];
String[] defdb = null, otherdb = sfetcher
.getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
- Vector dasselsrc = (featureSettings != null) ? featureSettings
+ Vector<jalviewSourceI> dasselsrc = (featureSettings != null) ? featureSettings
.getSelectedSources() : new jalview.gui.DasSourceBrowser()
.getSelectedSources();
Enumeration<jalviewSourceI> en = dasselsrc.elements();
}
/**
+ * Constructor with only sequences provided
+ *
+ * @param sequences
+ */
+ public DBRefFetcher(SequenceI[] sequences)
+ {
+ this(sequences, null, null, null, false);
+ }
+
+ /**
+ * Add a listener to be notified when sequence fetching is complete
+ *
+ * @param l
+ */
+ public void addListener(FetchFinishedListenerI l)
+ {
+ listeners.add(l);
+ }
+
+ /**
* retrieve all the das sequence sources and add them to the list of db
* sources to retrieve from
*/
progressWindow.setProgressBar(
MessageManager.getString("label.dbref_search_completed"),
startTime);
- // promptBeforeBlast();
-
}
+ for (FetchFinishedListenerI listener : listeners)
+ {
+ listener.finished();
+ }
running = false;
-
}
/**