com.miginfocom.calendar.decorators
Class SubRowHeaderDecorator

java.lang.Object
  extended by com.miginfocom.calendar.decorators.AbstractGridDecorator
      extended by com.miginfocom.calendar.decorators.SubRowHeaderDecorator
All Implemented Interfaces:
Decorator, GridDecorator, java.beans.PropertyChangeListener, java.lang.Comparable, java.util.EventListener

public class SubRowHeaderDecorator
extends AbstractGridDecorator
implements java.beans.PropertyChangeListener

A decorator that draws labels for every sub row. Should normally be situated in a Header.

Can use different AShapes to decorate different levels in the GridRows. GridRows are hierarchical and the level is the depth, like in a tree structure.

A GridRowInteractor and a MouseKeyInteractor will be installed on the AShapes used to decorate the rows. If another set of interactors should be used override createInteractors(com.miginfocom.calendar.grid.GridRow, java.util.Collection).


Constructor Summary
SubRowHeaderDecorator(AbstractGridHeader dateHeader, SubRowLevel[] levels, int layerIndex, boolean parentOverlapChildren)
          Constructor.
SubRowHeaderDecorator(AbstractGridHeader dateHeader, SubRowLevel levelSpecs, int layerIndex, boolean parentOverlapChildren)
          Constructor.
 
Method Summary
protected  Interactor[] createInteractors(GridRow row, java.util.Collection interactions)
          Creates a MouseKeyInteractor and a GridRowInteractor and returns them in a new array.
 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.
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 
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

SubRowHeaderDecorator

public SubRowHeaderDecorator(AbstractGridHeader dateHeader,
                             SubRowLevel levelSpecs,
                             int layerIndex,
                             boolean parentOverlapChildren)
Constructor.

Parameters:
dateHeader - The header to decorate
levelSpecs - The specs for the levels. GridRows can be contained in other grid rows making out a tree structure and the depth of that tree structure is the level. A SubRowLevel sets some properties for a selected number of levels, defined by the Repetition in it. For instance it may say "Use this AShape to draw level 0 to 3". See Repetition
layerIndex - A number to indicate the order in which to paint something. Lower if painted before. I.e. under.
parentOverlapChildren - If parent header cells should be stretched to include all it children in the headers primary (long) dimension. Usually true if the header is top/bottom but not if left/right.

SubRowHeaderDecorator

public SubRowHeaderDecorator(AbstractGridHeader dateHeader,
                             SubRowLevel[] levels,
                             int layerIndex,
                             boolean parentOverlapChildren)
Constructor.

Parameters:
dateHeader - The header to decorate
levels - The specs for the levels. GridRows can be contained in other grid rows making out a tree structure and the depth of that tree structure is the level. A SubRowLevel sets some properties for a selected number of levels, defined by the Repetition in it. For instance it may say "Use this AShape to draw level 0 to 3".
There can be many specs to specify different level ranges/patterns. See Repetition
layerIndex - A number to indicate the order in which to paint something. Lower if painted before. I.e. under.
parentOverlapChildren - If parent header cells should be stretched to include all it children in the headers primary (long) dimension. Usually true if the header is top/bottom but not if left/right.
Method Detail

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

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.

Specified by:
doPaint in interface Decorator
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.

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

createInteractors

protected Interactor[] createInteractors(GridRow row,
                                         java.util.Collection interactions)
Creates a MouseKeyInteractor and a GridRowInteractor and returns them in a new array.

Parameters:
row - The row for which to install the interactors. Will normally be set as the "interacted".
interactions - The interactions that should be registered on the interactor
Returns:
A MouseKeyInteractor and listens to overrides to repaint.

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.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.