org.jcreme.swing.table.colormodel
Class ChangeHighlightingColorModel

java.lang.Object
  extended byorg.jcreme.swing.table.colormodel.DefaultTableColorModel
      extended byorg.jcreme.swing.table.colormodel.ChangeHighlightingColorModel
All Implemented Interfaces:
TableColorModel

public class ChangeHighlightingColorModel
extends DefaultTableColorModel

This TableColorModel enables to highlight the changes that occur in a TableModel. The cells that change are colored (background, foreground or both) for a short period (blink). This model can be used alone or combined with another ColorModel. In this case, the colors of the other model will be temporarily overriden by the highlight colors.

Version:
$Revision: 1.2 $
Author:
$Author: dbregeon $

Nested Class Summary
protected  class ChangeHighlightingColorModel.ChangeTimer
          This class enables to keep track of the event that has to be timed out.
 
Field Summary
 
Fields inherited from class org.jcreme.swing.table.colormodel.DefaultTableColorModel
MINIMUM_COLOR_DISTANCE
 
Constructor Summary
ChangeHighlightingColorModel()
          Creates a new instance of ChangeHighlightingColorModel
 
Method Summary
 java.awt.Color getBackgroundColor(int row, int column, boolean selected, java.awt.Component renderer)
          Gives access to the background color of a cell.
 java.awt.Color getBackgroundHighlightColor()
          Gives access to the background color that is applied when a cell is highlighted.
protected  java.util.Vector getChangeEvents()
           
 java.awt.Color getForegroundColor(int row, int column, boolean selected, java.awt.Component renderer)
          Gives access to the foreground color of a cell.
 java.awt.Color getForegroundHighlightColor()
          Gives access to the foreground color that is applied when a cell is highlighted.
 int getResiliencePeriod()
          Gives access to the resilience period (the number of milliseconds that the highlighting lasts).
protected  java.awt.event.ActionListener getTimerListener()
           
 TableColorModel getUnderlyingModel()
          Gives access to the underlying TableColorModel.
 void setBackgroundHighlightColor(java.awt.Color color)
          Enables to change the background color to apply when highlighting a change.
 void setForegroundHighlightColor(java.awt.Color color)
          Enables to change the foreground color to apply when highlighting a change.
 void setResiliencePeriod(int period)
          Enables the change resilience period.
 void setTableModel(javax.swing.table.TableModel model)
          Sets the model that will be colored by this TableColorModel.
 void setUnderlyingModel(TableColorModel model)
          Enables to change the underlying TableColorModel.
 
Methods inherited from class org.jcreme.swing.table.colormodel.DefaultTableColorModel
addTableColorModelListener, ensureMinimumDistance, fireTableColorModelChanged, getDistance, getListeners, getTableModel, mixColors, removeTableColorModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeHighlightingColorModel

public ChangeHighlightingColorModel()
Creates a new instance of ChangeHighlightingColorModel

Method Detail

getChangeEvents

protected java.util.Vector getChangeEvents()

getTimerListener

protected java.awt.event.ActionListener getTimerListener()

getBackgroundColor

public java.awt.Color getBackgroundColor(int row,
                                         int column,
                                         boolean selected,
                                         java.awt.Component renderer)
Gives access to the background color of a cell.

Specified by:
getBackgroundColor in interface TableColorModel
Overrides:
getBackgroundColor in class DefaultTableColorModel
Parameters:
row - the cell's row.
column - the cell's column.
selected - whether the cell is currently selected or not.
renderer - the renderer used to display the cell.
Returns:
the background color for the cell.

getForegroundColor

public java.awt.Color getForegroundColor(int row,
                                         int column,
                                         boolean selected,
                                         java.awt.Component renderer)
Gives access to the foreground color of a cell.

Specified by:
getForegroundColor in interface TableColorModel
Overrides:
getForegroundColor in class DefaultTableColorModel
Parameters:
row - the cell's row.
column - the cell's column.
selected - whether the cell is currently selected or not.
renderer - the renderer used to display the cell.
Returns:
the foreground color for the cell.

getBackgroundHighlightColor

public java.awt.Color getBackgroundHighlightColor()
Gives access to the background color that is applied when a cell is highlighted.

Returns:
the background color used for the highlighted cells.

setBackgroundHighlightColor

public void setBackgroundHighlightColor(java.awt.Color color)
Enables to change the background color to apply when highlighting a change.

Parameters:
color - the background color to use for the highlighted cells.

getForegroundHighlightColor

public java.awt.Color getForegroundHighlightColor()
Gives access to the foreground color that is applied when a cell is highlighted.

Returns:
the foreground color used for the highlighted cells.

setForegroundHighlightColor

public void setForegroundHighlightColor(java.awt.Color color)
Enables to change the foreground color to apply when highlighting a change.

Parameters:
color - the foreground color to use for the highlighted cells.

getResiliencePeriod

public int getResiliencePeriod()
Gives access to the resilience period (the number of milliseconds that the highlighting lasts).

Returns:
the number of milliseconds when the cell stays highlighted after it changed.

setResiliencePeriod

public void setResiliencePeriod(int period)
Enables the change resilience period.

Parameters:
period - the new number of milliseconds for which the cell must stay highlighted after it changed.

getUnderlyingModel

public TableColorModel getUnderlyingModel()
Gives access to the underlying TableColorModel.

Returns:
the underlying TableColorModel.

setUnderlyingModel

public void setUnderlyingModel(TableColorModel model)
Enables to change the underlying TableColorModel.

Parameters:
model - the new underliyng TableColorModel.

setTableModel

public void setTableModel(javax.swing.table.TableModel model)
Description copied from interface: TableColorModel
Sets the model that will be colored by this TableColorModel.

Specified by:
setTableModel in interface TableColorModel
Overrides:
setTableModel in class DefaultTableColorModel
See Also:
TableColorModel.setTableModel(javax.swing.table.TableModel)


Copyright 2006 null. All Rights Reserved.