JAL-2183 simplified database tree actionPerformed, accept dbl-click
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 30 Aug 2016 14:49:34 +0000 (15:49 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 30 Aug 2016 14:49:34 +0000 (15:49 +0100)
src/jalview/fts/service/pdb/PDBFTSPanel.java
src/jalview/fts/service/uniprot/UniprotFTSPanel.java
src/jalview/gui/JDatabaseTree.java
src/jalview/gui/SequenceFetcher.java

index 5f5c716..dc2b403 100644 (file)
@@ -45,6 +45,7 @@ public class PDBFTSPanel extends GFTSPanel
 
   public PDBFTSPanel(SequenceFetcher seqFetcher)
   {
+    super();
     pageLimit = PDBFTSRestClient.getInstance().getDefaultResponsePageSize();
     this.seqFetcher = seqFetcher;
     this.progressIdicator = (seqFetcher == null) ? null : seqFetcher
index 9c2c5ce..5691db1 100644 (file)
@@ -46,6 +46,7 @@ public class UniprotFTSPanel extends GFTSPanel
 
   public UniprotFTSPanel(SequenceFetcher seqFetcher)
   {
+    super();
     pageLimit = UniProtFTSRestClient.getInstance()
             .getDefaultResponsePageSize();
     this.seqFetcher = seqFetcher;
index 8294d2b..59c34ec 100644 (file)
@@ -33,6 +33,8 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -168,6 +170,19 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener
         _setSelectionState();
       }
     });
+    dbviews.addMouseListener(new MouseAdapter()
+    {
+
+      @Override
+      public void mousePressed(MouseEvent e)
+      {
+        if (e.getClickCount() == 2)
+        {
+          okPressed();
+          closeDialog();
+        }
+      }
+    });
     JPanel jc = new JPanel(new BorderLayout()), j = new JPanel(
             new FlowLayout());
     jc.add(svp, BorderLayout.CENTER);
@@ -557,6 +572,7 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener
     {
       action = arg0.getKeyCode();
       okPressed();
+      closeDialog();
     }
     if (!arg0.isConsumed() && arg0.getKeyChar() == KeyEvent.VK_ESCAPE)
     {
index e1644e7..afe6754 100755 (executable)
@@ -115,8 +115,6 @@ public class SequenceFetcher extends JPanel implements Runnable
 
   private static Thread initingThread = null;
 
-  int debounceTrap = 0;
-
   public JTextArea getTextArea()
   {
     return textArea;
@@ -384,7 +382,6 @@ public class SequenceFetcher extends JPanel implements Runnable
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        debounceTrap++;
         String currentSelection = database.getSelectedItem();
         if (currentSelection == null)
         {
@@ -394,14 +391,10 @@ public class SequenceFetcher extends JPanel implements Runnable
         showPanel();
 
         if ("pdb".equalsIgnoreCase(currentSelection))
-        // && (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) ==
-        // 0)))
         {
           pdbSourceAction();
         }
         else if ("uniprot".equalsIgnoreCase(currentSelection))
-        // && (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) ==
-        // 0)))
         {
           uniprotSourceAction();
         }