public class GridLayer extends AbstractSystemLayer implements PropertyChangeListener
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.Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_HORIZONTAL_LINE_COLOR
Constant used for those property change events that get fired when the
color for horizontal grid lines changes.
|
static String |
PROPERTY_MAJOR_GRID_COLOR
Constant used for those property change events that get fired when the
major grid color changes.
|
static String |
PROPERTY_MINOR_GRID_COLOR
Constant used for those property change events that get fired when the
color for minor grid lines changes.
|
alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE
Constructor and Description |
---|
GridLayer(LayerContainer lc)
Constructs a new grid layer.
|
Modifier and Type | Method and Description |
---|---|
Color |
getHorizontalLineColor()
Returns the color used for drawing the horizontal grid lines.
|
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).
|
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 |
isHorizontalLinesVisible()
Determines if the horizontal grid lines are visible or not.
|
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(Graphics g)
Draws the horizontal lines.
|
protected void |
paintLayer(Graphics g) |
protected void |
paintVerticalLines(Graphics g)
Draws the vertical grid lines.
|
void |
propertyChange(PropertyChangeEvent evt) |
void |
setHorizontalLineColor(Color color)
Set the color used for drawing the horizontal grid lines.
|
void |
setHorizontalLinesVisible(boolean visible)
Specifies whether the horizontal grid lines will be drawn or not.
|
void |
setMajorGridColor(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(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.
|
addPropertyChangeListener, getAlpha, getDateline, getEventline, getGanttChart, getHeight, getLayerContainer, getLayerPolicyProvider, getModel, getName, getStartRow, getTimeAt, getTimeline, getTimeLocation, getTimeSpanUsed, getToolTipText, getTreeTable, getTreeTablePolicyProvider, getWidth, isVisible, removePropertyChangeListener, repaint, repaint, repaint, setAlpha, setVisible, tearDown
public static final String PROPERTY_MAJOR_GRID_COLOR
setMajorGridColor(Color)
,
Constant Field Valuespublic static final String PROPERTY_MINOR_GRID_COLOR
setMinorGridColor(Color)
,
Constant Field Valuespublic static final String PROPERTY_HORIZONTAL_LINE_COLOR
setHorizontalLineColor(Color)
,
Constant Field Valuespublic GridLayer(LayerContainer lc)
lc
- the layer container to which the layer belongsprotected void paintLayer(Graphics g)
paintLayer
in class AbstractLayer
protected void paintVerticalLines(Graphics g)
g
- the graphics contextprotected void paintHorizontalLines(Graphics g)
g
- the graphics contextpublic boolean isThickMajorGridLines()
setThickMajorGridLines(boolean)
public void setThickMajorGridLines(boolean thickMajorGridLines)
thickMajorGridLines
- if TRUE the major grid lines will be drawn thickisThickMajorGridLines()
public boolean isVerticalLinesOnTop()
setVerticalLinesOnTop(boolean)
public void setVerticalLinesOnTop(boolean verticalLinesOnTop)
verticalLinesOnTop
- if TRUE the vertical lines will be drawn on top of the
horizontal linesisVerticalLinesOnTop()
public void setMajorGridColor(Color color)
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
.color
- the major grid colorgetMajorGridColor()
,
AbstractGanttChart.setGridLineMode(GridLineMode)
public Color getMajorGridColor()
setMajorGridColor(Color)
,
getMinorGridColor()
public void setMinorGridColor(Color color)
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
.color
- the minor grid colorgetMinorGridColor()
,
AbstractGanttChart.setGridLineMode(GridLineMode)
public Color getMinorGridColor()
setMinorGridColor(Color)
,
getMajorGridColor()
public Color getHorizontalLineColor()
public void setHorizontalLineColor(Color color)
color
- the horizontal grid line colorpublic boolean isHorizontalLinesVisible()
public void setHorizontalLinesVisible(boolean visible)
visible
- if TRUE the horizontal grid lines will be drawnpublic void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.