JAL-3049 JAL-2069 colour icon tooltip including by attribute
[jalview.git] / src / jalview / gui / FeatureSettings.java
index 01a7310..14e37af 100644 (file)
@@ -1336,32 +1336,25 @@ public class FeatureSettings extends JPanel
   /**
    * Answers a suitable tooltip to show on the colour cell of the table
    * 
-   * @param gcol
+   * @param fcol
    * @return
    */
-  public String getColorTooltip(FeatureColourI gcol)
+  public static String getColorTooltip(FeatureColourI fcol)
   {
-    if (gcol.isSimpleColour())
-    {
-      return BASE_TOOLTIP;
-    }
-    StringBuilder tt = new StringBuilder();
-    if (gcol.isAboveThreshold())
-    {
-      tt.append("Thresholded (Above ").append(gcol.getThreshold())
-              .append(")");
-    }
-    else if (gcol.isBelowThreshold())
+    if (fcol == null)
     {
-      tt.append("Thresholded (Below ").append(gcol.getThreshold())
-              .append(")");
+      return null;
     }
-    else if (gcol.isColourByLabel())
+    if (fcol.isSimpleColour())
     {
-      tt.insert(0, "Coloured by label text ");
+      return BASE_TOOLTIP;
     }
-    tt.append("; ").append(BASE_TOOLTIP);
-    return tt.toString();
+    String description = fcol.getDescription();
+    description = description.replaceAll("<", "&lt;");
+    description = description.replaceAll(">", "&gt;");
+    StringBuilder tt = new StringBuilder(description);
+    tt.append("<br>").append(BASE_TOOLTIP).append("</br>");
+    return JvSwingUtils.wrapTooltip(true, tt.toString());
   }
 
   public static void renderGraduatedColor(JLabel comp, FeatureColourI gcol,