From 1114062d7c3034db3387f46a860c0e334206ce49 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 22 Jul 2022 11:55:16 +0100 Subject: [PATCH] JAL-4036 Add getDbName to the GFTSPanelI and add an index code message to the index dropdown tooltip as appropriate --- resources/lang/Messages.properties | 2 ++ resources/lang/Messages_es.properties | 2 ++ src/jalview/fts/api/GFTSPanelI.java | 7 +++++ src/jalview/fts/core/GFTSPanel.java | 27 ++++++++++++++++++++ src/jalview/fts/service/pdb/PDBFTSPanel.java | 17 +++++++----- .../service/threedbeacons/TDBeaconsFTSPanel.java | 16 ++++-------- .../fts/service/uniprot/UniprotFTSPanel.java | 4 +++ 7 files changed, 58 insertions(+), 17 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index ae41ec7..b0b7b09 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -778,6 +778,8 @@ label.transformed_points_for_params = Transformed points for {0} label.variable_color_for = Variable Feature Colour for {0} label.select_background_colour = Select Background Colour label.invalid_font = Invalid Font +label.search_db_all = Search all of {0} +label.search_db_index = Search {0} index {1} label.separate_multiple_accession_ids = Enter one or more accession IDs separated by a semi-colon ";" label.separate_multiple_query_values = Enter one or more {0} separated by a semi-colon ";" label.search_all = Enter one or more search values separated by a semi-colon ";" (Note: This searches the entire database) diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index 82e59e6..d8772ef 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -700,6 +700,8 @@ label.transformed_points_for_params = Puntos transformados de {0} label.variable_color_for = Color variable para la característica de {0} label.select_background_colour = Seleccionar color de fondo label.invalid_font = Fuente no válida +label.search_db_all = Buscar en todo {0} +label.search_db_index = Buscar índice {0} {1} label.separate_multiple_accession_ids = Separar los accession id con un punto y coma ";" label.replace_commas_semicolons = Cambiar comas por puntos y comas label.parsing_failed_syntax_errors_shown_below_param = Parseo erróneo. A continuación, se muestras los errores de sintaxis {0} diff --git a/src/jalview/fts/api/GFTSPanelI.java b/src/jalview/fts/api/GFTSPanelI.java index 974cc88..ddb9959 100644 --- a/src/jalview/fts/api/GFTSPanelI.java +++ b/src/jalview/fts/api/GFTSPanelI.java @@ -152,4 +152,11 @@ public interface GFTSPanelI * checkbox */ public String getAutosearchPreference(); + + /** + * Return the name of the database being searched + * + * @return The database name + */ + public String getDbName(); } diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index f73d430..a6ef37d 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -546,6 +546,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI JvSwingUtils.wrapTooltip(true, tooltipText)); if (btn_autosearch.isSelected()) searchAction(true); + + setCmbSearchTargetTooltip(); } } }); @@ -679,6 +681,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI pnl_actions.add(btn_cancel); pnl_results.add(tabbedPane); + setCmbSearchTargetTooltip(); pnl_inputs.add(cmb_searchTarget); pnl_inputs.add(txt_search.getComponent()); pnl_inputs.add(txt_help); @@ -1086,4 +1089,28 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI @Override public abstract void okAction(); + + private void setCmbSearchTargetTooltip() + { + JComboBox cmb = getCmbSearchTarget(); + if (cmb.isEnabled()) + { + boolean isAll = "all" + .equalsIgnoreCase(cmb.getSelectedItem().toString()); + FTSDataColumnI index = (FTSDataColumnI) cmb.getSelectedItem(); + String indexCode = index.getAltCode(); + String dbName = getDbName(); + String message = isAll ? MessageManager + .formatMessage("label.search_db_all", new Object[] + { dbName }) + : MessageManager.formatMessage("label.search_db_index", + new Object[] + { dbName, indexCode }); + cmb.setToolTipText(message); + } + else + { + cmb.setToolTipText(""); + } + } } diff --git a/src/jalview/fts/service/pdb/PDBFTSPanel.java b/src/jalview/fts/service/pdb/PDBFTSPanel.java index 33c1b6c..c9d7676 100644 --- a/src/jalview/fts/service/pdb/PDBFTSPanel.java +++ b/src/jalview/fts/service/pdb/PDBFTSPanel.java @@ -21,6 +21,12 @@ package jalview.fts.service.pdb; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import javax.help.HelpSetException; + import jalview.fts.api.FTSDataColumnI; import jalview.fts.api.FTSRestClientI; import jalview.fts.core.FTSRestRequest; @@ -31,12 +37,6 @@ import jalview.gui.Help.HelpId; import jalview.gui.SequenceFetcher; import jalview.util.MessageManager; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import javax.help.HelpSetException; - @SuppressWarnings("serial") public class PDBFTSPanel extends GFTSPanel { @@ -302,4 +302,9 @@ public class PDBFTSPanel extends GFTSPanel e1.printStackTrace(); } } + + public String getDbName() + { + return "PDB"; + } } \ No newline at end of file diff --git a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java index 6ca3ca2..253de42 100644 --- a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java +++ b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSPanel.java @@ -20,21 +20,13 @@ */ package jalview.fts.service.threedbeacons; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import javax.swing.SwingUtilities; -import org.json.JSONArray; -import org.json.JSONObject; - import jalview.bin.Console; import jalview.datamodel.AlignmentI; import jalview.fts.api.FTSDataColumnI; @@ -42,12 +34,9 @@ import jalview.fts.api.FTSRestClientI; import jalview.fts.core.FTSRestRequest; import jalview.fts.core.FTSRestResponse; import jalview.fts.core.GFTSPanel; -import jalview.fts.service.pdb.PDBFTSRestClient; import jalview.gui.SequenceFetcher; import jalview.io.DataSourceType; import jalview.io.FileFormat; -import jalview.io.FileFormatI; -import jalview.io.FileLoader; import jalview.io.FormatAdapter; import jalview.util.MessageManager; @@ -297,4 +286,9 @@ public class TDBeaconsFTSPanel extends GFTSPanel // no multiple query support yet return enteredText; } + + public String getDbName() + { + return "3D-Beacons"; + } } diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index 0d9767c..68a5696 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -342,4 +342,8 @@ public class UniprotFTSPanel extends GFTSPanel } } + public String getDbName() + { + return "UniProt"; + } } -- 1.7.10.2