treebolic.view
Class AbstractPainter

java.lang.Object
  extended by treebolic.view.Mapper
      extended by treebolic.view.AbstractPainter
Direct Known Subclasses:
Painter

public abstract class AbstractPainter
extends Mapper

Painter base class

Author:
Bernard Bou

Field Summary
private static int FONTDEFAULTSIZE
          Font default size
private static int FONTDEFAULTSTEP
          Font size increment/decrement step
protected  boolean hyperbolicEdges
          Whether to render edges as hyperbolic edges
protected  boolean isDragging
          Whether a dragging operation is pending
protected static int NFONTS
          Number of font sizes
protected  java.awt.Color theBackColor
          Default background color
private static java.awt.Color theBackColor0
          Initial default background color
 java.awt.Image theBackgroundImage
          Background (tiled) image
 java.awt.Image theDefaultEdgeImage
          Default edge image
 java.awt.Image theDefaultNodeImage
          Default node image
 java.awt.Image theDefaultTreeEdgeImage
          Default tree edge image
protected  java.awt.Color theEdgeColor
          Default edge color
private static java.awt.Color theEdgeColor0
          Initial default tree edge color
protected  int theEdgeStyle
          Default edge style
protected  java.awt.Font[] theFonts
          Fonts
protected  java.awt.Color theForeColor
          Default foreground color
private static java.awt.Color theForeColor0
          Initial default foreground color
protected  java.awt.Graphics theGraphics
          Cached graphics context
protected  java.awt.Color theNodeBackColor
          Default node background color
private static java.awt.Color theNodeBackColor0
          Initial default node background color
protected  java.awt.Color theNodeForeColor
          Default node foreground color
private static java.awt.Color theNodeForeColor0
          Initial default node foreground color
protected  java.awt.Color theTreeEdgeColor
          Default tree edge color
private static java.awt.Color theTreeEdgeColor0
          Initial default tree edge color
protected  int theTreeEdgeStyle
          Default tree edge style
protected static int theXInset
          x inset for node box
protected static int theYInset
          y inset for node box
 
Fields inherited from class treebolic.view.Mapper
theLeft, theScaleX, theScaleY, theSize, theTop, theXShift, theYShift
 
Constructor Summary
AbstractPainter()
          Constructor
 
Method Summary
 void enterDrag()
          Enter drag mode
 boolean getHyperbolicEdges()
          Get edge rendering mode
 void leaveDrag()
          Leave drag mode
abstract  void paint(INode thisRoot, java.util.List<IEdge> thisEdgeList)
          Paint
abstract  void paintBackground()
          Paint background
 void resetColors()
          Reset colors
 void setColors(java.awt.Color thisBackColor, java.awt.Color thisForeColor, java.awt.Color thisNodeBackColor, java.awt.Color thisNodeForeColor, java.awt.Color thisTreeEdgeColor, java.awt.Color thisEdgeColor)
          Set colors
 void setEdgeStyles(java.lang.Integer thisTreeEdgeStyle, java.lang.Integer thisEdgeStyle)
          Set default edge styles
 void setFonts(java.lang.String thisFontFace, java.lang.Integer thisFontSize, java.lang.Integer thisFontSizeStep)
          Set fonts
 void setHyperbolicEdges(java.lang.Boolean thisFlag)
          Set edge rendering mode
 void setImages(java.awt.Image thisBackgroundImage, java.awt.Image thisDefaultNodeImage, java.awt.Image thisDefaultTreeEdgeImage, java.awt.Image thisDefaultEdgeImage)
          Set images
 void setup(java.awt.Graphics thisGraphics, java.awt.Dimension thisSize)
          Set up graphics context for the painter to work on
 
Methods inherited from class treebolic.view.Mapper
computeScale, getSize, getViewLocation, getXShift, getYShift, hUnitCircleToView, hViewToUnitCircle, setXShift, setYShift, setZoomFactor, viewToUnitCircle, wUnitCircleToView, wViewToUnitCircle, xUnitCircleToView, xViewToUnitCircle, yUnitCircleToView, yViewToUnitCircle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NFONTS

protected static final int NFONTS
Number of font sizes

See Also:
Constant Field Values

FONTDEFAULTSIZE

private static final int FONTDEFAULTSIZE
Font default size

See Also:
Constant Field Values

FONTDEFAULTSTEP

private static final int FONTDEFAULTSTEP
Font size increment/decrement step

See Also:
Constant Field Values

theXInset

protected static final int theXInset
x inset for node box

See Also:
Constant Field Values

theYInset

protected static final int theYInset
y inset for node box

