X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FIdPanel.java;h=b9366ae7c72012f0b6350b78301d5653ccc52ee5;hb=fb1cdebe4a9d93839c81a2d3eb39e8da9cb83d64;hp=e3a81dc7678fe775202154eb2f1a75b61e88edec;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index e3a81dc..b9366ae 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -32,7 +32,7 @@ import jalview.datamodel.*; */ public class IdPanel extends JPanel implements MouseListener, - MouseMotionListener + MouseMotionListener, MouseWheelListener { protected IdCanvas idCanvas; protected AlignViewport av; @@ -58,6 +58,7 @@ public class IdPanel add(idCanvas, BorderLayout.CENTER); addMouseListener(this); addMouseMotionListener(this); + addMouseWheelListener(this); ToolTipManager.sharedInstance().registerComponent(this); } @@ -69,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()); } - tip.append("
"); + } + + + //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()); + } + } + } + + if(maxWidth > 60) + { + tip.insert(0, "
"); + tip.append("
"); } tip.append(""); - setToolTipText(tip.toString()); + + setToolTipText(""+sequence.getDisplayId(true)+tip.toString()); } } @@ -136,7 +149,20 @@ public class IdPanel } lastid = seq; - alignPanel.repaint(); + alignPanel.paintAlignment(true); + } + + public void mouseWheelMoved(MouseWheelEvent e) + { + e.consume(); + if (e.getWheelRotation() > 0) + { + alignPanel.scrollUp(false); + } + else + { + alignPanel.scrollUp(true); + } } /** @@ -267,7 +293,7 @@ public class IdPanel selectSeq(seq); } - alignPanel.repaint(); + alignPanel.paintAlignment(true); } /** @@ -407,7 +433,7 @@ public class IdPanel running = false; } - alignPanel.repaint(); + alignPanel.paintAlignment(false); try {