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

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.GridLayer

public class GridLayer
extends AbstractSystemLayer

The grid layer is responsible for drawing the vertical and horizontal grid lines. The number of vertical grid lines depends on the current grid mode (see AbstractGanttChart.getGridLineMode()). Depending on the mode the layer might draw no lines, minor lines only, major lines only or a combination of minor and major grid lines. The layer allows for some customization of the drawing. The colors used for the major and minor lines and the thickness of the major lines may be changed.

Since:
1.0
Author:
Dirk Lemmermann

Field Summary
static java.lang.String PROPERTY_MAJOR_GRID_COLOR
          Constant used for those property change events that get fired when the major grid color changes.
static java.lang.String PROPERTY_MINOR_GRID_COLOR
          Constant used for those property change events that get fired when the color for minor grid lines changes.
 
Fields inherited from class com.dlsc.flexgantt.swing.layer.AbstractLayer
alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE
 
Constructor Summary
GridLayer(LayerContainer lc)
          Constructs a new grid layer.
 
Method Summary
 java.awt.Color getHorizonalLineColor()
          Returns the color used for drawing the horizontal grid lines.
 java.awt.Color getMajorGridColor()
          Returns the color used to draw a vertical line across all rows in all layer containers in order to indicate the end of a major time unit (for example: the end of a year, the end of a month).
 java.awt.Color getMinorGridColor()
          Returns the color used to draw a vertical line across all rows in all layer containers in order to indicate the end of a minor time unit (for example: the end of a day, the end of an hour).
 boolean isThickMajorGridLines()
          Determines whether the major grid lines will be drawn thick (2 pixels wide).
 boolean isVerticalLinesOnTop()
          Determines whether the vertical lines will be drawn on top of the horizontal lines or vice versa.
protected  void paintHorizontalLines(java.awt.Graphics g)
          Draws the horizontal lines.
protected  void paintLayer(java.awt.Graphics g)
           
protected  void paintVerticalLines(java.awt.Graphics g)
          Draws the vertical grid lines.
 void setHorizonalLineColor(java.awt.Color color)
          Set the color used for drawing the horizontal grid lines.
 void setMajorGridColor(java.awt.Color color)
          Changes the color used for rendering those vertical grid lines that get drawn when the grid mode is set to GridLineMode.MAJOR_GRID_LINES.
 void setMinorGridColor(java.awt.Color color)
          Changes the color used for rendering those vertical grid lines that get drawn when the grid mode is set to GridLineMode.MINOR_GRID_LINES.
 void setThickMajorGridLines(boolean thickMajorGridLines)
          Specifies whether the major grid lines will be drawn thick (2 pixels wide).
 void setVerticalLinesOnTop(boolean verticalLinesOnTop)
          Specifies whether the vertical lines will be drawn on top of the horizontal lines or vice versa.
 
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, isVisible, 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
 

Field Detail

PROPERTY_MAJOR_GRID_COLOR

public static final java.lang.String PROPERTY_MAJOR_GRID_COLOR
Constant used for those property change events that get fired when the major grid color changes.

Since:
1.0
See Also:
setMajorGridColor(Color), Constant Field Values

PROPERTY_MINOR_GRID_COLOR

public static final java.lang.String PROPERTY_MINOR_GRID_COLOR
Constant used for those property change events that get fired when the color for minor grid lines changes.

Since:
1.0
See Also:
setMinorGridColor(Color), Constant Field Values
Constructor Detail

GridLayer

public GridLayer(LayerContainer lc)
Constructs a new grid layer.

Parameters:
lc - the layer container to which the layer belongs
Since:
1.0
Method Detail

paintLayer

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

paintVerticalLines

protected void paintVerticalLines(java.awt.Graphics g)
Draws the vertical grid lines.

Parameters:
g - the graphics context
Since:
1.0

paintHorizontalLines

protected void paintHorizontalLines(java.awt.Graphics g)
Draws the horizontal lines.

Parameters:
g - the graphics context
Since:
1.0

isThickMajorGridLines

public boolean isThickMajorGridLines()
Determines whether the major grid lines will be drawn thick (2 pixels wide).

Returns:
TRUE if the major grid lines will be drawn thick
Since:
1.0
See Also:
setThickMajorGridLines(boolean)

setThickMajorGridLines

public void setThickMajorGridLines(boolean thickMajorGridLines)
Specifies whether the major grid lines will be drawn thick (2 pixels wide).

Parameters:
thickMajorGridLines - if TRUE the major grid lines will be drawn thick
Since:
1.0
See Also:
isThickMajorGridLines()

isVerticalLinesOnTop

public boolean isVerticalLinesOnTop()
Determines whether the vertical lines will be drawn on top of the horizontal lines or vice versa.

Returns:
TRUE if the vertical lines are drawn on top
Since:
1.0
See Also:
setVerticalLinesOnTop(boolean)

setVerticalLinesOnTop

public void setVerticalLinesOnTop(boolean verticalLinesOnTop)
Specifies whether the vertical lines will be drawn on top of the horizontal lines or vice versa.

Parameters:
verticalLinesOnTop - if TRUE the vertical lines will be drawn on top of the horizontal lines
Since:
1.0
See Also:
isVerticalLinesOnTop()

setMajorGridColor

public void setMajorGridColor(java.awt.Color color)
Changes the color used for rendering those vertical grid lines that get drawn when the grid mode is set to GridLineMode.MAJOR_GRID_LINES. Setting a new major grid color will trigger a property change event with the name/id set to the constant PROPERTY_MAJOR_GRID_COLOR.

Parameters:
color - the major grid color
Since:
1.0
See Also:
getMajorGridColor(), AbstractGanttChart.setGridLineMode(GridLineMode)

getMajorGridColor

public java.awt.Color getMajorGridColor()
Returns the color used to draw a vertical line across all rows in all layer containers in order to indicate the end of a major time unit (for example: the end of a year, the end of a month).

Returns:
Color the color used for drawing the vertical lines
Since:
1.0
See Also:
setMajorGridColor(Color), getMinorGridColor()

setMinorGridColor

public void setMinorGridColor(java.awt.Color color)
Changes the color used for rendering those vertical grid lines that get drawn when the grid mode is set to GridLineMode.MINOR_GRID_LINES. Setting a new minor grid color will trigger a property change event with the name/id set to the constant PROPERTY_MINOR_GRID_COLOR.

Parameters:
color - the minor grid color
Since:
1.0
See Also:
getMinorGridColor(), AbstractGanttChart.setGridLineMode(GridLineMode)

getMinorGridColor

public java.awt.Color getMinorGridColor()
Returns the color used to draw a vertical line across all rows in all layer containers in order to indicate the end of a minor time unit (for example: the end of a day, the end of an hour).

Returns:
Color the color used for drawing the vertical lines
Since:
1.0
See Also:
setMinorGridColor(Color), getMajorGridColor()

getHorizonalLineColor

public java.awt.Color getHorizonalLineColor()
Returns the color used for drawing the horizontal grid lines.

Returns:
the horizontal grid line color
Since:
1.0

setHorizonalLineColor

public void setHorizonalLineColor(java.awt.Color color)
Set the color used for drawing the horizontal grid lines.

Parameters:
color - the horizontal grid line color
Since:
1.0