com.miginfocom.calendar.decorators
Class EvenFieldFillDecorator

java.lang.Object
  extended by com.miginfocom.calendar.decorators.AbstractGridDecorator
      extended by com.miginfocom.calendar.decorators.AbstractDateGridDecorator
          extended by com.miginfocom.calendar.decorators.EvenFieldFillDecorator
All Implemented Interfaces:
Decorator, GridDecorator, java.lang.Comparable

public class EvenFieldFillDecorator
extends AbstractDateGridDecorator

Paints even com.miginfocom.calendar ranges with a paint. For instance January, March, May... (months are 0-based)

The size of the separator is the same as the grid line between the specific cell.


Constructor Summary
EvenFieldFillDecorator(DateGridContainer gridContainer, int layerIndex, int rangeType, int rangeTypeCount, java.awt.Paint paint)
          Constructor.
EvenFieldFillDecorator(DateGridContainer gridContainer, int layerIndex, int rangeType, java.awt.Paint paint)
          Constructor.
 
Method Summary
 void doPaint(java.awt.Graphics2D g2, java.awt.Rectangle bounds)
          Paint what should be painted.
 java.awt.Paint getPaint()
          Returns the paint to use.
 int getRangeType()
          Returns what boundary to paint.
 int getRangeTypeCount()
          Returns how many of rangeType should be grouped to be noted as "one".
 void gridChanged(java.beans.PropertyChangeEvent e)
          Called when the grid changes.
 void setPaint(java.awt.Paint paint)
          Sets the paint to use.
 void setRangeType(int rangeType)
          Sets what boundary to paint.
 void setRangeTypeCount(int rangeTypeCount)
          Sets how many of rangeType should be grouped to be noted as "one".
 
Methods inherited from class com.miginfocom.calendar.decorators.AbstractDateGridDecorator
getDateGrid, getDateGridContainer
 
Methods inherited from class com.miginfocom.calendar.decorators.AbstractGridDecorator
compareTo, dispose, getGrid, getGridContainer, getInvalidEnd, getInvalidStart, getLayerIndex, hasInvalidCells, invalidateCells, processEvent, setCellsValid, setLayerIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EvenFieldFillDecorator

public EvenFieldFillDecorator(DateGridContainer gridContainer,
                              int layerIndex,
                              int rangeType,
                              java.awt.Paint paint)
Constructor. Note that the grid has to be set before any painting can occur.

Parameters:
gridContainer - The grid container to decorate. Not null.
layerIndex - The order in which this decoration is painted. Should probably be pretty high since it has to be shown above the grid lines.
rangeType - What boundary to paint. E.g. DateRangeI.RANGE_TYPE_MONTH
paint - The paint to use. Might be null in which case nothing is painted.

EvenFieldFillDecorator

public EvenFieldFillDecorator(DateGridContainer gridContainer,
                              int layerIndex,
                              int rangeType,
                              int rangeTypeCount,
                              java.awt.Paint paint)
Constructor. Note that the grid has to be set before any painting can occur.

Parameters:
gridContainer - The grid container to decorate. Not null.
layerIndex - The order in which this decoration is painted. Should probably be pretty high since it has to be shown above the grid lines.
rangeType - What boundary to paint. E.g. DateRangeI.RANGE_TYPE_MONTH
rangeTypeCount - How many of rangeType should be grouped to be noted as "one". If rangeType is DateRangeI.RANGE_TYPE_MINUTE and this is 30 then every other 30 minutes will be filled with paint.
paint - The paint to use. Might be null in which case nothing is painted.
Method Detail

doPaint

public void doPaint(java.awt.Graphics2D g2,
                    java.awt.Rectangle bounds)
Description copied from interface: Decorator
Paint what should be painted. Color, paints, fonts, hints and similar should be same as when called.

Parameters:
g2 - The graphics object to paint in
bounds - The bounds to stay within (a must). If width and/or height is 0 that dimension is not scaled to fit and should be ignored.

getRangeType

public int getRangeType()
Returns what boundary to paint.

Returns:
What boundary to paint. E.g. DateRangeI.RANGE_TYPE_MONTH

setRangeType

public void setRangeType(int rangeType)
Sets what boundary to paint.

Parameters:
rangeType - What boundary to paint. E.g. DateRangeI.RANGE_TYPE_MONTH

getRangeTypeCount

public int getRangeTypeCount()
Returns how many of rangeType should be grouped to be noted as "one".

Returns:
How many of rangeType should be grouped to be noted as "one".

setRangeTypeCount

public void setRangeTypeCount(int rangeTypeCount)
Sets how many of rangeType should be grouped to be noted as "one".

Parameters:
rangeTypeCount - How many of rangeType should be grouped to be noted as "one".

getPaint

public java.awt.Paint getPaint()
Returns the paint to use.

Returns:
The paint to use. Might be null in which case nothing is painted.

setPaint

public void setPaint(java.awt.Paint paint)
Sets the paint to use.

Parameters:
paint - The paint to use. Might be null.

gridChanged

public void gridChanged(java.beans.PropertyChangeEvent e)
Description copied from class: AbstractGridDecorator
Called when the grid changes.

Specified by:
gridChanged in class AbstractGridDecorator
Parameters:
e - The event.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.