com.miginfocom.calendar.decorators
Class NoFitShapeDecorator

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

public class NoFitShapeDecorator
extends GridCellDecorator

A decorator that will draw a shape in every cell that has one or more date ranges that didn't fit (normally due to out of space).
A MouseKeyInteractor with a DefaultInteractionBroker will be maintained for every cell that paints the shape. Thus it is possible to install interactions, such as mouse over effects, on the shape.


Field Summary
 
Fields inherited from class com.miginfocom.calendar.decorators.GridCellDecorator
placeRect
 
Constructor Summary
NoFitShapeDecorator(DefaultDateArea dateArea, int layerIndex, RootAShape shape)
          Constructor.
 
Method Summary
 void dispose()
          Clean up and deregister listeners.
 Filter getFilter()
          Returns the filter used to filter which DateRangIs to concider.
 RootAShape getShape()
          Returns the root shape.
 void gridChanged(java.beans.PropertyChangeEvent e)
          Called when the grid changes.
protected  void paintCell(java.awt.Graphics2D g2, int r, int c, java.awt.Rectangle bounds)
          Paints the cell, or part thereof.
protected  void postPaint()
          Called after the last cell has been painted.
protected  boolean prePaint()
          Called before the first cell is painted.
 void processEvent(java.awt.AWTEvent e)
          Implemented to do nothing.
 void setFilter(Filter filter)
          Sets the filter used to filter which DateRangIs to concider.
 void setShape(RootAShape shape)
          Sets a new shape for painting.
 
Methods inherited from class com.miginfocom.calendar.decorators.GridCellDecorator
createCellRects, doPaint, getPlaceRect, getSizeMode, setPlaceRect, setSizeMode
 
Methods inherited from class com.miginfocom.calendar.decorators.AbstractGridDecorator
compareTo, getGrid, getGridContainer, getInvalidEnd, getInvalidStart, getLayerIndex, hasInvalidCells, invalidateCells, setCellsValid, setLayerIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoFitShapeDecorator

public NoFitShapeDecorator(DefaultDateArea dateArea,
                           int layerIndex,
                           RootAShape shape)
Constructor.

Parameters:
dateArea - Teh date area to decorate.
layerIndex - The intex for this layer. Bigger value means painted on top.
shape - The shape to use for painting. No interactor or broker will be assigned to it by this class.
Method Detail

paintCell

protected void paintCell(java.awt.Graphics2D g2,
                         int r,
                         int c,
                         java.awt.Rectangle bounds)
Description copied from class: GridCellDecorator
Paints the cell, or part thereof.

Specified by:
paintCell in class GridCellDecorator
Parameters:
g2 - The object to paint in. Paint may be changed and not restored for every call.
r - The row beeing painted.
c - The column beeing painted
bounds - The bounds of the cell, or part there of, to be painted.

prePaint

protected boolean prePaint()
Description copied from class: GridCellDecorator
Called before the first cell is painted. Possible to do setup.

Specified by:
prePaint in class GridCellDecorator
Returns:
If the paint should continue. If false GridCellDecorator.paintCell(java.awt.Graphics2D, int, int, java.awt.Rectangle) will not be called this round. GridCellDecorator.postPaint() will be called though.

postPaint

protected void postPaint()
Description copied from class: GridCellDecorator
Called after the last cell has been painted. Possible to dispose of resources.

Specified by:
postPaint in class GridCellDecorator

getFilter

public Filter getFilter()
Returns the filter used to filter which DateRangIs to concider.

Returns:
The filter used to filter which DateRangIs to concider. May be null.

setFilter

public void setFilter(Filter filter)
Sets the filter used to filter which DateRangIs to concider. For every DateRangIs Filter.accept(Object dateRange) will be called and if if it returns false that date range will not be included, or "painted".

Parameters:
filter - The filter used to filter which occupied DateRangIs to concider. May be null in which case all DateRangIs are accepted.

getShape

public RootAShape getShape()
Returns the root shape.

Returns:
The root shape used to for painting.

setShape

public void setShape(RootAShape shape)
Sets a new shape for painting.

Parameters:
shape - A new shape for painting

processEvent

public void processEvent(java.awt.AWTEvent e)
Description copied from class: AbstractGridDecorator
Implemented to do nothing. Override to get notified. You should probably call super.processEvent(e) as well.

Specified by:
processEvent in interface Decorator
Overrides:
processEvent in class AbstractGridDecorator
Parameters:
e - The event

dispose

public void dispose()
Description copied from interface: Decorator
Clean up and deregister listeners. Should be called when a Decorator isn't needed any more.

Specified by:
dispose in interface Decorator
Overrides:
dispose in class AbstractGridDecorator

gridChanged

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

Overrides:
gridChanged in class GridCellDecorator
Parameters:
e - The event.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.