JAL-3132 set status message when over sequence id or annotation label
[jalview.git] / src / jalview / gui / IdPanel.java
index 6cb4e17..579229c 100755 (executable)
@@ -95,11 +95,10 @@ public class IdPanel extends JPanel
   }
 
   /**
-   * Respond to mouse movement by constructing tooltip text for the sequence id
-   * under the mouse.
+   * Responds to mouse movement by setting tooltip text for the sequence id
+   * under the mouse (or possibly annotation label, when in wrapped mode)
    * 
    * @param e
-   *          DOCUMENT ME!
    */
   @Override
   public void mouseMoved(MouseEvent e)
@@ -114,6 +113,7 @@ public class IdPanel extends JPanel
       AlignmentAnnotation annotation = av.getAlignment()
               .getAlignmentAnnotation()[pos.annotationIndex];
       setToolTipText(AnnotationLabels.getTooltip(annotation));
+      alignPanel.alignFrame.setStatus(annotation.label);
     }
     else
     {
@@ -122,10 +122,16 @@ public class IdPanel extends JPanel
       {
         SequenceI sequence = av.getAlignment().getSequenceAt(seq);
         StringBuilder tip = new StringBuilder(64);
+        tip.append(sequence.getDisplayId(true)).append(" ");
         seqAnnotReport.createTooltipAnnotationReport(tip, sequence,
                 av.isShowDBRefs(), av.isShowNPFeats(), sp.seqCanvas.fr);
-        setToolTipText(JvSwingUtils.wrapTooltip(true,
-                sequence.getDisplayId(true) + " " + tip.toString()));
+        setToolTipText(JvSwingUtils.wrapTooltip(true, tip.toString()));
+
+        StringBuilder text = new StringBuilder();
+        text.append("Sequence ").append(String.valueOf(seq + 1))
+                .append(" ID: ")
+                .append(sequence.getName());
+        alignPanel.alignFrame.setStatus(text.toString());
       }
     }
   }
@@ -220,13 +226,12 @@ public class IdPanel extends JPanel
     }
 
     MousePos pos = alignPanel.getSeqPanel().findMousePosition(e);
-    if (pos.isOverAnnotation())
+    int seq = pos.seqIndex;
+    if (pos.isOverAnnotation() || seq < 0)
     {
-      // mouse is over annotation label in wrapped mode
       return;
     }
 
-    int seq = pos.seqIndex;
     String id = av.getAlignment().getSequenceAt(seq).getName();
     String url = Preferences.sequenceUrlLinks.getPrimaryUrl(id);