+ private volatile boolean _isConstructing = false;
+
+ private List<AlignFrame> newAlframes = null;
+
+ public SequenceFetcher(IProgressIndicator guiIndic)
+ {
+ this(guiIndic, null, null);
+ }
+
+ public SequenceFetcher(IProgressIndicator guiIndic,
+ final String selectedDb, final String queryString)
+ {
+ this._isConstructing = true;
+ this.progressIndicator = guiIndic;
+ final SequenceFetcher us = this;
+ // launch initialiser thread
+ Thread sf = new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ if (getSequenceFetcherSingleton(progressIndicator) != null)
+ {
+ us.initGui(progressIndicator, selectedDb, queryString);
+ us._isConstructing = false;
+ }
+ else
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ JvOptionPane
+ .showInternalMessageDialog(
+ Desktop.desktop,
+ MessageManager
+ .getString("warn.couldnt_create_sequence_fetcher_client"),
+ MessageManager
+ .getString("label.couldnt_create_sequence_fetcher"),
+ JvOptionPane.ERROR_MESSAGE);
+ }
+ });
+
+ // raise warning dialog
+ }
+ }
+ });
+ sf.start();
+ }
+
+ /**
+ * blocking call which creates a new sequence fetcher panel, configures it and
+ * presses the OK button with the given database and query.
+ *
+ * @param database
+ * @param query
+ */
+ public static List<AlignFrame> fetchAndShow(String database, String query)
+ {
+ final SequenceFetcher sf = new SequenceFetcher(Desktop.instance,
+ database, query);
+ while (sf._isConstructing)
+ {
+ try
+ {
+ Thread.sleep(50);
+ } catch (Exception q)
+ {
+ return Collections.emptyList();
+ }
+ }
+ sf.newAlframes = new ArrayList<AlignFrame>();
+ sf.run();
+ return sf.newAlframes;
+ }
+
+ private class DatabaseAuthority extends DefaultMutableTreeNode
+ {
+
+ };
+
+ private class DatabaseSource extends DefaultMutableTreeNode
+ {
+
+ };
+
+ /**
+ * initialise the database and query for this fetcher panel
+ *
+ * @param selectedDb
+ * - string that should correspond to a sequence fetcher
+ * @param queryString
+ * - string that will be entered in the query dialog
+ * @return true if UI was configured with valid database and query string
+ */
+ protected boolean setInitialQuery(String selectedDb, String queryString)
+ {
+ if (selectedDb == null || selectedDb.trim().length() == 0)
+ {
+ return false;
+ }