JAL-1748 and employ preprocessing routine when return action event is triggered
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 29 May 2015 10:21:04 +0000 (11:21 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 29 May 2015 10:21:04 +0000 (11:21 +0100)
resources/lang/Messages.properties
src/jalview/gui/PDBSearchPanel.java
src/jalview/jbgui/GPDBSearchPanel.java

index 1af3839..9cf90c7 100644 (file)
@@ -770,7 +770,8 @@ label.transformed_points_for_params = Transformed points for {0}
 label.graduated_color_for_params = Graduated Feature Colour for {0}
 label.select_backgroud_colour = Select Background Colour
 label.invalid_font = Invalid Font
-label.separate_multiple_accession_ids = Separate multiple accession ids with semi colon ";"
+label.separate_multiple_accession_ids = Separate multiple PDB accession ids with semi colon ";"
+label.separate_multiple_query_values = Separate multiple query values with semi colon ";"
 label.replace_commas_semicolons = Replace commas with semi-colons
 label.parsing_failed_syntax_errors_shown_below_param = Parsing failed. Syntax errors shown below {0}
 label.parsing_failed_unrecoverable_exception_thrown_param = \nParsing failed. An unrecoverable exception was thrown\:\n {0}
index 4bd6f7c..3185ae2 100644 (file)
@@ -175,6 +175,14 @@ public class PDBSearchPanel extends GPDBSearchPanel
     mainFrame.dispose();
   }
 
+  public void transferToSequenceFetcher(String ids)
+  {
+    mainFrame.dispose();
+    seqFetcher.textArea.setText(ids);
+    Thread worker = new Thread(seqFetcher);
+    worker.start();
+  }
+
   /**
    * Add the discovered/selected sequences to a target alignment window
    */
@@ -199,7 +207,7 @@ public class PDBSearchPanel extends GPDBSearchPanel
     }
 
     String ids = selectedIds.toString();
-    System.out.println(">>>>>>>>>>>>>>>> selected Ids: " + ids);
+    // System.out.println(">>>>>>>>>>>>>>>> selected Ids: " + ids);
     seqFetcher.textArea.setText(ids);
     Thread worker = new Thread(seqFetcher);
     worker.start();
index ec7d0f8..ee4757e 100644 (file)
@@ -30,6 +30,8 @@ import java.awt.BorderLayout;
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 
@@ -178,14 +180,44 @@ tbl_summary);
       @Override
       public void actionPerformed(ActionEvent e)
       {
+        txt_search.setToolTipText(MessageManager
+                .getString("label.separate_multiple_query_values"));
+        if ("pdb id".equalsIgnoreCase(getCmbSearchTarget()
+                .getSelectedItem().toString()))
+        {
+          txt_search.setToolTipText(MessageManager
+                  .getString("label.separate_multiple_accession_ids"));
+        }
         txt_search_ActionPerformed();
       }
     });
 
     populateCmbSearchTargetOptions();
-    txt_search.setToolTipText(MessageManager
-            .getString("label.separate_multiple_accession_ids"));
+
+
     txt_search.setFont(new java.awt.Font("Verdana", 0, 12));
+
+    txt_search.addKeyListener(new KeyAdapter()
+    {
+      @Override
+      public void keyPressed(KeyEvent e)
+      {
+        if (e.getKeyCode() == KeyEvent.VK_ENTER)
+        {
+          if (txt_search.getText() == null
+                  || txt_search.getText().isEmpty())
+          {
+            return;
+          }
+          if ("pdb id".equalsIgnoreCase(getCmbSearchTarget()
+                  .getSelectedItem().toString()))
+          {
+            transferToSequenceFetcher(txt_search.getText());
+          }
+        }
+      }
+    });
+
     txt_search.getDocument().addDocumentListener(new DocumentListener()
     {
       @Override
@@ -263,6 +295,8 @@ tbl_summary);
     return mainFrame;
   }
 
+  public abstract void transferToSequenceFetcher(String ids);
+
   public abstract void txt_search_ActionPerformed();
 
   public abstract void btn_ok_ActionPerformed();