JAL-1861 disable the action buttons for 1500 millisec when the ok button is clicked
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 3 Sep 2015 14:00:34 +0000 (15:00 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 3 Sep 2015 14:00:34 +0000 (15:00 +0100)
src/jalview/gui/PDBSearchPanel.java

index b31c637..4e23f57 100644 (file)
@@ -195,6 +195,7 @@ public class PDBSearchPanel extends GPDBSearchPanel
   public void loadSelectedPDBSequencesToAlignment()
   {
     // mainFrame.dispose();
+    disableActionButtons();
     StringBuilder selectedIds = new StringBuilder();
     HashSet<String> selectedIdsSet = new HashSet<String>();
     int pdbIdCol = PDBRestClient.getPDBIdColumIndex(wantedFields, false);
@@ -217,6 +218,35 @@ public class PDBSearchPanel extends GPDBSearchPanel
     seqFetcher.textArea.setText(ids);
     Thread worker = new Thread(seqFetcher);
     worker.start();
+    delayAndEnableActionButtons();
+
+  }
+
+  private void disableActionButtons()
+  {
+    btn_ok.setEnabled(false);
+    btn_back.setEnabled(false);
+    btn_cancel.setEnabled(false);
+  }
+
+  private void delayAndEnableActionButtons()
+  {
+    new Thread()
+    {
+      public void run()
+      {
+        try
+        {
+          Thread.sleep(1500);
+        } catch (InterruptedException e)
+        {
+          e.printStackTrace();
+        }
+        btn_ok.setEnabled(true);
+        btn_back.setEnabled(true);
+        btn_cancel.setEnabled(true);
+      }
+    }.start();
   }
 
   public static String getPDBIdwithSpecifiedChain(String pdbId,