/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
* Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.MutableTreeNode;
-import javax.swing.tree.TreeModel;
+
+import com.stevesoft.pat.Regex;
import jalview.datamodel.*;
import jalview.io.*;
import jalview.util.DBRefUtils;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.seqfetcher.DbSourceProxy;
-import jalview.ws.seqfetcher.DbSourceProxyImpl;
-
import java.awt.BorderLayout;
public class SequenceFetcher extends JPanel implements Runnable
/**
* Blocking method that initialises and returns the shared instance of the
* SequenceFetcher client
- *
+ *
* @param guiWindow
* - where the initialisation delay message should be shown
* @return the singleton instance of the sequence fetcher client
Thread sf = new Thread(new Runnable()
{
+ @Override
public void run()
{
if (getSequenceFetcherSingleton(guiWindow) != null)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane
/**
* called by thread spawned by constructor
- *
+ *
* @param guiWindow
*/
private void initGui(IProgressIndicator guiWindow)
ok.setText("OK");
ok.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
ok_actionPerformed();
clear.setText("Clear");
clear.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
clear_actionPerformed();
example.setText("Example");
example.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
example_actionPerformed();
close.setText("Close");
close.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
close_actionPerformed(e);
textArea.setLineWrap(true);
textArea.addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
database.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
try
close.setEnabled(true);
}
+ @Override
public void run()
{
String error = "";
{
DBRefEntry dbr = new DBRefEntry(), found[] = null;
dbr.setSource(proxy.getDbSource());
+ dbr.setVersion(null);
+ if (proxy.getAccessionValidator()!=null) {
+ Regex vgr=proxy.getAccessionValidator();
+ vgr.search(q);
+ if (vgr.numSubs()>0) {
+ dbr.setAccessionId(vgr.stringMatched(1));
+ } else {
+ dbr.setAccessionId(vgr.stringMatched());
+ }
+ } else {
+ dbr.setAccessionId(q);
+ }
boolean rfound = false;
for (int r = 0; r < rs.length; r++)
{
}
/**
- *
+ *
* @return a standard title for any results retrieved using the currently
* selected source and settings
*/
title = getDefaultRetrievalTitle();
}
SequenceFeature[] sfs = null;
- for (Enumeration sq = al.getSequences().elements(); sq
- .hasMoreElements();)
+ List<SequenceI> alsqs;
+ synchronized (alsqs = al.getSequences())
{
- if ((sfs = ((SequenceI) sq.nextElement()).getDatasetSequence()
- .getSequenceFeatures()) != null)
+ for (SequenceI sq : alsqs)
{
- if (sfs.length > 0)
+ if ((sfs = (sq).getDatasetSequence().getSequenceFeatures()) != null)
{
- af.setShowSeqFeatures(true);
- break;
+ if (sfs.length > 0)
+ {
+ af.setShowSeqFeatures(true);
+ break;
+ }
}
- }
+ }
}
Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
resetDialog();
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane.showInternalMessageDialog(Desktop.desktop, error,