X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FTreeCanvas.java;h=ead2a71a94ed067a42434217930e76d494ecdcf3;hb=6b406c397d41a0f2d84b75f13e7ab478932bf57d;hp=db5de1c3a9291565a14bc1c42581b59a2530e962;hpb=3e6b14950a06bb87c147493e4dfff0c4491ea25b;p=jalview.git diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index db5de1c..ead2a71 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -18,22 +18,17 @@ */ package jalview.gui; -import jalview.analysis.*; - -import jalview.datamodel.*; - -import jalview.schemes.*; - -import jalview.util.*; +import java.util.*; import java.awt.*; import java.awt.event.*; import java.awt.print.*; - -import java.util.*; - import javax.swing.*; +import jalview.analysis.*; +import jalview.datamodel.*; +import jalview.schemes.*; +import jalview.util.*; /** * DOCUMENT ME! @@ -41,7 +36,8 @@ import javax.swing.*; * @author $author$ * @version $Revision$ */ -public class TreeCanvas extends JPanel implements MouseListener, Runnable, +public class TreeCanvas + extends JPanel implements MouseListener, Runnable, Printable, MouseMotionListener { /** DOCUMENT ME!! */ @@ -215,7 +211,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, nodeLabel = nodeLabel + " : "; } - nodeLabel = nodeLabel + String.valueOf(node.getBootstrap()); + nodeLabel = nodeLabel + String.valueOf(node.bootstrap); } if (!nodeLabel.equals("")) @@ -269,9 +265,13 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, // Draw horizontal line g.drawLine(xstart, ypos, xend, ypos); if (node == highlightNode) + { g.fillRect(xend - 3, ypos - 3, 6, 6); + } else + { g.fillRect(xend - 2, ypos - 2, 4, 4); + } int ystart = (int) ( ( (SequenceNode) node.left()).ycount * chunk) + offy; @@ -284,10 +284,26 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, g.drawLine( (int) (height * scale) + offx, ystart, (int) (height * scale) + offx, yend); + String nodeLabel = ""; + if (showDistances && (node.dist > 0)) { - g.drawString(new Format("%-.2f").form(node.dist).trim(), xstart + 2, - ypos - 2); + nodeLabel = new Format("%-.2f").form(node.dist); + } + + if (showBootstrap) + { + if (showDistances) + { + nodeLabel = nodeLabel + " : "; + } + + nodeLabel = nodeLabel + String.valueOf(node.bootstrap); + } + + if (!nodeLabel.equals("")) + { + g.drawString(nodeLabel, xstart + 2, ypos - 2); } } } @@ -423,7 +439,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, return; } - if ( (node.left() == null) && (node.right() == null)) + if ( (node.left() == null) && (node.right() == null)) // TODO: internal node { node.color = c; @@ -682,8 +698,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, { Color col = JColorChooser.showDialog(this, "Select Sub-Tree Colour", highlightNode.color); - - setColor(highlightNode, col); + if (col!=null) + { + setColor(highlightNode, col); + } } else if (evt.getClickCount() > 1) @@ -827,11 +845,13 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } else + { cs = ColourSchemeProperty.getColour(sequences, av.alignment.getWidth(), ColourSchemeProperty. getColourName( av.getGlobalColourScheme())); + } cs.setThreshold(av.getGlobalColourScheme().getThreshold(), av.getIgnoreGapsConsensus()); @@ -842,7 +862,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, 0, av.alignment.getWidth() - 1); - sg.setName("JTreeGroup:"+sg.hashCode()); + sg.setName("JTreeGroup:" + sg.hashCode()); AlignmentPanel[] aps = getAssociatedPanels(); for (int a = 0; a < aps.length; a++) @@ -906,6 +926,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, return PaintRefresher.getAssociatedPanels(av.getSequenceSetId()); } else - return new AlignmentPanel[]{ap}; + { + return new AlignmentPanel[] + { + ap}; + } } }