/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
* Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
if (guiWindow != null)
{
guiWindow.setProgressBar("Initialising Sequence Database Fetchers",
- initingThread.hashCode());
+ Thread.currentThread().hashCode());
}
sfetch = sf;
_initingFetcher = false;
{
this.setLayout(borderLayout2);
- database.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ database.setFont(JvSwingUtils.getLabelFont());
dbeg.setFont(new java.awt.Font("Verdana", Font.BOLD, 11));
jLabel1.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
close_actionPerformed(e);
}
});
- textArea.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ textArea.setFont(JvSwingUtils.getLabelFont());
textArea.setLineWrap(true);
textArea.addKeyListener(new KeyAdapter()
{
resetDialog();
return;
}
- AlignmentI aresult = null;
+ ArrayList<String> aresultq=new ArrayList<String>();
+ ArrayList<AlignmentI> aresult = new ArrayList<AlignmentI>();
Object source = database.getSelectedItem();
Enumeration en = new StringTokenizer(textArea.getText(), ";");
+ boolean isAliSource=false;
try
{
guiWindow.setProgressBar(
Thread.currentThread().hashCode());
DbSourceProxy proxy = sfetch.getSourceProxy((String) sources
.get(source));
+ isAliSource = proxy.isA(DBRefSource.ALIGNMENTDB);
if (proxy.getAccessionSeparator() == null)
{
while (en.hasMoreElements())
}
if (indres != null)
{
- if (aresult == null)
- {
- aresult = indres;
- }
- else
- {
- aresult.append(indres);
- }
+ aresultq.add(item);
+ aresult.add(indres);
}
} catch (Exception e)
{
}
try
{
- aresult = proxy.getSequenceRecords(multiacc.toString());
+ aresultq.add(multiacc.toString());
+ aresult.add(proxy.getSequenceRecords(multiacc.toString()));
} catch (OutOfMemoryError oome)
{
new OOMWarning("fetching " + multiacc + " from "
+ " from " + database.getSelectedItem());
e.printStackTrace();
}
- if (aresult != null)
+ if (aresult != null && aresult.size()>0)
{
- parseResult(aresult, null, null);
+ AlignmentI ar=null;
+ if (isAliSource) {
+ // new window for each result
+ while (aresult.size()>0)
+ {
+ parseResult(aresult.remove(0), aresultq.remove(0)+" "+getDefaultRetrievalTitle(), null);
+ }
+ } else {
+ // concatenate all results in one window
+ while (aresult.size()>0)
+ {
+ if (ar==null) { ar = aresult.remove(0);}
+ else { ar.append(aresult.remove(0)); };
+ }
+ parseResult(ar, null, null);
+ }
}
// only remove visual delay after we finished parsing.
guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
return null;
}
+ /**
+ *
+ * @return a standard title for any results retrieved using the currently selected source and settings
+ */
+ public String getDefaultRetrievalTitle() {
+ return "Retrieved from " + database.getSelectedItem();
+ }
AlignmentI parseResult(AlignmentI al, String title,
String currentFileFormat)
{
if (title == null)
{
- title = "Retrieved from " + database.getSelectedItem();
+ title = getDefaultRetrievalTitle();
}
SequenceFeature[] sfs = null;
for (Enumeration sq = al.getSequences().elements(); sq