/*
- * 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.
*
package jalview.gui;
import java.util.*;
+import java.util.regex.Pattern;
import java.awt.*;
import java.awt.datatransfer.*;
else if (evt.getActionCommand().equals(HIDE))
{
aa[selectedRow].visible = false;
-
- if (aa[selectedRow].label.equals("Quality"))
- {
- ap.av.quality = null;
- }
}
else if (evt.getActionCommand().equals(DELETE))
{
aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
}
- ap.annotationPanel.adjustPanelHeight();
- ap.annotationScroller.validate();
- ap.paintAlignment(true);
+ ap.validateAnnotationDimensions(false);
+ ap.addNotify();
+ ap.repaint();
+ //validate();
+ //ap.paintAlignment(true);
}
/**
&& ap.av.alignment.getAlignmentAnnotation().length > selectedRow)
{
AlignmentAnnotation aa = ap.av.alignment.getAlignmentAnnotation()[selectedRow];
-
- StringBuffer desc = new StringBuffer("<html>");
-
+
+ StringBuffer desc = new StringBuffer();
if (aa.description != null
&& !aa.description.equals("New description"))
{
- desc.append(aa.getDescription(true));
- if (aa.hasScore)
- desc.append("<br>");
+ // TODO: we could refactor and merge this code with the code in jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature tooltips
+ desc.append(aa.getDescription(true).trim());
+ // check to see if the description is an html fragment.
+ if (desc.length()<6 || (desc.substring(0,6).toLowerCase().indexOf("<html>")<0))
+ {
+ // clean the description ready for embedding in html
+ desc = new StringBuffer(Pattern.compile("<").matcher(desc).replaceAll("<"));
+ desc.insert(0, "<html>");
+ } else {
+ // remove terminating html if any
+ int i=desc.substring(desc.length()-7).toLowerCase().lastIndexOf("</html>");
+ if (i>-1) {
+ desc.setLength(desc.length()-7+i);
+ }
+ }
+ if (aa.hasScore())
+ {
+ desc.append("<br/>");
+ }
+
+
+ } else {
+ // begin the tooltip's html fragment
+ desc.append("<html>");
}
if (aa.hasScore())
{
- desc.append("Score: " + aa.score);
+ // TODO: limit precision of score to avoid noise from imprecise doubles (64.7 becomes 64.7+/some tiny value).
+ desc.append(" Score: " + aa.score);
}
- if (desc.length() != 6)
+ if (desc.length() > 6)
{
desc.append("</html>");
this.setToolTipText(desc.toString());