com.dlsc.flexgantt.swing.layer.system
Class RelationshipLayer

java.lang.Object
  extended by com.dlsc.flexgantt.swing.layer.AbstractLayer
      extended by com.dlsc.flexgantt.swing.layer.system.AbstractSystemLayer
          extended by com.dlsc.flexgantt.swing.layer.system.RelationshipLayer

public class RelationshipLayer
extends AbstractSystemLayer

The relationship layer is reponsible for visualizing the relationships that might exist between two different timeline objects. Relationships are visualized by a line that starts at the end of the source object of the relationship and that ends at the beginning of the target object of the relationship. An arrow is shown at the end of the line. Due to several technical constraints the layer always has to render all relationships, hence the number of relationships shown in a Gantt chart should not be too large.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
IGanttChartModel.getRelationships()

Field Summary
 
Fields inherited from class com.dlsc.flexgantt.swing.layer.AbstractLayer
alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE
 
Constructor Summary
RelationshipLayer(LayerContainer lc)
           
 
Method Summary
 IRelationshipRenderer getRelationshipRenderer(java.lang.Class cl)
          Returns a renderer for drawing a relationship.
 boolean isVisible()
          Determines whether the layer is currently visible or not.
protected  void paintLayer(java.awt.Graphics g)
           
protected  void paintRelationship(java.awt.Graphics g, int w, int h, IRelationship relationship, IGanttChartModel model)
          Paints the given relationship object.
 void setRelationshipRenderer(java.lang.Class<? extends IRelationship> relationshipType, IRelationshipRenderer renderer)
          Maps the implementation of a relationship renderer to a class definition.
 
Methods inherited from class com.dlsc.flexgantt.swing.layer.AbstractLayer
addPropertyChangeListener, getAlpha, getDateline, getEventline, getGanttChart, getLayerContainer, getLayerPolicyProvider, getModel, getName, getStartRow, getTimeAt, getTimeline, getTimeLocation, getTimeSpanUsed, getToolTipText, getTreeTable, getTreeTablePolicyProvider, removePropertyChangeListener, repaint, repaint, repaint, setAlpha, setVisible, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationshipLayer

public RelationshipLayer(LayerContainer lc)
Parameters:
lc -
Since:
1.0
Method Detail

isVisible

public boolean isVisible()
Description copied from class: AbstractLayer
Determines whether the layer is currently visible or not.

Overrides:
isVisible in class AbstractLayer
Returns:
TRUE if the layer is currently visible
See Also:
AbstractLayer.setVisible(boolean)

paintLayer

protected void paintLayer(java.awt.Graphics g)
Overrides:
paintLayer in class AbstractLayer

paintRelationship

protected void paintRelationship(java.awt.Graphics g,
                                 int w,
                                 int h,
                                 IRelationship relationship,
                                 IGanttChartModel model)
Paints the given relationship object.

Parameters:
g - the graphics context into which to draw
w - the total width of the layer
h - the total height of the layer
relationship - the relationship in need of drawing
model - the data source that returned the relationship
Since:
1.0

setRelationshipRenderer

public void setRelationshipRenderer(java.lang.Class<? extends IRelationship> relationshipType,
                                    IRelationshipRenderer renderer)
Maps the implementation of a relationship renderer to a class definition.

Parameters:
relationshipType - the type of those relationships that will be rendered with the given renderer
renderer - an implementation that will be used to renderer instances of the given object type
Since:
1.0
See Also:
DefaultRelationshipRenderer, getRelationshipRenderer(Class)

getRelationshipRenderer

public IRelationshipRenderer getRelationshipRenderer(java.lang.Class cl)
Returns a renderer for drawing a relationship. The lookup of the renderer is based on the type of relationship.

Parameters:
cl - the relationship object type in need of rendering
Returns:
a matching relationship renderer implementation
Since:
1.0
See Also:
setRelationshipRenderer(Class, IRelationshipRenderer), DefaultRelationshipRenderer