X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;fp=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=c97ee5322f79f9b9ae36dec25f97632b35732ebf;hb=88b4327a871a9c732f9c5e94854bf8957fac905f;hp=ea32684bb2d9239c9260b6f259fd59a5428af766;hpb=32f5ed52602d35e1e2e218f06e7fa15094b032e9;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index ea32684..c97ee53 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -1275,8 +1275,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, if (!first) { tip.append("
"); + first = false; } - first = false; tip.append(anns[i].label); String description = anns[i].annotations[column].description; if (description != null && description.length() > 0) @@ -1290,7 +1290,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, else if (column < ann.annotations.length && ann.annotations[column] != null) { - tooltip = ann.annotations[column].description; + tooltip = getAnnotationBriefSummary(ann.annotations[column]); } // TODO abstract tooltip generator so different implementations can be built if (ann.graph == AlignmentAnnotation.CONTACT_MAP) @@ -1337,6 +1337,31 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, return tooltip; } + private static String getAnnotationBriefSummary(Annotation a) + { + String tt = a.description; + if (tt == null || tt.trim().length() == 0) + { + tt = String.valueOf(a.displayCharacter); + } + if ((tt == null || tt.length() == 0) && !Float.isNaN(a.value)) + { + if (a.value == Math.floor(a.value)) // likely integer value + { + tt = String.format("%.0f", a.value); + } + else // display as is + { + tt = String.valueOf(a.value); + } + } + if (tt == null || tt.trim().length() == 0) + { + tt = String.valueOf(a.secondaryStructure); + } + return tt; + } + /** * Constructs and returns the status bar message * @@ -1357,7 +1382,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, if (column < ann.annotations.length && ann.annotations[column] != null) { - String description = ann.annotations[column].description; + String description = getAnnotationBriefSummary( + ann.annotations[column]); if (description != null && description.trim().length() > 0) { text.append(" ").append(description);