csheets.ui.ext
Class CellDecorator

java.lang.Object
  extended by csheets.ui.ext.CellDecorator
Direct Known Subclasses:
AssertableCellDecorator, TestableCellDecorator

public abstract class CellDecorator
extends Object

A cell decorator visualizes extension-specific data by drawing on top of a cell's graphics context. Decorators should respect the enabled state set on them.

Author:
Einar Pehrson

Field Summary
protected  boolean enabled
          Whether the decorator should be used when rendering, default is false
 
Constructor Summary
CellDecorator()
          Creates a new cell decorator.
 
Method Summary
abstract  void decorate(JComponent component, Graphics g, Cell cell, boolean selected, boolean hasFocus)
          Decorates the given graphics context, by drawing visualizations of extension-specific data on it.
 boolean isEnabled()
          Returns whether the decorator should be used when rendering.
 void setEnabled(boolean enabled)
          Sets whether the decorator should be used when rendering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

protected boolean enabled
Whether the decorator should be used when rendering, default is false

Constructor Detail

CellDecorator

public CellDecorator()
Creates a new cell decorator.

Method Detail

decorate

public abstract void decorate(JComponent component,
                              Graphics g,
                              Cell cell,
                              boolean selected,
                              boolean hasFocus)
Decorates the given graphics context, by drawing visualizations of extension-specific data on it.

Parameters:
component - the cell renderer component
g - the graphics context on which drawing should be done
cell - the cell being rendered
selected - whether the cell is selected
hasFocus - whether the cell has focus

isEnabled

public final boolean isEnabled()
Returns whether the decorator should be used when rendering.

Returns:
true if the decorator should be used when rendering

setEnabled

public final void setEnabled(boolean enabled)
Sets whether the decorator should be used when rendering.

Parameters:
enabled - whether the decorator should be used when rendering