JAL-3468 Adapted methods to report how many features have been dropped from the toolt...
[jalview.git] / src / jalview / gui / SeqPanel.java
index 75bf0cc..796d339 100644 (file)
@@ -1042,12 +1042,14 @@ public class SeqPanel extends JPanel
      * add features that straddle the gap (pos may be the residue before or
      * after the gap)
      */
+    int unshownFeatures = 0;
     if (av.isShowSequenceFeatures())
     {
       List<SequenceFeature> features = ap.getFeatureRenderer()
               .findFeaturesAtColumn(sequence, column + 1);
-      seqARep.appendFeatures(tooltipText, pos, features,
-              this.ap.getSeqPanel().seqCanvas.fr);
+      unshownFeatures = seqARep.appendFeaturesLengthLimit(tooltipText, pos,
+              features,
+              this.ap.getSeqPanel().seqCanvas.fr, MAX_TOOLTIP_LENGTH);
 
       /*
        * add features in CDS/protein complement at the corresponding
@@ -1065,7 +1067,9 @@ public class SeqPanel extends JPanel
                   pos);
           if (mf != null)
           {
-            seqARep.appendFeatures(tooltipText, pos, mf, fr2);
+            unshownFeatures = seqARep.appendFeaturesLengthLimit(
+                    tooltipText, pos, mf, fr2,
+                    MAX_TOOLTIP_LENGTH);
           }
         }
       }
@@ -1080,7 +1084,14 @@ public class SeqPanel extends JPanel
       if (tooltipText.length() > MAX_TOOLTIP_LENGTH) // constant
       {
         tooltipText.setLength(MAX_TOOLTIP_LENGTH);
-        tooltipText.append("...");
+        tooltipText.append("...TOOLONG!");
+      }
+      if (unshownFeatures > 0)
+      {
+        tooltipText.append("<br/>").append("... ").append("<i>")
+                .append(unshownFeatures)
+                .append(" feature").append(unshownFeatures == 1 ? "" : "s")
+                .append(" not shown</i>");
       }
       String textString = tooltipText.toString();
       if (lastTooltip == null || !lastTooltip.equals(textString))