- SequenceI sequence = av.alignment.getSequenceAt(seq);
- StringBuffer tip = new StringBuffer();
- tip.append("<i>");
-
- int maxWidth = 0;
- if (sequence.getDescription() != null)
- {
- tmp = sequence.getDescription();
- tip.append("<br>"+tmp);
- maxWidth = Math.max(maxWidth, tmp.length());
- }
-
- DBRefEntry[] dbrefs = sequence.getDatasetSequence().getDBRef();
- if (dbrefs != null)
- {
- for (int i = 0; i < dbrefs.length; i++)
- {
- tip.append("<br>");
- tmp = dbrefs[i].getSource() + " " + dbrefs[i].getAccessionId();
- tip.append(tmp);
- maxWidth = Math.max(maxWidth, tmp.length());
- }
- }
-
-
- //ADD NON POSITIONAL SEQUENCE INFO
- SequenceFeature[] features = sequence.getDatasetSequence().
- getSequenceFeatures();
- if (features != null)
- {
- for (int i = 0; i < features.length; i++)
- {
- if (features[i].begin == 0 && features[i].end == 0)
- {
- tmp = features[i].featureGroup
- + " " + features[i].getType() + " " +
- features[i].description;
- tip.append("<br>" + tmp);
- maxWidth = Math.max(maxWidth, tmp.length());
- }
- }
- }
-
- if(maxWidth > 60)
- {
- tip.insert(0, "<table width=350 border=0><tr><td><i>");
- tip.append("</i></td></tr></table>");
- }
-
- tip.append("</html>");
-
- setToolTipText("<html>"+sequence.getDisplayId(true)+tip.toString());
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
+ StringBuilder tip = new StringBuilder(64);
+ seqAnnotReport.createTooltipAnnotationReport(tip, sequence,
+ av.isShowDBRefs(), av.isShowNPFeats(),
+ sp.seqCanvas.fr.getMinMax());
+ setToolTipText(JvSwingUtils.wrapTooltip(true,
+ sequence.getDisplayId(true) + " " + tip.toString()));