JAL-1993 close sequence fetcher when opening database chooser
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 16 Jun 2016 13:27:29 +0000 (14:27 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 16 Jun 2016 13:27:29 +0000 (14:27 +0100)
src/jalview/gui/JDatabaseTree.java
src/jalview/gui/SequenceFetcher.java

index 6d8c4e0..8294d2b 100644 (file)
@@ -26,7 +26,6 @@ import jalview.ws.seqfetcher.DbSourceProxy;
 
 import java.awt.BorderLayout;
 import java.awt.Component;
-import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
 import java.awt.GridLayout;
@@ -73,7 +72,7 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener
       @Override
       public void actionPerformed(ActionEvent arg0)
       {
-        showDialog(null);
+        showDialog();
       }
     });
     return viewdbs;
@@ -321,7 +320,7 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener
     closeDialog();
   }
 
-  private void showDialog(Container parent)
+  void showDialog()
   {
     oldselection = selection;
     oldtsel = tsel;
index cc8c46e..03bb375 100755 (executable)
@@ -366,7 +366,19 @@ public class SequenceFetcher extends JPanel implements Runnable
     jPanel1.add(close);
     jPanel3.add(jPanel2, java.awt.BorderLayout.CENTER);
     jPanel2.setLayout(borderLayout3);
-    databaseButt = database.getDatabaseSelectorButton();
+    databaseButt = /*database.getDatabaseSelectorButton();
+                   final JButton viewdbs =*/new JButton(
+            MessageManager.getString("action.select_ddbb"));
+    databaseButt.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent arg0)
+      {
+        hidePanel();
+        database.showDialog();
+      }
+    });
     databaseButt.setFont(JvSwingUtils.getLabelFont());
     database.addActionListener(new ActionListener()
     {
@@ -988,4 +1000,13 @@ public class SequenceFetcher extends JPanel implements Runnable
   {
     frame.setVisible(true);
   }
+
+  /**
+   * Hide this panel (on clicking the database button to open the database
+   * chooser)
+   */
+  void hidePanel()
+  {
+    frame.setVisible(false);
+  }
 }