org.jcreme.swing.table.colormodel
Class LayeredColorModel

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

public class LayeredColorModel
extends DefaultTableColorModel
implements TableColorModel

This class enables to layer color models. The first ColorModel is the top layer. Each layer hides the layers underneath it.

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

Field Summary
 
Fields inherited from class org.jcreme.swing.table.colormodel.DefaultTableColorModel
MINIMUM_COLOR_DISTANCE
 
Constructor Summary
LayeredColorModel()
           
 
Method Summary
 void addLayer(TableColorModel layer)
          Enables to add a layer to the model.
 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.
 TableColorModel[] getLayers()
          Gives access to the layers that compose the model.
 void removeLayer(TableColorModel layer)
          Enables to remove a layer from the model.
 void removeLayerAt(int position)
          Enables to remove the layer at a given depth from the model.
 void setLayerAt(TableColorModel layer, int position)
          Enables to add a layer to the model at a given depth.
 
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

LayeredColorModel

public LayeredColorModel()
Method Detail

addLayer

public void addLayer(TableColorModel layer)
Enables to add a layer to the model.

Parameters:
layer - the layer to add.

setLayerAt

public void setLayerAt(TableColorModel layer,
                       int position)
Enables to add a layer to the model at a given depth.

Parameters:
layer - the layer to add.
position - the depth of the layer in the model.

getLayers

public TableColorModel[] getLayers()
Gives access to the layers that compose the model.

Returns:
an array containing the layers by increasing depth.

removeLayer

public void removeLayer(TableColorModel layer)
Enables to remove a layer from the model.

Parameters:
layer - the layer to remove.

removeLayerAt

public void removeLayerAt(int position)
Enables to remove the layer at a given depth from the model.

Parameters:
position - the depth of the layer to remove.

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.