JAL-3829 fetch 3D beacons now started by clicking button shown above the drop-down...
authorJim Procter <j.procter@dundee.ac.uk>
Fri, 1 Oct 2021 11:28:09 +0000 (12:28 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Fri, 1 Oct 2021 11:28:09 +0000 (12:28 +0100)
resources/lang/Messages.properties
src/jalview/gui/StructureChooser.java
src/jalview/jbgui/GStructureChooser.java

index 3b08362..555bfbf 100644 (file)
@@ -513,7 +513,8 @@ label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences =
 label.standard_databases = Standard Databases
 label.fetch_embl_uniprot = Fetch from EMBL/EMBLCDS or Uniprot/PDB and any selected DAS sources
 label.fetch_uniprot_references = Fetch Uniprot references
-label.search_3dbeacons = Find models with 3D-Beacons
+label.search_3dbeacons = 3D-Beacons Search
+label.find_models_from_3dbeacons = Search 3D-Beacons for 3D structures and models
 label.3dbeacons = 3D-Beacons
 label.fetch_references_for = Fetch database references for {0} sequences ?
 label.fetch_references_for_3dbeacons = 3D Beacons needs Uniprot References. Fetch database references for {0} sequences ?
index 3ecca9b..09eb7af 100644 (file)
@@ -81,11 +81,6 @@ public class StructureChooser extends GStructureChooser
 {
   private static final String AUTOSUPERIMPOSE = "AUTOSUPERIMPOSE";
 
-  /**
-   * transient combo box choice for initiating 3db fetch
-   */
-  private static final String VIEWS_QUERYING_TDB = "QUERY_3DB";
-
   private SequenceI selectedSequence;
 
   private SequenceI[] selectedSequences;
@@ -189,6 +184,15 @@ public class StructureChooser extends GStructureChooser
     }
 
     chk_superpose.setSelected(Cache.getDefault(AUTOSUPERIMPOSE, true));
+    btn_queryTDB.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        promptForTDBFetch();
+      }
+    });
 
     Executors.defaultThreadFactory().newThread(new Runnable()
     {
@@ -247,7 +251,9 @@ public class StructureChooser extends GStructureChooser
       @Override
       public void run()
       {
-        progressBar.setProgressBar("status.searching_3d_beacons", progressId);
+        mainFrame.setEnabled(false);
+        cmb_filterOption.setEnabled(false);
+        progressBar.setProgressBar(MessageManager.getString("status.searching_3d_beacons"), progressId);
         // TODO: warn if no accessions discovered
         populateSeqsWithoutSourceDBRef();
         // redo initial discovery - this time with 3d beacons
@@ -256,10 +262,15 @@ public class StructureChooser extends GStructureChooser
         initialStructureDiscovery();
         if (!isStructuresDiscovered())
         {
-          progressBar.setProgressBar("status.no_structures_discovered_from_3d_beacons", progressId);
+          progressBar.setProgressBar(MessageManager.getString("status.no_structures_discovered_from_3d_beacons"), progressId);
+          btn_queryTDB.setToolTipText(MessageManager.getString("status.no_structures_discovered_from_3d_beacons"));
+          btn_queryTDB.setEnabled(false);
         } else {
+          btn_queryTDB.setVisible(false);
           progressBar.setProgressBar(null, progressId);
         }
+        mainFrame.setEnabled(true);
+        cmb_filterOption.setEnabled(true);
       }
     };
 
@@ -667,10 +678,7 @@ public class StructureChooser extends GStructureChooser
                     "-", VIEWS_FROM_FILE, false, null));
     if (canQueryTDB && notQueriedTDBYet)
     {
-      FilterOption queryTDBOption = new FilterOption(
-              MessageManager.getString("label.search_3dbeacons"), "-",
-              VIEWS_QUERYING_TDB, false, null);
-      cmb_filterOption.addItem(queryTDBOption);
+      btn_queryTDB.setVisible(true);
     }
 
     if (cachedPDBExist)
@@ -699,12 +707,6 @@ public class StructureChooser extends GStructureChooser
     FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
             .getSelectedItem());
     
-    // first check if we need to rebuild dialog
-    if (selectedFilterOpt.getView() == VIEWS_QUERYING_TDB)
-    {
-      promptForTDBFetch();
-      return;
-    }
     if (lastSelected == selectedFilterOpt)
     {
       // don't need to do anything, probably
index fadfe6d..ccccfb4 100644 (file)
@@ -68,6 +68,7 @@ import javax.swing.JTable;
 import javax.swing.JTextField;
 import javax.swing.ListCellRenderer;
 import javax.swing.Timer;
+import javax.swing.UIManager;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.event.DocumentEvent;
@@ -120,6 +121,8 @@ public abstract class GStructureChooser extends JPanel
   protected JButton btn_newView;
 
   protected JButton btn_pdbFromFile = new JButton();
+  
+  protected JButton btn_queryTDB = new JButton();
 
   protected JCheckBox chk_superpose = new JCheckBox(
           MessageManager.getString("label.superpose_structures"));
@@ -146,6 +149,9 @@ public abstract class GStructureChooser extends JPanel
   protected ImageIcon warningImage = new ImageIcon(
           getClass().getResource("/images/warning.gif"));
 
+  protected ImageIcon tdbImage = new ImageIcon(
+          getClass().getResource("/images/3d-beacons-logo-transparent.png"));
+
   protected JLabel lbl_loading = new JLabel(loadingImage);
 
   protected JLabel lbl_pdbManualFetchStatus = new JLabel(errorImage);
@@ -575,6 +581,12 @@ public abstract class GStructureChooser extends JPanel
     });
 
     chk_invertFilter.addItemListener(this);
+    btn_queryTDB.setFont(VERDANA_12);
+    //btn_queryTDB.setPreferredSize(new Dimension(200,22));
+    btn_queryTDB.setText(MessageManager.getString("label.search_3dbeacons"));
+    btn_queryTDB.setToolTipText(MessageManager.getString("label.find_models_from_3dbeacons"));
+    btn_queryTDB.setIcon(tdbImage);
+    btn_queryTDB.setVisible(false);
 
     targetView.setVisible(false);
 
@@ -585,10 +597,13 @@ public abstract class GStructureChooser extends JPanel
     actionsPanel.add(btn_newView);
     actionsPanel.add(btn_cancel, "right");
 
-    JPanel pnl_main = new JPanel();
-    pnl_main.add(cmb_filterOption);
-    pnl_main.add(lbl_loading);
-    pnl_main.add(chk_invertFilter);
+    JPanel pnl_main = new JPanel(new BorderLayout());
+    JPanel pnl_controls = new JPanel();
+    pnl_main.add(btn_queryTDB,BorderLayout.NORTH);
+    pnl_controls.add(cmb_filterOption);
+    pnl_controls.add(lbl_loading);
+    pnl_controls.add(chk_invertFilter);
+    pnl_main.add(pnl_controls,BorderLayout.CENTER);
     lbl_loading.setVisible(false);
 
     JPanel pnl_fileChooser = new JPanel(new FlowLayout());