com.miginfocom.calendar.decorators
Class CompositeDecorator

java.lang.Object
  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.

Since:
6.0

Constructor Summary
CompositeDecorator(GridContainer gridContainer, Decorator[] decorators, int layerIndex)
          Constructor
 
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

CompositeDecorator

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

Parameters:
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

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.

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.

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


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.