eu.beesoft.gantt.chart
Class DependencyLayer

java.lang.Object
  extended by eu.beesoft.gantt.chart.Layer
      extended by eu.beesoft.gantt.chart.DependencyLayer

public class DependencyLayer
extends Layer

Paints dependencies between gantt nodes.


Constructor Summary
DependencyLayer()
          Default constructor.
 
Method Summary
 java.awt.Color getColor()
          Returns color used to paint dependencies.
protected  void paint(java.awt.Graphics g)
          Paints the dependencies between gantt nodes.This method simply checks for each Dependency if it is visible on screen and if so, it delegates the painting to the method paintDependency().
protected  void paintDependency(Dependency dependency, java.awt.Graphics g, GanttNode dependant, GanttNode dependsOn)
          Paints the dependency between dependant node and node on it depends.
protected  void paintLine(int x1, int y1, int x2, int y2, DependencyType type, java.awt.Graphics g)
          Paints a line between start point (x1, y1) and end point (x2, y2).
 void setColor(java.awt.Color dependencyColor)
          Sets color used to paint dependencies.
 
Methods inherited from class eu.beesoft.gantt.chart.Layer
getGantt, getGanttModel, getHeaderHeight, getChartComponent, getNodeAt, getPaintedNodes, getPosition, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DependencyLayer

public DependencyLayer()
Default constructor.

Method Detail

getColor

public java.awt.Color getColor()
Returns color used to paint dependencies.

Returns:
the dependency color

setColor

public void setColor(java.awt.Color dependencyColor)
Sets color used to paint dependencies.

Parameters:
dependencyColor - the dependency color to set

paint

protected void paint(java.awt.Graphics g)
Paints the dependencies between gantt nodes.This method simply checks for each Dependency if it is visible on screen and if so, it delegates the painting to the method paintDependency().

Specified by:
paint in class Layer
Parameters:
g - - the graphics context to use for painting

paintDependency

protected void paintDependency(Dependency dependency,
                               java.awt.Graphics g,
                               GanttNode dependant,
                               GanttNode dependsOn)
Paints the dependency between dependant node and node on it depends. Method determines coordinates of dependency start and end points and calls paintLine() to paint dependency.

Parameters:
dependency - - the Dependency to paint
g - - the graphics context to use for painting
dependant - - the node that depends on another node (by dependant is painted an arrow)
dependsOn - - the node on which the dependant depends

paintLine

protected void paintLine(int x1,
                         int y1,
                         int x2,
                         int y2,
                         DependencyType type,
                         java.awt.Graphics g)
Paints a line between start point (x1, y1) and end point (x2, y2).

Parameters:
x1 - - x-coordinate of start point
y1 - - y-coordinate of start point
x2 - - x-coordinate of end point
y2 - - y-coordinate of end point
type - - type of dependency, one of constants from Dependency .
g - - the graphics context to use for painting