if (!first)
{
tip.append("<br>");
+ first = false;
}
- first = false;
tip.append(anns[i].label);
String description = anns[i].annotations[column].description;
if (description != null && description.length() > 0)
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)
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
*
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);