Hashtable nodeHash = new Hashtable();
- SequenceNode highlightNode;
+ BinaryNode highlightNode;
AlignmentPanel ap;
tree2.findHeight(tree2.getTopNode());
// Now have to calculate longest name based on the leaves
- Vector<SequenceNode> leaves = tree2.findLeaves(tree2.getTopNode());
+ Vector<BinaryNode> leaves = tree2.findLeaves(tree2.getTopNode());
boolean has_placeholders = false;
longestName = "";
for (int i = 0; i < leaves.size(); i++)
{
- SequenceNode lf = leaves.elementAt(i);
+ BinaryNode lf = leaves.elementAt(i);
- if (lf.isPlaceholder())
+ if (lf instanceof SequenceNode && ((SequenceNode) lf).isPlaceholder())
{
has_placeholders = true;
}
setMarkPlaceholders(has_placeholders);
}
- public void drawNode(Graphics g, SequenceNode node, float chunk,
+ public void drawNode(Graphics g, BinaryNode node, float chunk,
double scale, int width, int offx, int offy)
{
if (node == null)
g.drawString(nodeLabel, xstart + 2, ypos - 2);
}
- String name = (markPlaceholders && node.isPlaceholder())
- ? (PLACEHOLDER + node.getName())
- : node.getName();
+ String name = (markPlaceholders && node instanceof SequenceNode
+ && ((SequenceNode) node).isPlaceholder())
+ ? (PLACEHOLDER + node.getName())
+ : node.getName();
FontMetrics fm = g.getFontMetrics(font);
int charWidth = fm.stringWidth(name) + 3;
int charHeight = fm.getHeight();
}
else
{
- drawNode(g, (SequenceNode) node.left(), chunk, scale, width, offx,
+ drawNode(g, (BinaryNode) node.left(), chunk, scale, width, offx,
offy);
- drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx,
+ drawNode(g, (BinaryNode) node.right(), chunk, scale, width, offx,
offy);
double height = node.height;
}
else
{
- pickNode(pickBox, (BinaryNode) node.left(), chunk, scale, width,
- offx, offy);
+ pickNode(pickBox, (BinaryNode) node.left(), chunk, scale, width, offx,
+ offy);
pickNode(pickBox, (BinaryNode) node.right(), chunk, scale, width,
offx, offy);
}
}
else
{
- Vector<SequenceNode> leaves = tree.findLeaves(highlightNode);
+ Vector<BinaryNode> leaves = tree.findLeaves(highlightNode);
for (int i = 0; i < leaves.size(); i++)
{
Object ob = findElement(evt.getX(), evt.getY());
- if (ob instanceof SequenceNode)
+ if (ob instanceof BinaryNode)
{
- highlightNode = (SequenceNode) ob;
+ highlightNode = (BinaryNode) ob;
repaint();
}
else
threshold = (float) (x - offx)
/ (float) (getSize().width - labelLength - 2 * offx);
- List<SequenceNode> groups = tree.groupNodes(threshold);
+ List<BinaryNode> groups = tree.groupNodes(threshold);
setColor(tree.getTopNode(), Color.black);
av.setSelectionGroup(null);
}
- void colourGroups(List<SequenceNode> groups)
+ void colourGroups(List<BinaryNode> groups)
{
for (int i = 0; i < groups.size(); i++)
{
(int) (Math.random() * 255), (int) (Math.random() * 255));
setColor(groups.get(i), col.brighter());
- Vector<SequenceNode> l = tree.findLeaves(groups.get(i));
+ Vector<BinaryNode> l = tree.findLeaves(groups.get(i));
Vector<SequenceI> sequences = new Vector<>();
for (int j = 0; j < l.size(); j++)