From 40d0dccb97f3e3fd9503ae7acc55e2a8ec85977d Mon Sep 17 00:00:00 2001 From: Charles Ofoegbu Date: Wed, 26 Nov 2014 15:52:36 +0000 Subject: [PATCH] JAL-998 fixed empty tooltip bug when only one sequence feature is present --- src/jalview/gui/JvSwingUtils.java | 6 +++--- src/jalview/gui/SeqPanel.java | 14 +++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index d546584..e433243 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -53,14 +53,14 @@ public final class JvSwingUtils */ public static String wrapTooltip(boolean enclose, String ttext) { - if (ttext.length() < 60) { - return enclose ? ""+ttext+"" : ttext; + return enclose ? "" + ttext + "" : ttext; } else { - return (enclose ? "" : "") + "
" + ttext + return (enclose ? "" : "") + + "
" + ttext + "
" + ((enclose ? "" : "")); } } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 61782b4..48800c3 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -112,7 +112,7 @@ public class SeqPanel extends JPanel implements MouseListener, private final SequenceAnnotationReport seqARep; - StringBuffer tooltipText = new StringBuffer(""); + StringBuffer tooltipText = new StringBuffer(); String tmpString; @@ -727,11 +727,6 @@ public class SeqPanel extends JPanel implements MouseListener, { if (groups[g].getStartRes() <= res && groups[g].getEndRes() >= res) { - if (tooltipText.length() > 6) - { - tooltipText.append("
"); - } - if (!groups[g].getName().startsWith("JTreeGroup") && !groups[g].getName().startsWith("JGroup")) { @@ -763,12 +758,13 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - tooltipText.append(""); if (lastTooltip == null || !lastTooltip.equals(tooltipText.toString())) { - setToolTipText(JvSwingUtils.wrapTooltip(true, - tooltipText.toString())); + String formatedTooltipText = JvSwingUtils.wrapTooltip(true, + tooltipText.toString()); + // String formatedTooltipText = tooltipText.toString(); + setToolTipText(formatedTooltipText); lastTooltip = tooltipText.toString(); } -- 1.7.10.2