import javax.swing.*;
import jalview.datamodel.*;
+import jalview.io.SequenceAnnotationReport;
import jalview.util.UrlLink;
/**
int lastid = -1;
boolean mouseDragging = false;
+ private final SequenceAnnotationReport seqAnnotReport;
/**
* Creates a new IdPanel object.
alignPanel = parent;
idCanvas = new IdCanvas(av);
linkImageURL = getClass().getResource("/images/link.gif").toString();
+ seqAnnotReport = new SequenceAnnotationReport(linkImageURL);
setLayout(new BorderLayout());
add(idCanvas, BorderLayout.CENTER);
addMouseListener(this);
addMouseWheelListener(this);
ToolTipManager.sharedInstance().registerComponent(this);
}
-
/**
* DOCUMENT ME!
*
{
SeqPanel sp = alignPanel.seqPanel;
int seq = Math.max(0, sp.findSeq(e));
- String tmp;
if (seq > -1 && seq < av.getAlignment().getHeight())
{
SequenceI sequence = av.getAlignment().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 (av.isShowDbRefs() && 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();
- SequenceFeature[] tfeat = new SequenceFeature[1];
- if (av.isShowNpFeats() && features != null)
- {
- for (int i = 0; i < features.length; i++)
- {
- if (features[i].begin == 0 && features[i].end == 0)
- {
- int sz = -tip.length();
- tfeat[0] = features[i];
- sp.appendFeatures(tip, linkImageURL, 0, tfeat,
- sp.seqCanvas.fr.minmax);
- sz += tip.length();
- maxWidth = Math.max(maxWidth, sz);
- }
- }
- }
-
- if (maxWidth > 60)
- {
- tip.insert(0, "<table width=350 border=0><tr><td><i>");
- tip.append("</i></td></tr></table>");
- }
-
- tip.append("</html>");
-
+ seqAnnotReport.createSequenceAnnotationReport(tip, sequence,
+ av.isShowDbRefs(), av.isShowNpFeats(),
+ sp.seqCanvas.fr.minmax);
setToolTipText("<html>" + sequence.getDisplayId(true) + " "
- + tip.toString());
+ + tip.toString()+"</html>");
}
}