org.jcreme.swing.table.colormodel
Class ColumnCyclingColorModel

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

public class ColumnCyclingColorModel
extends BaseCyclingColorModel
implements TableColorModel

This class enables to give cycling colors to the columns of a Table. The cycle can have any length desired and can contain any number of colors. This ColorModel implementation acts on columns rather than on cells.

Version:
$Revision: 1.1 $
Author:
$Author: dbregeon $

Field Summary
 
Fields inherited from class org.jcreme.swing.table.colormodel.DefaultTableColorModel
MINIMUM_COLOR_DISTANCE
 
Constructor Summary
ColumnCyclingColorModel(java.awt.Color[] bgColors, java.awt.Color[] fgColors, java.awt.Color bgSelectedColor, java.awt.Color fgSelectedColor, int cycleLength)
          Creates new CyclingColorModel
 
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 getForegroundColor(int row, int column, boolean selected, java.awt.Component renderer)
          Gives access to the foreground color of a cell.
 
Methods inherited from class org.jcreme.swing.table.colormodel.BaseCyclingColorModel
getBackgroundColors, getBackgroundSelectedColor, getCycleLength, getForegroundColors, getForegroundSelectedColor, setBackgroundColors, setBackgroundSelectedColor, setCycleLength, setForegroundColors, setForegroundSelectedColor
 
Methods inherited from class org.jcreme.swing.table.colormodel.DefaultTableColorModel
addTableColorModelListener, ensureMinimumDistance, fireTableColorModelChanged, getDistance, getListeners, getTableModel, mixColors, removeTableColorModelListener, setTableModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jcreme.swing.table.TableColorModel
addTableColorModelListener, getListeners, getTableModel, removeTableColorModelListener, setTableModel
 

Constructor Detail

ColumnCyclingColorModel

public ColumnCyclingColorModel(java.awt.Color[] bgColors,
                               java.awt.Color[] fgColors,
                               java.awt.Color bgSelectedColor,
                               java.awt.Color fgSelectedColor,
                               int cycleLength)
Creates new CyclingColorModel

Parameters:
bgColors - the backgroud colors of the cycle.
fgColors - the foreground colors of the cycle.
bgSelectedColor - the background color for selected columns.
fgSelectedColor - the foreground color for selected columns.
cycleLength - the number of reps of the same color in the cycle.
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.

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.


Copyright 2006 null. All Rights Reserved.