com.miginfocom.calendar.decorators
Class DateSeparatorDecorator

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

public class DateSeparatorDecorator
extends AbstractDateGridDecorator

Draws over the grid lines between some date boundary. Can for instance be used to paint a separator line between every month on a grid.


Constructor Summary
DateSeparatorDecorator(DateGridContainer gridContainer, int layerIndex, int rangeType, java.awt.Paint paint)
          Constructor.
DateSeparatorDecorator(DateGridContainer gridContainer, int layerIndex, int rangeType, java.awt.Paint paint, int maxLineWidth)
          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.
 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.
 
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

DateSeparatorDecorator

public DateSeparatorDecorator(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 between. E.g. DateRangeI.RANGE_TYPE_MONTH
paint - The paint to use. Not null. The size of the separator is the same as the grid line between the specific cell.

DateSeparatorDecorator

public DateSeparatorDecorator(DateGridContainer gridContainer,
                              int layerIndex,
                              int rangeType,
                              java.awt.Paint paint,
                              int maxLineWidth)
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 between. E.g. DateRangeI.RANGE_TYPE_MONTH
paint - The paint to use. Not null. The size of the separator is the same as the grid line between the specific cell.
maxLineWidth - The maximum width of the separator. If less than the grid line it will be aligned towards top/left.
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

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.