JAL-4034 Fix #2 show an icon and a button to press to initiate search
authorJim Procter <j.procter@dundee.ac.uk>
Mon, 4 Jul 2022 16:59:14 +0000 (17:59 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Mon, 4 Jul 2022 17:00:20 +0000 (18:00 +0100)
src/jalview/gui/StructureChooser.java
src/jalview/jbgui/GStructureChooser.java

index af5f8a4..5ea68fb 100644 (file)
@@ -263,6 +263,7 @@ public class StructureChooser extends GStructureChooser
         progressBar.setProgressBar(
                 MessageManager.getString("status.searching_3d_beacons"),
                 progressId);
+        btn_queryTDB.setEnabled(false);
         // TODO: warn if no accessions discovered
         populateSeqsWithoutSourceDBRef();
         // redo initial discovery - this time with 3d beacons
@@ -280,11 +281,13 @@ public class StructureChooser extends GStructureChooser
           btn_queryTDB.setToolTipText(MessageManager.getString(
                   "status.no_structures_discovered_from_3d_beacons"));
           btn_queryTDB.setEnabled(false);
+          pnl_queryTDB.setVisible(false);
         }
         else
         {
           cmb_filterOption.setSelectedIndex(0); // select 'best'
           btn_queryTDB.setVisible(false);
+          pnl_queryTDB.setVisible(false);
           progressBar.setProgressBar(null, progressId);
         }
         mainFrame.setEnabled(true);
@@ -707,6 +710,7 @@ public class StructureChooser extends GStructureChooser
     if (canQueryTDB && notQueriedTDBYet)
     {
       btn_queryTDB.setVisible(true);
+      pnl_queryTDB.setVisible(true);
     }
 
     if (cachedPDBExist)
index 10e000f..d8101e3 100644 (file)
 
 package jalview.jbgui;
 
-import jalview.datamodel.SequenceI;
-import jalview.fts.api.FTSDataColumnI;
-import jalview.fts.core.FTSDataColumnPreferences;
-import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
-import jalview.fts.service.pdb.PDBFTSRestClient;
-import jalview.gui.AlignmentPanel;
-import jalview.gui.Desktop;
-import jalview.gui.JvSwingUtils;
-import jalview.gui.StructureViewer;
-import jalview.util.MessageManager;
-
 import java.awt.BorderLayout;
 import java.awt.CardLayout;
 import java.awt.Component;
@@ -68,7 +57,6 @@ 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;
@@ -76,6 +64,14 @@ import javax.swing.event.DocumentListener;
 import javax.swing.event.InternalFrameEvent;
 import javax.swing.table.TableColumn;
 
+import jalview.datamodel.SequenceI;
+import jalview.fts.api.FTSDataColumnI;
+import jalview.fts.core.FTSDataColumnPreferences;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.gui.StructureViewer;
+import jalview.util.MessageManager;
 import net.miginfocom.swing.MigLayout;
 
 @SuppressWarnings("serial")
@@ -122,6 +118,9 @@ public abstract class GStructureChooser extends JPanel
 
   protected JButton btn_pdbFromFile = new JButton();
 
+  // holder for icon and button
+  protected JPanel pnl_queryTDB;
+
   protected JButton btn_queryTDB = new JButton();
 
   protected JCheckBox chk_superpose = new JCheckBox(
@@ -594,13 +593,12 @@ public abstract class GStructureChooser extends JPanel
     });
 
     chk_invertFilter.addItemListener(this);
+    btn_queryTDB = new JButton(
+            MessageManager.getString("label.search_3dbeacons"));
     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.setPreferredSize(new Dimension(300, 24));
     btn_queryTDB.setVisible(false);
 
     targetView.setVisible(false);
@@ -614,7 +612,12 @@ public abstract class GStructureChooser extends JPanel
 
     JPanel pnl_main = new JPanel(new BorderLayout());
     JPanel pnl_controls = new JPanel();
-    pnl_main.add(btn_queryTDB, BorderLayout.NORTH);
+    pnl_queryTDB = new JPanel(new FlowLayout());
+    pnl_queryTDB.setBackground(getBackground());
+    pnl_queryTDB.add(new JLabel(tdbImage));
+    pnl_queryTDB.add(btn_queryTDB);
+    pnl_queryTDB.setVisible(false);
+    pnl_main.add(pnl_queryTDB, BorderLayout.NORTH);
     pnl_controls.add(cmb_filterOption);
     pnl_controls.add(lbl_loading);
     pnl_controls.add(chk_invertFilter);