com.miginfocom.calendar.decorators
Class HeaderAShapeGridDecorator

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

public class HeaderAShapeGridDecorator
extends AShapeGridDecorator

A decorator for grid cells in a date area for a DateGridHeader. Extremely flexible and can be used to decorate just about any type of header including different independent settings for multi row/column headers.


Field Summary
static java.lang.String BG_SHAPE_NAME
          The name of the FillAShape used to fill the background.
 java.awt.Rectangle RECT
           
static java.lang.String TEXT_SHAPE_NAME
          The name of the TextAShape used to draw the labels.
static int TYPE_CELL
          Type that paints the decorations over the grid lines
static int TYPE_GRIDLINE
          Type that paints the decorations int the cells
 
Constructor Summary
HeaderAShapeGridDecorator(DateGridHeader shapeHeader, int layerIndex, HeaderDecorationSpec spec, java.util.Locale locale)
          Constructor.
 
Method Summary
 Interactor[] createInteractors(DateCellRange cellRange, java.awt.Paint[] bg, java.awt.Paint[] fg, java.awt.Font[] f, java.lang.Integer[] ulW)
          Creates interactors that, when the mouse is over or pressed over the cell range, overrides background, font, underline foreground etc.
Makes a lot of effort to create the most effective overrider possible.
 void dispose()
          Clean up and deregister listeners.
 java.util.Locale getLocale()
          Returns the current Locale.
 RootAShape[] getShapes()
          Return the shapes that is to be painted under or above the grid.
 java.util.TimeZone getTimeZone()
          Returns the current TimeZone.
 void gridChanged(java.beans.PropertyChangeEvent e)
          Called when the grid changes.
 void setLocale(java.util.Locale locale)
          Sets a new locale.
 void setTimeZone(java.util.TimeZone timeZone)
          Sets a new TimeZone.
 
Methods inherited from class com.miginfocom.calendar.decorators.AShapeGridDecorator
doPaint
 
Methods inherited from class com.miginfocom.calendar.decorators.AbstractGridDecorator
compareTo, getGrid, getGridContainer, getInvalidEnd, getInvalidStart, getLayerIndex, hasInvalidCells, invalidateCells, processEvent, setCellsValid, setLayerIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BG_SHAPE_NAME

public static final java.lang.String BG_SHAPE_NAME
The name of the FillAShape used to fill the background.

See Also:
Constant Field Values

TEXT_SHAPE_NAME

public static final java.lang.String TEXT_SHAPE_NAME
The name of the TextAShape used to draw the labels.

See Also:
Constant Field Values

TYPE_CELL

public static final int TYPE_CELL
Type that paints the decorations over the grid lines

See Also:
Constant Field Values

TYPE_GRIDLINE

public static final int TYPE_GRIDLINE
Type that paints the decorations int the cells

See Also:
Constant Field Values

RECT

public final java.awt.Rectangle RECT
Constructor Detail

HeaderAShapeGridDecorator

public HeaderAShapeGridDecorator(DateGridHeader shapeHeader,
                                 int layerIndex,
                                 HeaderDecorationSpec spec,
                                 java.util.Locale locale)
Constructor.

Parameters:
shapeHeader - The shape holder to ark for information. For example where the grid lines are.
layerIndex - A number to indicate the order in which to paint something. Lower if painted before, I.e. under.
spec - The specification of how the decorator should look and behave.
locale - The locale used for formatting the header date texts. If null the CellDecorationRows in the HeaderDecorationSpec will be used.
Method Detail

getShapes

public RootAShape[] getShapes()
Description copied from class: AShapeGridDecorator
Return the shapes that is to be painted under or above the grid. The shapes shall be laid out before returned.

Specified by:
getShapes in class AShapeGridDecorator
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.

getLocale

public java.util.Locale getLocale()
Returns the current Locale.

Returns:
The current Locale.

setLocale

public void setLocale(java.util.Locale locale)
Sets a new locale.

Parameters:
locale - The locale used for formatting the header date texts. If null the CellDecorationRows in the HeaderDecorationSpec will be used.

getTimeZone

public java.util.TimeZone getTimeZone()
Returns the current TimeZone.

Returns:
The current TimeZone.

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)
Sets a new TimeZone.

Parameters:
timeZone - The TimeZone used for formatting the header date texts. If null the DateGrid's time zone in the HeaderDecorationSpec will be used.

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

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.

createInteractors

public Interactor[] createInteractors(DateCellRange cellRange,
                                      java.awt.Paint[] bg,
                                      java.awt.Paint[] fg,
                                      java.awt.Font[] f,
                                      java.lang.Integer[] ulW)
Creates interactors that, when the mouse is over or pressed over the cell range, overrides background, font, underline foreground etc.
Makes a lot of effort to create the most effective overrider possible. Thinking of the args can have length < 3. Also checks for referential equality between the elements and sets LabelOverrider.NO_OVERRIDE for those.

Parameters:
cellRange - The cell range for which this interactor should react.
bg - Background color. Index: [normal, mouseOver, pressed]. If length < 3 the missing elements will not be overrides. null turns of override for this property.
fg - Label color. Index: [normal, mouseOver, pressed]. If length < 3 the missing elements will not be overrides. null turns of override for this property
f - Label font. Index: [normal, mouseOver, pressed]. If length < 3 the missing elements will not be overrides. null turns of override for this property
ulW - If != null is the underlined width. Index: [normal, mouseOver, pressed]. If length < 3 the missing elements will not be overrides. null turns of override for this property
Returns:
A number of new interactors. Never null.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.