import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.DBRefFetcher;
+import jalview.ws.DBRefFetcher.FetchFinishedListenerI;
import jalview.ws.SequenceFetcher;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
{
new Thread(new Runnable()
{
-
@Override
public void run()
{
- boolean isNuclueotide = alignPanel.alignFrame.getViewport()
+ boolean isNucleotide = alignPanel.alignFrame.getViewport()
.getAlignment().isNucleotide();
- new jalview.ws.DBRefFetcher(alignPanel.av
+ DBRefFetcher dbRefFetcher = new DBRefFetcher(alignPanel.av
.getSequenceSelection(), alignPanel.alignFrame, null,
- alignPanel.alignFrame.featureSettings, isNuclueotide)
+ alignPanel.alignFrame.featureSettings, isNucleotide);
+ dbRefFetcher.addListener(new FetchFinishedListenerI()
+ {
+ @Override
+ public void finished()
+ {
+ AlignFrame.this.setMenusForViewport();
+ }
+ });
+ dbRefFetcher
.fetchDBRefs(false);
}
}).start();
@Override
public void run()
{
- boolean isNuclueotide = alignPanel.alignFrame
+ boolean isNucleotide = alignPanel.alignFrame
.getViewport().getAlignment()
.isNucleotide();
- new jalview.ws.DBRefFetcher(alignPanel.av
- .getSequenceSelection(),
+ DBRefFetcher dbRefFetcher = new DBRefFetcher(
+ alignPanel.av.getSequenceSelection(),
alignPanel.alignFrame, dassource,
alignPanel.alignFrame.featureSettings,
- isNuclueotide).fetchDBRefs(false);
+ isNucleotide);
+ dbRefFetcher
+ .addListener(new FetchFinishedListenerI()
+ {
+ @Override
+ public void finished()
+ {
+ AlignFrame.this.setMenusForViewport();
+ }
+ });
+ dbRefFetcher.fetchDBRefs(false);
}
}).start();
}
@Override
public void run()
{
- boolean isNuclueotide = alignPanel.alignFrame
+ boolean isNucleotide = alignPanel.alignFrame
.getViewport().getAlignment()
.isNucleotide();
- new jalview.ws.DBRefFetcher(alignPanel.av
- .getSequenceSelection(),
+ DBRefFetcher dbRefFetcher = new DBRefFetcher(
+ alignPanel.av.getSequenceSelection(),
alignPanel.alignFrame, dassource,
alignPanel.alignFrame.featureSettings,
- isNuclueotide).fetchDBRefs(false);
+ isNucleotide);
+ dbRefFetcher
+ .addListener(new FetchFinishedListenerI()
+ {
+ @Override
+ public void finished()
+ {
+ AlignFrame.this.setMenusForViewport();
+ }
+ });
+ dbRefFetcher.fetchDBRefs(false);
}
}).start();
}
@Override
public void run()
{
- boolean isNuclueotide = alignPanel.alignFrame
+ boolean isNucleotide = alignPanel.alignFrame
.getViewport().getAlignment()
.isNucleotide();
- new jalview.ws.DBRefFetcher(alignPanel.av
- .getSequenceSelection(),
+ DBRefFetcher dbRefFetcher = new DBRefFetcher(
+ alignPanel.av.getSequenceSelection(),
alignPanel.alignFrame, dassrc,
alignPanel.alignFrame.featureSettings,
- isNuclueotide).fetchDBRefs(false);
+ isNucleotide);
+ dbRefFetcher
+ .addListener(new FetchFinishedListenerI()
+ {
+ @Override
+ public void finished()
+ {
+ AlignFrame.this.setMenusForViewport();
+ }
+ });
+ dbRefFetcher.fetchDBRefs(false);
}
}).start();
}
*/
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];
}
/**
+ * 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;
-
}
/**