- if ((node.left() == null) && (node.right() == null))
- {
- // Drawing leaf node
- float height = node.height;
- float dist = node.dist;
-
- int xstart = (int) ((height - dist) * scale) + offx;
- int xend = (int) (height * scale) + offx;
-
- int ypos = (int) (node.ycount * chunk) + offy;
-
- if (node.element() instanceof SequenceI)
- {
- SequenceI seq = (SequenceI)((SequenceNode) node).element();
-
- if (av.getSequenceColour(seq) == Color.white)
- {
- g.setColor(Color.black);
- }
- else
- {
- g.setColor(av.getSequenceColour(seq).darker());
- }
- }
- else
- {
- g.setColor(Color.black);
- }
-
- // Draw horizontal line
- g.drawLine(xstart, ypos, xend, ypos);
-
- String nodeLabel = "";
-
- if (showDistances && (node.dist > 0))
- {
- nodeLabel = new Format("%-.2f").form(node.dist);
- }
-
- if (showBootstrap)
- {
- if (showDistances)
- {
- nodeLabel = nodeLabel + " : ";
- }
-
- nodeLabel = nodeLabel + String.valueOf(node.getBootstrap());
- }
-
- if (!nodeLabel.equals(""))
- {
- g.drawString(nodeLabel, xstart+2, ypos - 2);
- }
-
- String name = (markPlaceholders && node.isPlaceholder())
- ? (PLACEHOLDER + node.getName()) : node.getName();
-
- int charWidth = fm.stringWidth(name) + 3;
- int charHeight = font.getSize();
-
- Rectangle rect = new Rectangle(xend+10, ypos-charHeight/2,
- charWidth, charHeight);
-
- nameHash.put((SequenceI) node.element(), rect);
-
- // Colour selected leaves differently
- SequenceGroup selected = av.getSelectionGroup();
-
- if ((selected != null) &&
- selected.getSequences(false).contains((SequenceI) node.element()))
- {
- g.setColor(Color.gray);
-
- g.fillRect(xend + 10, ypos-charHeight/2, charWidth,
- charHeight);
- g.setColor(Color.white);
- }
-
- g.drawString(name, xend + 10, ypos+fm.getDescent());
- g.setColor(Color.black);
- }
- else
- {
- drawNode(g, (SequenceNode) node.left(), chunk, scale, width, offx,
- offy);
- drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx,
- offy);
-
- float height = node.height;
- float dist = node.dist;
-
- int xstart = (int) ((height - dist) * scale) + offx;
- int xend = (int) (height * scale) + offx;
- int ypos = (int) (node.ycount * chunk) + offy;
-
- g.setColor(((SequenceNode) node).color.darker());
-
- // 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;
- int yend = (int) (((SequenceNode) node.right()).ycount * chunk) +
- offy;
-
- Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);
- nodeHash.put(node, pos);
-
- g.drawLine((int) (height * scale) + offx, ystart,
- (int) (height * scale) + offx, yend);
-
- if (showDistances && (node.dist > 0))
- {
- g.drawString(new Format("%-.2f").form(node.dist).trim(), xstart+2,
- ypos - 2);
- }
- }
- }