apply version 2.7 copyright
[jalview.git] / src / jalview / appletgui / AnnotationLabels.java
index 27c579a..5140024 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -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,13 +328,13 @@ public class AnnotationLabels extends Panel implements ActionListener,
 
   public void mouseReleased(MouseEvent evt)
   {
-    if (!dragCancelled)
+    if (!resizePanel && !dragCancelled)
     {
       int start = selectedRow;
 
       int end = getSelectedRow(evt.getY() + scrollOffset);
 
-      if (start != end)
+      if (start>-1 && start != end)
       {
         // Swap these annotations
         AlignmentAnnotation startAA = ap.av.alignment
@@ -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);
     }