X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fws%2FDBRefFetcher.java;h=3ba0e3454db16f5357a25e3498ba20e5c236fb3d;hb=25d8a7ecd5e259b37f54e33cc3989f29cca4bf4f;hp=dff1b987801c685c5902c36390453f1876d0d3ea;hpb=a6b324e3f5edac3df0b968f0037b1cc8b651598e;p=jalview.git diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index dff1b98..3ba0e34 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -55,6 +55,13 @@ import uk.ac.ebi.picr.model.UPEntry; */ public class DBRefFetcher implements Runnable { + public interface FetchFinishedListenerI + { + void finished(); + } + + private List listeners; + SequenceI[] dataset; IProgressIndicator progressWindow; @@ -86,10 +93,6 @@ public class DBRefFetcher implements Runnable */ 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 @@ -109,6 +112,7 @@ public class DBRefFetcher implements Runnable IProgressIndicator progressIndicatorFrame, DbSourceProxy[] sources, FeatureSettings featureSettings, boolean isNucleotide) { + listeners = new ArrayList(); this.progressWindow = progressIndicatorFrame; alseqs = new SequenceI[seqs.length]; SequenceI[] ds = new SequenceI[seqs.length]; @@ -137,7 +141,7 @@ public class DBRefFetcher implements Runnable String[] defdb = null, otherdb = sfetcher .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class); List selsources = new ArrayList(); - Vector dasselsrc = (featureSettings != null) ? featureSettings + Vector dasselsrc = (featureSettings != null) ? featureSettings .getSelectedSources() : new jalview.gui.DasSourceBrowser() .getSelectedSources(); Enumeration en = dasselsrc.elements(); @@ -186,6 +190,26 @@ public class DBRefFetcher implements Runnable } /** + * 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 */ @@ -473,12 +497,13 @@ public class DBRefFetcher implements Runnable progressWindow.setProgressBar( MessageManager.getString("label.dbref_search_completed"), startTime); - // promptBeforeBlast(); - } + for (FetchFinishedListenerI listener : listeners) + { + listener.finished(); + } running = false; - } /**