com.miginfocom.calendar.decorators
Class AShapeGridDecorator

java.lang.Object
  extended by com.miginfocom.calendar.decorators.AbstractGridDecorator
      extended by com.miginfocom.calendar.decorators.AShapeGridDecorator
All Implemented Interfaces:
Decorator, GridDecorator, java.lang.Comparable
Direct Known Subclasses:
HeaderAShapeGridDecorator, StaticAShapeGridDecorator

public abstract class AShapeGridDecorator
extends AbstractGridDecorator

A wrapper that paint a number of RootAShapes on command. Extend and just return the shapes to paint. The shapes will be painted 'as is' and thier bounds won't be changed here. Each shape will get the bounds that it given to the decorator as reference bounds.


Constructor Summary
protected AShapeGridDecorator(GridContainer gridContainer, int layerIndex)
          Constructor.
 
Method Summary
 void doPaint(java.awt.Graphics2D g2, java.awt.Rectangle bounds)
          Paint what should be painted.
abstract  RootAShape[] getShapes()
          Return the shapes that is to be painted under or above the grid.
 
Methods inherited from class com.miginfocom.calendar.decorators.AbstractGridDecorator
compareTo, dispose, getGrid, getGridContainer, getInvalidEnd, getInvalidStart, getLayerIndex, gridChanged, 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

AShapeGridDecorator

protected AShapeGridDecorator(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

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.

getShapes

public abstract RootAShape[] getShapes()
Return the shapes that is to be painted under or above the grid. The shapes shall be laid out before returned.

Returns:
A number of shapes. Never null but can be of length 0. The array can be the live array used but the object so it should be considered read-only. This is to avoid creating a passive clone and thus, garbage.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.