JAL-908,JAL-701 - patch applet to strip HTML tags from HTML annotation description
[jalview.git] / src / jalview / appletgui / AnnotationLabels.java
index 64f5d0b..e383e9d 100755 (executable)
@@ -24,6 +24,7 @@ import java.awt.event.*;
 import java.awt.image.BufferedImage;
 
 import jalview.datamodel.*;
+import jalview.util.ParseHtmlBodyAndLinks;
 
 public class AnnotationLabels extends Panel implements ActionListener,
         MouseListener, MouseMotionListener
@@ -227,17 +228,14 @@ public class AnnotationLabels extends Panel implements ActionListener,
 
     if (row > -1)
     {
+      ParseHtmlBodyAndLinks phb = new ParseHtmlBodyAndLinks(av.alignment.getAlignmentAnnotation()[row].getDescription(true), true, "\n");
       if (tooltip == null)
       {
-        tooltip = new Tooltip(
-                ap.av.alignment.getAlignmentAnnotation()[row]
-                        .getDescription(true),
-                this);
+        tooltip = new Tooltip(phb.getNonHtmlContent(), this);
       }
       else
       {
-        tooltip.setTip(ap.av.alignment.getAlignmentAnnotation()[row]
-                .getDescription(true));
+        tooltip.setTip(phb.getNonHtmlContent());
       }
     }
     else if (tooltip != null)
@@ -330,7 +328,7 @@ public class AnnotationLabels extends Panel implements ActionListener,
 
   public void mouseReleased(MouseEvent evt)
   {
-    if (!dragCancelled)
+    if (!resizePanel && !dragCancelled)
     {
       int start = selectedRow;
 
@@ -647,7 +645,8 @@ public class AnnotationLabels extends Panel implements ActionListener,
   public void paint(Graphics g)
   {
     int w = getSize().width;
-    if (image == null || w != image.getWidth(this))
+    int h = getSize().height;
+    if (image == null || w != image.getWidth(this) || h!=image.getHeight(this) )
     {
       image = createImage(w, ap.annotationPanel.getSize().height);
     }