com.miginfocom.calendar.decorators
Class AbstractGridDecorator

java.lang.Object
  extended by com.miginfocom.calendar.decorators.AbstractGridDecorator
All Implemented Interfaces:
Decorator, GridDecorator, java.lang.Comparable
Direct Known Subclasses:
AbstractDateGridDecorator, AShapeGridDecorator, CompositeDecorator, GridCellDecorator, GridCellRangeDecorator, GridLineDecorator, SubRowHeaderDecorator

public abstract class AbstractGridDecorator
extends java.lang.Object
implements GridDecorator

Handels layers (sorting and holding the value) and the reference to the date area. Holds the date area in a WeakReference.


Constructor Summary
protected AbstractGridDecorator(GridContainer gridContainer, int layerIndex)
          Constructor.
 
Method Summary
 int compareTo(java.lang.Object o)
          Sorts according to layer index.
 void dispose()
          Clean up and deregister listeners.
 Grid getGrid()
          Returns the date area's grid.
 GridContainer getGridContainer()
          Returns the container of the grid.
protected  int getInvalidEnd()
          Returns the end if the invalid cells.
protected  int getInvalidStart()
          Returns the start if the invalid cells.
 int getLayerIndex()
          Returns a number to indicate the order in which to paint something.
abstract  void gridChanged(java.beans.PropertyChangeEvent e)
          Called when the grid changes.
protected  boolean hasInvalidCells()
          Returns if there are invalid cells
protected  void invalidateCells(int start, int end)
          Marks cells as invalid and will be recached during next reapint
 void processEvent(java.awt.AWTEvent e)
          Implemented to do nothing.
protected  void setCellsValid()
          Marks all cells at valid
 void setLayerIndex(int layerIndex)
          Sets a number to indicate the order in which to paint something.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.miginfocom.calendar.decorators.Decorator
doPaint
 

Constructor Detail

AbstractGridDecorator

protected AbstractGridDecorator(GridContainer gridContainer,
                                int layerIndex)
Constructor.

Parameters:
gridContainer - The grid container to decorate. Not null.
layerIndex - A number to indicate the order in which to paint something. Lower if painted before. I.e. under.
Method Detail

getLayerIndex

public int getLayerIndex()
Description copied from interface: Decorator
Returns a number to indicate the order in which to paint something. The number is interpreted by the object that invokes Decorator.doPaint(java.awt.Graphics2D, java.awt.Rectangle).

Specified by:
getLayerIndex in interface Decorator
Returns:
A number to indicate the order in which to paint something. Lower if painted before. I.e. under.

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

setLayerIndex

public void setLayerIndex(int layerIndex)
Description copied from interface: Decorator
Sets a number to indicate the order in which to paint something. The number is interpreted by the object that invokes Decorator.doPaint(java.awt.Graphics2D, java.awt.Rectangle).

Specified by:
setLayerIndex in interface Decorator
Parameters:
layerIndex - A number to indicate the order in which to paint something. Lower if painted before. I.e. under.

getGridContainer

public GridContainer getGridContainer()
Description copied from interface: GridDecorator
Returns the container of the grid.

Specified by:
getGridContainer in interface GridDecorator
Returns:
The container of the grid. Can be null in which case nothing should be painted.

getGrid

public Grid getGrid()
Returns the date area's grid. If the date area is null then null will be returned.

Returns:
The date area's grid, may be null!

compareTo

public int compareTo(java.lang.Object o)
Sorts according to layer index.

Specified by:
compareTo in interface Decorator
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - Another Decorator
Returns:
getLayerIndex() - ((Decorator) o).getLayerIndex().

gridChanged

public abstract void gridChanged(java.beans.PropertyChangeEvent e)
Called when the grid changes.

Parameters:
e - The event.

processEvent

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

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

invalidateCells

protected final void invalidateCells(int start,
                                     int end)
Marks cells as invalid and will be recached during next reapint

Parameters:
start - AtStart cell. > 0
end - AtEnd cell. < cell count.

hasInvalidCells

protected final boolean hasInvalidCells()
Returns if there are invalid cells

Returns:
If there are invalid cells

setCellsValid

protected final void setCellsValid()
Marks all cells at valid


getInvalidStart

protected final int getInvalidStart()
Returns the start if the invalid cells. Only callable is hasInvalidCells() returns true!

Returns:
The start if the invalid cells.

getInvalidEnd

protected final int getInvalidEnd()
Returns the end if the invalid cells. Only callable is hasInvalidCells() returns true!

Returns:
The end if the invalid cells.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.