lib
Class StandardDiagramRenderer

java.lang.Object
  extended by lib.StandardDiagramRenderer
All Implemented Interfaces:
IRenderer

public class StandardDiagramRenderer
extends java.lang.Object
implements IRenderer

The standard diagram renderer is useful for producing coloured displays of the node hierarchy in a top to bottom, left to right non-proportional tree structure.

Version:
1.0
Author:
CobaltSoftware (abode.devteam@cobaltsoftware.net)

Field Summary
private  int HEIGHT
           
private  double HEIGHT_BASE
           
protected  boolean layoutInvalid
           
private  double SCALAR
           
private  int WIDTH
           
private  double WIDTH_BASE
           
private  int XSPACING
           
private  double XSPACING_BASE
           
private  int yDepth
           
private  int YSPACING
           
private  double YSPACING_BASE
           
 
Constructor Summary
StandardDiagramRenderer()
          Initialize the diagram renderer
 
Method Summary
 int getHeight()
          Get the height of buttons on the diagram
 int getWidth()
          Get the width of the buttons on the diagram
 int getXSpacing()
          Get the X spacing
 int getYSpacing()
          Get the Y spacing
 double getZoomLevel()
          Get our current zoom level
 void invalidateLayout()
           
private  void layoutButton(JDiagram diagram, java.awt.Dimension dimensions, JTreeNode button, int x, int y)
          Draw the button onto the form at the relevant position
private  void layoutNodes(JDiagram diagram, java.awt.Dimension dimensions, JTreeNode node, int xDepth)
          Recursively render the diagram
 void layoutNodes(JDiagram diagram, JTreeNode root)
          Lay out a hierarchy of nodes onto the diagram
 void loadConfiguration()
          Reload attributes from the configuration database.
 java.awt.AlphaComposite makeComposite(float alpha)
          Create a composite colour for transparency
 void paintDiagram(JDiagram diagram, java.awt.Graphics g)
          Paint a JDiagram for the user
private  void paintRecursively(java.awt.Graphics g, JTreeNode node)
          Recursively iterate through the tree and draw the lines connecting buttons
 void paintTreeNode(JTreeNode node, java.awt.Graphics g)
          Paint an individual tree node
 void setXSpacing(int value)
          Reset the X Spacing
 void setYSpacing(int value)
          Reset the Y spacing
 void setZoomLevel(double zoom)
          Reset the zoom level of the diagram
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIDTH_BASE

private double WIDTH_BASE

HEIGHT_BASE

private double HEIGHT_BASE

WIDTH

private int WIDTH

HEIGHT

private int HEIGHT

SCALAR

private double SCALAR

yDepth

private int yDepth

XSPACING_BASE

private double XSPACING_BASE

YSPACING_BASE

private double YSPACING_BASE

XSPACING

private int XSPACING

YSPACING

private int YSPACING

layoutInvalid

protected boolean layoutInvalid
Constructor Detail

StandardDiagramRenderer

public StandardDiagramRenderer()
Initialize the diagram renderer

Method Detail

loadConfiguration

public void loadConfiguration()
Reload attributes from the configuration database.


getZoomLevel

public double getZoomLevel()
Get our current zoom level

Specified by:
getZoomLevel in interface IRenderer
Returns:
Current zoom level

setXSpacing

public void setXSpacing(int value)
Reset the X Spacing

Parameters:
value - New value

setYSpacing

public void setYSpacing(int value)
Reset the Y spacing

Parameters:
value - New value

getXSpacing

public int getXSpacing()
Get the X spacing

Returns:
X Spacing

getYSpacing

public int getYSpacing()
Get the Y spacing

Returns:
Y spacing between diagram elements

getWidth

public int getWidth()
Get the width of the buttons on the diagram

Returns:
Width of buttons

getHeight

public int getHeight()
Get the height of buttons on the diagram

Returns:
height of buttons

setZoomLevel

public void setZoomLevel(double zoom)
Reset the zoom level of the diagram

Specified by:
setZoomLevel in interface IRenderer
Parameters:
zoom - New zoom level

paintDiagram

public void paintDiagram(JDiagram diagram,
                         java.awt.Graphics g)
Paint a JDiagram for the user

Specified by:
paintDiagram in interface IRenderer
Parameters:
diagram - Diagram to paint to.
g - Graphics object to paint with.

paintRecursively

private void paintRecursively(java.awt.Graphics g,
                              JTreeNode node)
Recursively iterate through the tree and draw the lines connecting buttons


paintTreeNode

public void paintTreeNode(JTreeNode node,
                          java.awt.Graphics g)
Paint an individual tree node

Specified by:
paintTreeNode in interface IRenderer
Parameters:
node - Node to paint.
g - Graphics object to paint with.

makeComposite

public java.awt.AlphaComposite makeComposite(float alpha)
Create a composite colour for transparency


layoutNodes

public void layoutNodes(JDiagram diagram,
                        JTreeNode root)
Lay out a hierarchy of nodes onto the diagram

Specified by:
layoutNodes in interface IRenderer
Parameters:
diagram - Diagram to lay out the nodes on.
root - Root of the hierachy of nodes.

layoutNodes

private void layoutNodes(JDiagram diagram,
                         java.awt.Dimension dimensions,
                         JTreeNode node,
                         int xDepth)
Recursively render the diagram


invalidateLayout

public void invalidateLayout()

layoutButton

private void layoutButton(JDiagram diagram,
                          java.awt.Dimension dimensions,
                          JTreeNode button,
                          int x,
                          int y)
Draw the button onto the form at the relevant position