X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdPanel.java;h=b9366ae7c72012f0b6350b78301d5653ccc52ee5;hb=fb1cdebe4a9d93839c81a2d3eb39e8da9cb83d64;hp=e6c30098210a01a442c51e9d25f8c261f9d3e9c4;hpb=fd618c7346eab858aa0039376872820aca37783a;p=jalview.git diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index e6c3009..b9366ae 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -70,49 +70,61 @@ public class IdPanel public void mouseMoved(MouseEvent e) { int seq = Math.max(0, alignPanel.seqPanel.findSeq(e)); + String tmp; if (seq > -1 && seq < av.alignment.getHeight()) { SequenceI sequence = av.alignment.getSequenceAt(seq); - StringBuffer tip = new StringBuffer(""); - tip.append(sequence.getDisplayId(true)); + StringBuffer tip = new StringBuffer(); + tip.append(""); + + int maxWidth = 0; if (sequence.getDescription() != null) { - tip.append("
"); - tip.append(sequence.getDescription()); - - //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) - { - tip.append("
" + features[i].featureGroup - + " " + features[i].getType() + " " + - features[i].description); - } - } - } - tip.append("
"); + tmp = sequence.getDescription(); + tip.append("
"+tmp); + maxWidth = Math.max(maxWidth, tmp.length()); } DBRefEntry[] dbrefs = sequence.getDatasetSequence().getDBRef(); if (dbrefs != null) { - tip.append(""); for (int i = 0; i < dbrefs.length; i++) { tip.append("
"); - tip.append(dbrefs[i].getSource() + " " - + dbrefs[i].getAccessionId()); + 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("
" + tmp); + maxWidth = Math.max(maxWidth, tmp.length()); + } } - tip.append("
"); + } + + if(maxWidth > 60) + { + tip.insert(0, "
"); + tip.append("
"); } tip.append(""); - setToolTipText(tip.toString()); + + setToolTipText(""+sequence.getDisplayId(true)+tip.toString()); } }