See Also:
Constant Field Values

theBackColor0

private static final java.awt.Color theBackColor0
Initial default background color


theForeColor0

private static final java.awt.Color theForeColor0
Initial default foreground color


theNodeBackColor0

private static final java.awt.Color theNodeBackColor0
Initial default node background color


theNodeForeColor0

private static final java.awt.Color theNodeForeColor0
Initial default node foreground color


theTreeEdgeColor0

private static final java.awt.Color theTreeEdgeColor0
Initial default tree edge color


theEdgeColor0

private static final java.awt.Color theEdgeColor0
Initial default tree edge color


theGraphics

protected java.awt.Graphics theGraphics
Cached graphics context


isDragging

protected boolean isDragging
Whether a dragging operation is pending


hyperbolicEdges

protected boolean hyperbolicEdges
Whether to render edges as hyperbolic edges


theFonts

protected java.awt.Font[] theFonts
Fonts


theBackColor

protected java.awt.Color theBackColor
Default background color


theForeColor

protected java.awt.Color theForeColor
Default foreground color


theNodeBackColor

protected java.awt.Color theNodeBackColor
Default node background color


theNodeForeColor

protected java.awt.Color theNodeForeColor
Default node foreground color


theTreeEdgeColor

protected java.awt.Color theTreeEdgeColor
Default tree edge color


theEdgeColor

protected java.awt.Color theEdgeColor
Default edge color


theTreeEdgeStyle

protected int theTreeEdgeStyle
Default tree edge style


theEdgeStyle

protected int theEdgeStyle
Default edge style


theDefaultNodeImage

public java.awt.Image theDefaultNodeImage
Default node image


theDefaultTreeEdgeImage

public java.awt.Image theDefaultTreeEdgeImage
Default tree edge image


theDefaultEdgeImage

public java.awt.Image theDefaultEdgeImage
Default edge image


theBackgroundImage

public java.awt.Image theBackgroundImage
Background (tiled) image

Constructor Detail

AbstractPainter

public AbstractPainter()
Constructor

Method Detail

paintBackground

public abstract void paintBackground()
Paint background


paint

public abstract void paint(INode thisRoot,
                           java.util.List<IEdge> thisEdgeList)
Paint

Parameters:
thisRoot - starting node
thisEdgeList - edges

setup

public void setup(java.awt.Graphics thisGraphics,
                  java.awt.Dimension thisSize)
Set up graphics context for the painter to work on

Parameters:
thisGraphics - graphics context to work on
thisSize - size of the graphics context

setFonts

public void setFonts(java.lang.String thisFontFace,
                     java.lang.Integer thisFontSize,
                     java.lang.Integer thisFontSizeStep)
Set fonts

Parameters:
thisFontFace - font
thisFontSize - font size
thisFontSizeStep - font size increment/decrement step

setColors

public void setColors(java.awt.Color thisBackColor,
                      java.awt.Color thisForeColor,
                      java.awt.Color thisNodeBackColor,
                      java.awt.Color thisNodeForeColor,
                      java.awt.Color thisTreeEdgeColor,
                      java.awt.Color thisEdgeColor)
Set colors

Parameters:
thisBackColor - background default color
thisForeColor - foreground default color
thisNodeBackColor - node background default color
thisNodeForeColor - node foreground default color
thisTreeEdgeColor - tree edge default color
thisEdgeColor - edge default color

resetColors

public void resetColors()
Reset colors


setEdgeStyles

public void setEdgeStyles(java.lang.Integer thisTreeEdgeStyle,
                          java.lang.Integer thisEdgeStyle)
Set default edge styles

Parameters:
thisTreeEdgeStyle - default tree edge style
thisEdgeStyle - default edge style

setImages

public void setImages(java.awt.Image thisBackgroundImage,
                      java.awt.Image thisDefaultNodeImage,
                      java.awt.Image thisDefaultTreeEdgeImage,
                      java.awt.Image thisDefaultEdgeImage)
Set images

Parameters:
thisBackgroundImage - background image
thisDefaultNodeImage - default node image
thisDefaultTreeEdgeImage - default tree edge image
thisDefaultEdgeImage - default edge image

setHyperbolicEdges

public void setHyperbolicEdges(java.lang.Boolean thisFlag)
Set edge rendering mode

Parameters:
thisFlag - true if edges are rendered as arcs

getHyperbolicEdges

public boolean getHyperbolicEdges()
Get edge rendering mode

Returns:
true if edges are rendered as arcs

enterDrag

public void enterDrag()
Enter drag mode


leaveDrag

public void leaveDrag()
Leave drag mode