Class CompositeDecorator

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

public class CompositeDecorator
extends AbstractGridDecorator

This is a Decorator that contains a number of other decorators and can as such be used to create a single decorator consisting of many other decorators. This give them the options to be handled as a single unit.

Note that this class implements GridDecorator which indicates that is should be able to return a GridContainer. It can be used in places where there is no GridContainer as well by just using null for the GridContainer.


Constructor Summary
CompositeDecorator(GridContainer gridContainer, Decorator[] decorators, int layerIndex)
Method Summary
 void dispose()
          Clean up and deregister listeners.
 void doPaint(java.awt.Graphics2D g2, java.awt.Rectangle bounds)
          Paint what should be painted.
 void gridChanged(java.beans.PropertyChangeEvent e)
          Called when the grid changes.
 void processEvent(java.awt.AWTEvent e)
          Implemented to do nothing.
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


public CompositeDecorator(GridContainer gridContainer,
                          Decorator[] decorators,
                          int layerIndex)

gridContainer - The Grid container, if any. May be null.
decorators - The decorators. If a AbstractGridDecorator they will be notified of grid changes. Their element order will be used as paint order and thus their layerIndex is not used.
layerIndex - The layer. Higher layers are painted on top of lower layers.
Method Detail


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.

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.


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

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


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
processEvent in class AbstractGridDecorator
e - The event


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
dispose in class AbstractGridDecorator

Copyright © 2009 MiG InfoCom AB. All Rights Reserved.