From aa301778c8e8d9edc8889de2a6474dbb7575ab19 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Tue, 18 Aug 2015 11:47:32 +0100 Subject: [PATCH] JAL-1834 added tooltip to the PDB sequence fetcher and structure chooser summary tables --- resources/lang/Messages.properties | 2 +- src/jalview/gui/PDBSearchPanel.java | 2 -- src/jalview/jbgui/GPDBSearchPanel.java | 23 ++++++++++++++++++++++- src/jalview/jbgui/GStructureChooser.java | 23 ++++++++++++++++++++++- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index f5e07be..59562aa 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -772,7 +772,7 @@ 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 = Enter one or more accession IDs +label.separate_multiple_accession_ids = Enter one or more PDB accession IDs separated by a semi-colon ";" label.separate_multiple_query_values = Enter one or more {0}s separated by a semi-colon ";" label.search_all = Enter one or more search values separated by a semi-colon ";" (Note: This Searches the entire PDB database) label.replace_commas_semicolons = Replace commas with semi-colons diff --git a/src/jalview/gui/PDBSearchPanel.java b/src/jalview/gui/PDBSearchPanel.java index 06aa5df..63c3761 100644 --- a/src/jalview/gui/PDBSearchPanel.java +++ b/src/jalview/gui/PDBSearchPanel.java @@ -96,8 +96,6 @@ public class PDBSearchPanel extends GPDBSearchPanel } catch (Exception e) { // System.out.println(">>>>>>>>>>>>>>>" + e.getMessage()); - // JOptionPane.showMessageDialog(this, e.getMessage(), - // "PDB Web-service Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); errorWarning.append(e.getMessage()); checkForErrors(); diff --git a/src/jalview/jbgui/GPDBSearchPanel.java b/src/jalview/jbgui/GPDBSearchPanel.java index b0bb5bd..08a620a 100644 --- a/src/jalview/jbgui/GPDBSearchPanel.java +++ b/src/jalview/jbgui/GPDBSearchPanel.java @@ -77,7 +77,27 @@ public abstract class GPDBSearchPanel extends JPanel protected JTextField txt_search = new JTextField(20); - protected JTable tbl_summary = new JTable(); + protected JTable tbl_summary = new JTable() + { + public String getToolTipText(MouseEvent evt) + { + String toolTipText = null; + java.awt.Point pnt = evt.getPoint(); + int rowIndex = rowAtPoint(pnt); + int colIndex = columnAtPoint(pnt); + + try + { + toolTipText = getValueAt(rowIndex, colIndex).toString(); + } catch (Exception e) + { + e.printStackTrace(); + } + toolTipText = (toolTipText == null ? null : JvSwingUtils.wrapTooltip( + true, toolTipText)); + return toolTipText; + } + }; protected StringBuilder errorWarning = new StringBuilder(); @@ -128,6 +148,7 @@ tbl_summary); lbl_warning.setFont(new java.awt.Font("Verdana", 0, 12)); tbl_summary.setAutoCreateRowSorter(true); + tbl_summary.getTableHeader().setReorderingAllowed(false); tbl_summary.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index 8596081..9e4e6f3 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -24,6 +24,7 @@ package jalview.jbgui; import jalview.datamodel.SequenceI; import jalview.gui.AlignmentPanel; import jalview.gui.Desktop; +import jalview.gui.JvSwingUtils; import jalview.jbgui.PDBDocFieldPreferences.PreferenceSource; import jalview.util.MessageManager; import jalview.ws.dbsources.PDBRestClient; @@ -148,7 +149,27 @@ public abstract class GStructureChooser extends JPanel implements protected static final String VIEWS_LOCAL_PDB = "VIEWS_LOCAL_PDB"; - protected JTable tbl_summary = new JTable(); + protected JTable tbl_summary = new JTable() + { + public String getToolTipText(MouseEvent evt) + { + String toolTipText = null; + java.awt.Point pnt = evt.getPoint(); + int rowIndex = rowAtPoint(pnt); + int colIndex = columnAtPoint(pnt); + + try + { + toolTipText = getValueAt(rowIndex, colIndex).toString(); + } catch (Exception e) + { + e.printStackTrace(); + } + toolTipText = (toolTipText == null ? null : JvSwingUtils.wrapTooltip( + true, toolTipText)); + return toolTipText; + } + }; protected JScrollPane scrl_foundStructures = new JScrollPane( tbl_summary); -- 1.7.10.2