pal.gui
Class TreePainter
java.lang.Object
|
+--pal.gui.TreePainter
- All Implemented Interfaces:
- Painter
- Direct Known Subclasses:
- TreePainterCircular, TreePainterNormal
- public abstract class TreePainter
- extends java.lang.Object
- implements Painter
A class that can paint a tree into a Graphics object.
Constructor Summary |
TreePainter(Tree toDisplay,
java.lang.String title,
boolean showTitle)
|
Method Summary |
protected void |
doScale(java.awt.Graphics g,
double xScale,
int x,
int y)
|
void |
doTitle(java.awt.Graphics g,
int x,
int y)
|
static void |
drawSymbol(java.awt.Graphics g,
int x,
int y,
int width,
int index)
|
protected int |
getBootstrapValue(PositionedNode node)
Returns -1 if no bootstrap value available |
protected static double |
getMaxLeafTime(Node node)
|
protected java.awt.Color |
getNodeLabelColour(Node n,
java.awt.Color defaultColour)
|
protected java.lang.String |
getNodeName(Node node)
|
int |
getPenWidth()
|
protected double |
getSizeOfScale(double target)
|
TimeOrderCharacterData |
getTimeOrderCharacterData()
|
java.lang.String |
getTitle()
|
protected Tree |
getTree()
|
boolean |
isShowingInternalLabels()
|
boolean |
isShowingNodeHeights()
|
boolean |
isShowTitle()
|
boolean |
isUsingColor()
|
boolean |
isUsingSymbols()
|
void |
setAttributeName(java.lang.String name)
|
void |
setColouriser(NameColouriser nc)
|
void |
setLabelMapping(LabelMapping lp)
|
void |
setPenWidth(int p)
|
void |
setShowingNodeHeights(boolean s)
|
void |
setTimeOrderCharacterData(TimeOrderCharacterData tocd)
|
void |
setTitle(java.lang.String title)
|
void |
setTree(Tree tree)
|
void |
setUsingColor(boolean use)
|
void |
setUsingSymbols(boolean use)
Sets whether the tree is painted with symbols. |
protected void |
standardTreePrep()
Rotates the tree by leaf count, creates a positioned node version of the
trees root and calculates postions and width and height information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BACKGROUND
public static final java.awt.Color BACKGROUND
FOREGROUND
public static final java.awt.Color FOREGROUND
NORMAL_LABEL_COLOR
public static final java.awt.Color NORMAL_LABEL_COLOR
HILITED_LABEL_COLOR
public static final java.awt.Color HILITED_LABEL_COLOR
BOOTSTRAP_SUPPORT_COLOUR
public static final java.awt.Color BOOTSTRAP_SUPPORT_COLOUR
treeNode
public PositionedNode treeNode
title_
public java.lang.String title_
attName
protected java.lang.String attName
showingInternalLabels
protected boolean showingInternalLabels
- determines whether internal nodes are labelled
TreePainter
public TreePainter(Tree toDisplay,
java.lang.String title,
boolean showTitle)
- Parameters:
toDisplay
- the tree being painted.title
- the title of the tree.showTitle
- true if a title is being displayed.nc
- A name colouriser, may be null.
getBootstrapValue
protected int getBootstrapValue(PositionedNode node)
- Returns -1 if no bootstrap value available
standardTreePrep
protected void standardTreePrep()
- Rotates the tree by leaf count, creates a positioned node version of the
trees root and calculates postions and width and height information.
setAttributeName
public final void setAttributeName(java.lang.String name)
setPenWidth
public final void setPenWidth(int p)
getPenWidth
public final int getPenWidth()
setTree
public final void setTree(Tree tree)
setUsingColor
public final void setUsingColor(boolean use)
isUsingColor
public final boolean isUsingColor()
setShowingNodeHeights
public final void setShowingNodeHeights(boolean s)
isShowingNodeHeights
public final boolean isShowingNodeHeights()
isShowingInternalLabels
public final boolean isShowingInternalLabels()
getTimeOrderCharacterData
public final TimeOrderCharacterData getTimeOrderCharacterData()
setTimeOrderCharacterData
public final void setTimeOrderCharacterData(TimeOrderCharacterData tocd)
isUsingSymbols
public final boolean isUsingSymbols()
setUsingSymbols
public final void setUsingSymbols(boolean use)
- Sets whether the tree is painted with symbols. This can
only be set to true of a TimeOrderCharacterData has been set.
getTree
protected final Tree getTree()
getSizeOfScale
protected final double getSizeOfScale(double target)
getMaxLeafTime
protected static final double getMaxLeafTime(Node node)
drawSymbol
public static final void drawSymbol(java.awt.Graphics g,
int x,
int y,
int width,
int index)
isShowTitle
public final boolean isShowTitle()
setColouriser
public final void setColouriser(NameColouriser nc)
setLabelMapping
public final void setLabelMapping(LabelMapping lp)
setTitle
public final void setTitle(java.lang.String title)
getNodeName
protected final java.lang.String getNodeName(Node node)
getTitle
public final java.lang.String getTitle()
doTitle
public final void doTitle(java.awt.Graphics g,
int x,
int y)
doScale
protected final void doScale(java.awt.Graphics g,
double xScale,
int x,
int y)
getNodeLabelColour
protected final java.awt.Color getNodeLabelColour(Node n,
java.awt.Color defaultColour)