Class ThemeCellLabelDecorator

  extended by com.miginfocom.calendar.decorators.AbstractGridDecorator
      extended by com.miginfocom.calendar.decorators.GridCellDecorator
          extended by com.miginfocom.calendar.decorators.CellLabelDecorator
              extended by com.miginfocom.calendar.decorators.ThemeCellLabelDecorator
All Implemented Interfaces:
Decorator, GridDecorator, DateChangeListener, java.beans.PropertyChangeListener, java.lang.Comparable, java.util.EventListener

public class ThemeCellLabelDecorator
extends CellLabelDecorator
implements DateChangeListener, java.beans.PropertyChangeListener

Extends CellLabelDecorator by getting all properties from a CalendarTheme. Also listens to the tracked dateArea for mouseOver/press and changes the properties accoring to what is specified in the com.miginfocom.theme.
The deccorator wil NOT register itself for updates to the com.miginfocom.theme as this easily can lead to memory leaks. Call reloadFromTheme() to make it update from the com.miginfocom.theme.

Field Summary
static java.lang.String[] MAIN_KEYS
Fields inherited from class com.miginfocom.calendar.decorators.GridCellDecorator
Constructor Summary
ThemeCellLabelDecorator(DateArea dateArea, int layerIndex, java.lang.String themeContext)
Method Summary
 void dateRangeChanged(DateChangeEvent e)
          Called when a date range changed.
 void dispose()
          Clean up and deregister listeners.
 DateArea getDateArea()
          Might return null since the date area is kept in a WeakReference
 void gridChanged(java.beans.PropertyChangeEvent e)
          Called when the grid changes.
protected  void paintCell(java.awt.Graphics2D g2, int r, int c, java.awt.Rectangle b)
          Paints the cell, or part thereof.
protected  boolean prePaint()
          Called before the first cell is painted.
 void propertyChange(java.beans.PropertyChangeEvent e)
 void reloadFromTheme()
          Reloads all properties from the com.miginfocom.theme
protected  void repaint(java.awt.Rectangle bounds)
          Repaint the date area if not null.
 void setThemeContext(java.lang.String context)
          Set a new com.miginfocom.theme context.
protected  void updateTypeArray()
          Setup a cache for all objects and repaint the part that got changed.
Methods inherited from class com.miginfocom.calendar.decorators.CellLabelDecorator
cleanStringLabelCache, getAlignX, getAlignY, getBackground, getBorder, getCellModulo, getDateFormat, getDateGrid, getDateGridContainer, getFirstDateFormat, getFirstInField, getFont, getForeground, getLabelString, getMinimumCellSize, getNowBackground, getNowBorder, getNowDateFormat, getNowFont, getNowForeground, getNowPlaceRect, getNowRangeType, getNowShadowForeground, getNowShadowOffset, getShadowForeground, getShadowOffset, getTextAntiAlias, getUlWidth, invalidateDateRange, isAntiAlias, postPaint, setAlignX, setAlignY, setAntiAlias, setBackground, setBorder, setCellModulo, setDateFormat, setFirstDateFormat, setFirstInField, setFont, setForeground, setMinimumCellSize, setNowBackground, setNowBorder, setNowDateFormat, setNowFont, setNowForeground, setNowPlaceRect, setNowRangeType, setNowShadowForeground, setNowShadowOffset, setShadowForeground, setShadowOffset, setTextAntiAlias, setUlWidth, useStringLabelCache
Methods inherited from class com.miginfocom.calendar.decorators.GridCellDecorator
createCellRects, doPaint, getPlaceRect, getSizeMode, setPlaceRect, setSizeMode
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


public static final java.lang.String[] MAIN_KEYS
Constructor Detail


public ThemeCellLabelDecorator(DateArea dateArea,
                               int layerIndex,
                               java.lang.String themeContext)

dateArea - The date area to decorate. Not null.
layerIndex - A number to indicate the order in which to paint something. Lower if painted before. I.e. under.
themeContext - The com.miginfocom.theme context used for getting a com.miginfocom.theme.
See Also:
Method Detail


protected void paintCell(java.awt.Graphics2D g2,
                         int r,
                         int c,
                         java.awt.Rectangle b)
Description copied from class: GridCellDecorator
Paints the cell, or part thereof.

paintCell in class CellLabelDecorator
g2 - The object to paint in. Paint may be changed and not restored for every call.
r - The row beeing painted.
c - The column beeing painted
b - The bounds of the cell, or part there of, to be painted.


protected boolean prePaint()
Description copied from class: GridCellDecorator
Called before the first cell is painted. Possible to do setup.

prePaint in class CellLabelDecorator
If the paint should continue. If false GridCellDecorator.paintCell(java.awt.Graphics2D, int, int, java.awt.Rectangle) will not be called this round. GridCellDecorator.postPaint() will be called though.


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


public void reloadFromTheme()
Reloads all properties from the com.miginfocom.theme


protected void updateTypeArray()
Setup a cache for all objects and repaint the part that got changed.


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

gridChanged in class CellLabelDecorator
e - The event.


public void dateRangeChanged(DateChangeEvent e)
Description copied from interface: DateChangeListener
Called when a date range changed.

Specified by:
dateRangeChanged in interface DateChangeListener
e - The event that explains what happened


public void setThemeContext(java.lang.String context)
Set a new com.miginfocom.theme context.

context - The com.miginfocom.theme context used for getting a com.miginfocom.theme.


public DateArea getDateArea()
Might return null since the date area is kept in a WeakReference

The datearea or null.


protected void repaint(java.awt.Rectangle bounds)
Repaint the date area if not null.

bounds - The bounds. Not null.


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

Copyright © 2009 MiG InfoCom AB. All Rights Reserved.