org.jdesktop.swingx.decorator
Class ColorHighlighter

java.lang.Object
  extended by org.jdesktop.swingx.decorator.AbstractHighlighter
      extended by org.jdesktop.swingx.decorator.ColorHighlighter
All Implemented Interfaces:
Highlighter
Direct Known Subclasses:
HighlighterFactory.UIColorHighlighter, ResetDTCRColorHighlighter, ShadingColorHighlighter

public class ColorHighlighter
extends AbstractHighlighter

TODO add type doc


Field Summary
 
Fields inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
listenerList
 
Constructor Summary
ColorHighlighter()
          Default constructor for mutable Highlighter.
ColorHighlighter(Color cellBackground, Color cellForeground)
          Constructs a mutable Highlighter with the specified background and foreground colors, and null selectedBackground/-foreground.
ColorHighlighter(Color cellBackground, Color cellForeground, Color selectedBackground, Color selectedForeground)
          Constructs a mutable Highlighter with the specified background and foreground colors for unselected and selected cells.
ColorHighlighter(Color cellBackground, Color cellForeground, Color selectedBackground, Color selectedForeground, HighlightPredicate predicate)
          Constructs a Highlighter with the specified background and foreground colors with mutability depending on given flag.
ColorHighlighter(Color cellBackground, Color cellForeground, HighlightPredicate predicate)
          Constructs a mutable Highlighter with the specified unselected background/foreground colors and HighlightPredicate.
 
Method Summary
protected  void applyBackground(Component renderer, ComponentAdapter adapter)
          Applies a suitable background for the renderer component within the specified adapter.
protected  void applyForeground(Component renderer, ComponentAdapter adapter)
          Applies a suitable foreground for the renderer component within the specified adapter.
protected  Component doHighlight(Component renderer, ComponentAdapter adapter)
          Apply the highlights.
 Color getBackground()
          Returns the background color of this LegacyHighlighter.
 Color getForeground()
          Returns the foreground color of this LegacyHighlighter.
 Color getSelectedBackground()
          Returns the selected background color of this LegacyHighlighter.
 Color getSelectedForeground()
          Returns the selected foreground color of this LegacyHighlighter.
 void setBackground(Color color)
          Sets the background color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable.
 void setForeground(Color color)
          Sets the foreground color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable.
 void setSelectedBackground(Color color)
          Sets the selected background color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable.
 void setSelectedForeground(Color color)
          Sets the selected foreground color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable.
 
Methods inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
addChangeListener, fireStateChanged, getChangeListeners, getHighlightPredicate, highlight, removeChangeListener, setHighlightPredicate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorHighlighter

public ColorHighlighter()
Default constructor for mutable Highlighter. Initializes colors to null and uses the default predicate.


ColorHighlighter

public ColorHighlighter(Color cellBackground,
                        Color cellForeground)
Constructs a mutable Highlighter with the specified background and foreground colors, and null selectedBackground/-foreground.

Parameters:
cellBackground - background color for unselected cell state
cellForeground - foreground color for unselected cell state

ColorHighlighter

public ColorHighlighter(Color cellBackground,
                        Color cellForeground,
                        HighlightPredicate predicate)
Constructs a mutable Highlighter with the specified unselected background/foreground colors and HighlightPredicate. Initializes selected colors to null.

Parameters:
cellBackground - background color for unselected cell state
cellForeground - foreground color for unselected cell state
predicate - the HighlightPredicate to use.

ColorHighlighter

public ColorHighlighter(Color cellBackground,
                        Color cellForeground,
                        Color selectedBackground,
                        Color selectedForeground)
Constructs a mutable Highlighter with the specified background and foreground colors for unselected and selected cells.

Parameters:
cellBackground - background color for unselected cell state
cellForeground - foreground color for unselected cell state
selectedBackground - background color for selected cell state
selectedForeground - foreground color for selected cell state

ColorHighlighter

public ColorHighlighter(Color cellBackground,
                        Color cellForeground,
                        Color selectedBackground,
                        Color selectedForeground,
                        HighlightPredicate predicate)
Constructs a Highlighter with the specified background and foreground colors with mutability depending on given flag.

Parameters:
cellBackground - background color for unselected cell state
cellForeground - foreground color for unselected cell state
selectedBackground - background color for selected cell state
selectedForeground - foreground color for selected cell state
Method Detail

doHighlight

protected Component doHighlight(Component renderer,
                                ComponentAdapter adapter)
Apply the highlights.

Specified by:
doHighlight in class AbstractHighlighter
Parameters:
renderer - the cell renderer component that is to be decorated
adapter - the ComponentAdapter for this decorate operation
See Also:
AbstractHighlighter.highlight(Component, ComponentAdapter)

applyBackground

protected void applyBackground(Component renderer,
                               ComponentAdapter adapter)
Applies a suitable background for the renderer component within the specified adapter.

This implementation applies its background or selectedBackground color (depending on the adapter's selected state) if != null. Otherwise it does nothing.

Parameters:
renderer - the cell renderer component that is to be decorated
adapter - the ComponentAdapter for this decorate operation

applyForeground

protected void applyForeground(Component renderer,
                               ComponentAdapter adapter)
Applies a suitable foreground for the renderer component within the specified adapter.

This implementation applies its foreground or selectedfForeground color (depending on the adapter's selected state) if != null. Otherwise it does nothing.

Parameters:
renderer - the cell renderer component that is to be decorated
adapter - the ComponentAdapter for this decorate operation

getBackground

public Color getBackground()
Returns the background color of this LegacyHighlighter.

Returns:
the background color of this LegacyHighlighter, or null, if no background color has been set

setBackground

public void setBackground(Color color)
Sets the background color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable. Does nothing if immutable.

Parameters:
color - the background color of this LegacyHighlighter, or null, to clear any existing background color

getForeground

public Color getForeground()
Returns the foreground color of this LegacyHighlighter.

Returns:
the foreground color of this LegacyHighlighter, or null, if no foreground color has been set

setForeground

public void setForeground(Color color)
Sets the foreground color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable. Does nothing if immutable.

Parameters:
color - the foreground color of this LegacyHighlighter, or null, to clear any existing foreground color

getSelectedBackground

public Color getSelectedBackground()
Returns the selected background color of this LegacyHighlighter.

Returns:
the selected background color of this LegacyHighlighter, or null, if no selected background color has been set

setSelectedBackground

public void setSelectedBackground(Color color)
Sets the selected background color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable. Does nothing if immutable.

Parameters:
color - the selected background color of this LegacyHighlighter, or null, to clear any existing selected background color

getSelectedForeground

public Color getSelectedForeground()
Returns the selected foreground color of this LegacyHighlighter.

Returns:
the selected foreground color of this LegacyHighlighter, or null, if no selected foreground color has been set

setSelectedForeground

public void setSelectedForeground(Color color)
Sets the selected foreground color of this LegacyHighlighter and notifies registered ChangeListeners if this is mutable. Does nothing if immutable.

Parameters:
color - the selected foreground color of this LegacyHighlighter, or null, to clear any existing selected foreground color