X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationLabels.java;h=6da6cc385caf32f6b639565cf2948367b37d2298;hb=682ebcd21b2123786463a3f56cc6f7c17f361bae;hp=0ff6b73972794805c38830df1810a441ef4a0192;hpb=fd5f6d3eed59b5f6d9a7cc09e4ddeb7e78eb2f17;p=jalview.git diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 0ff6b73..6da6cc3 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -674,16 +674,65 @@ public class AnnotationLabels extends JPanel if (selectedRow > -1 && ap.av.getAlignment() .getAlignmentAnnotation().length > selectedRow) { - AlignmentAnnotation aa = ap.av.getAlignment() - .getAlignmentAnnotation()[selectedRow]; + AlignmentAnnotation[] anns = ap.av.getAlignment() + .getAlignmentAnnotation(); + AlignmentAnnotation aa = anns[selectedRow]; String desc = getTooltip(aa); this.setToolTipText(desc); - ap.alignFrame.setStatus(aa.label); + String msg = getStatusMessage(aa, anns); + ap.alignFrame.setStatus(msg); } } /** + * Constructs suitable text to show in the status bar when over an annotation + * label, containing the associated sequence name (if any), and the annotation + * labels (or all labels for a graph group annotation) + * + * @param aa + * @param anns + * @return + */ + static String getStatusMessage(AlignmentAnnotation aa, + AlignmentAnnotation[] anns) + { + if (aa == null) + { + return null; + } + + StringBuilder msg = new StringBuilder(32); + if (aa.sequenceRef != null) + { + msg.append(aa.sequenceRef.getName()).append(" : "); + } + + if (aa.graphGroup == -1) + { + msg.append(aa.label); + } + else if (anns != null) + { + boolean first = true; + for (int i = anns.length - 1; i >= 0; i--) + { + if (anns[i].graphGroup == aa.graphGroup) + { + if (!first) + { + msg.append(", "); + } + msg.append(anns[i].label); + first = false; + } + } + } + + return msg.toString(); + } + + /** * Answers a tooltip, formatted as html, containing the annotation description * (prefixed by associated sequence id if applicable), and the annotation * (non-positional) score if it has one. Answers null if neither description