org.jcreme.swing.table
Interface TableColorModel

All Known Implementing Classes:
AbstractValueIndexedTableColorModel, BaseCyclingColorModel, ColumnCyclingColorModel, CyclingColorModel, DefaultTableColorModel, LayeredColorModel, LineTitlesColorModel

public interface TableColorModel

This class enables to set the color scheme for a JColoredTable. It can give a different color for the background and the foreground of any cell. A typical use is to implement a consistent color scheme whatever the renderer are.

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

Method Summary
 void addTableColorModelListener(TableColorModelListener listener)
          Enables to add listeners for the modifications of the color scheme.
 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 getForegroundColor(int row, int column, boolean selected, java.awt.Component renderer)
          Gives access to the foreground color of a cell.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Gets the list of the listeners registered for the modifications of the color scheme.
 javax.swing.table.TableModel getTableModel()
          Gives access to the TableModel colored by this TableColorModel.
 void removeTableColorModelListener(TableColorModelListener listener)
          Unregisters the listener for the modifications of the color model.
 void setTableModel(javax.swing.table.TableModel model)
          Sets the model that will be colored by this TableColorModel.
 

Method Detail

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.

Parameters:
row - the cell's row.
column - the cell's column.
selected - whether the cell is currently selected or not.
renderer -
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.

Parameters:
row - the cell's row.
column - the cell's column.
selected - whether the cell is currently selected or not.
renderer -
Returns:
the foreground color for the cell.

addTableColorModelListener

public void addTableColorModelListener(TableColorModelListener listener)
Enables to add listeners for the modifications of the color scheme.

Parameters:
listener - the listener to add.

removeTableColorModelListener

public void removeTableColorModelListener(TableColorModelListener listener)
Unregisters the listener for the modifications of the color model.

Parameters:
listener - the listener to remove.

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Gets the list of the listeners registered for the modifications of the color scheme.

Parameters:
listenerType - The class of listeners to retrieve.
Returns:
The list of all listeners of the given type registered in the list.

setTableModel

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

Parameters:
model - the data to be colored by this model.

getTableModel

public javax.swing.table.TableModel getTableModel()
Gives access to the TableModel colored by this TableColorModel.

Returns:
the data colored by this model.


Copyright 2006 null. All Rights Reserved.