jebl.gui.trees.treeviewer_dev.painters
Class BasicLabelPainter

java.lang.Object
  extended by jebl.gui.trees.treeviewer_dev.painters.AbstractPainter<T>
      extended by jebl.gui.trees.treeviewer_dev.painters.LabelPainter<Node>
          extended by jebl.gui.trees.treeviewer_dev.painters.BasicLabelPainter
All Implemented Interfaces:
Painter<Node>

public class BasicLabelPainter
extends LabelPainter<Node>

A simple implementation of LabelPainter that can be used to display tip, node or branch labels. It can display, taxon names, branch lengths, node heights or other attributeNames of nodes.

Author:
Andrew Rambaut

Nested Class Summary
static class BasicLabelPainter.PainterIntent
           
 
Nested classes/interfaces inherited from interface jebl.gui.trees.treeviewer_dev.painters.Painter
Painter.Justification, Painter.Orientation
 
Field Summary
protected  String[] attributes
           
static String BRANCH_LENGTHS
           
protected  String displayAttribute
           
static String NODE_HEIGHTS
           
static String TAXON_NAMES
           
protected  TreePane treePane
           
 
Constructor Summary
BasicLabelPainter(BasicLabelPainter.PainterIntent intent)
           
 
Method Summary
 Rectangle2D calibrate(Graphics2D g2, Node item)
          Called to calibrate the painters for a given graphics context.
 String[] getAttributes()
           
 Decorator getBorderDecorator()
           
 double getHeightBound()
           
protected  String getLabel(Tree tree, Node node)
           
 double getPreferredHeight()
           
 double getPreferredWidth()
           
 Decorator getTextDecorator()
           
 void paint(Graphics2D g2, Node item, Painter.Justification justification, Rectangle2D bounds)
          Called to actually paint into the current graphics context.
 void setBorderDecorator(Decorator borderDecorator)
           
 void setDisplayAttribute(String displayAttribute)
           
 void setTextDecorator(Decorator textDecorator)
           
 void setTreePane(TreePane treePane)
          Called when the painter is installed in a TreePane.
 void setupAttributes(Tree tree)
           
 
Methods inherited from class jebl.gui.trees.treeviewer_dev.painters.LabelPainter
getBackground, getBorderPaint, getBorderStroke, getFont, getForeground, getNumberFormat, isVisible, setBackground, setBorder, setFont, setForeground, setNumberFormat, setVisible
 
Methods inherited from class jebl.gui.trees.treeviewer_dev.painters.AbstractPainter
addPainterListener, firePainterChanged, firePainterSettingsChanged, removePainterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAXON_NAMES

public static final String TAXON_NAMES
See Also:
Constant Field Values

NODE_HEIGHTS

public static final String NODE_HEIGHTS
See Also:
Constant Field Values

BRANCH_LENGTHS

public static final String BRANCH_LENGTHS
See Also:
Constant Field Values

displayAttribute

protected String displayAttribute

attributes

protected String[] attributes

treePane

protected TreePane treePane
Constructor Detail

BasicLabelPainter

public BasicLabelPainter(BasicLabelPainter.PainterIntent intent)
Method Detail

setupAttributes

public void setupAttributes(Tree tree)
Specified by:
setupAttributes in class LabelPainter<Node>

setTreePane

public void setTreePane(TreePane treePane)
Description copied from interface: Painter
Called when the painter is installed in a TreePane. Gives the painter a handle on the TreePane so that it get additional information.


getBorderDecorator

public Decorator getBorderDecorator()

setBorderDecorator

public void setBorderDecorator(Decorator borderDecorator)

getTextDecorator

public Decorator getTextDecorator()

setTextDecorator

public void setTextDecorator(Decorator textDecorator)

getLabel

protected String getLabel(Tree tree,
                          Node node)

calibrate

public Rectangle2D calibrate(Graphics2D g2,
                             Node item)
Description copied from interface: Painter
Called to calibrate the painters for a given graphics context. This should work out the preferred width and height (perhaps for the current font).


getPreferredWidth

public double getPreferredWidth()

getPreferredHeight

public double getPreferredHeight()

getHeightBound

public double getHeightBound()

paint

public void paint(Graphics2D g2,
                  Node item,
                  Painter.Justification justification,
                  Rectangle2D bounds)
Description copied from interface: Painter
Called to actually paint into the current graphics context. The painter should respect the bounds.


getAttributes

public String[] getAttributes()
Specified by:
getAttributes in class LabelPainter<Node>

setDisplayAttribute

public void setDisplayAttribute(String displayAttribute)
Specified by:
setDisplayAttribute in class LabelPainter<Node>