org.jdesktop.swingx.decorator
Class PainterHighlighter

java.lang.Object
  extended by org.jdesktop.swingx.decorator.AbstractHighlighter
      extended by org.jdesktop.swingx.decorator.PainterHighlighter
All Implemented Interfaces:
Highlighter

public class PainterHighlighter
extends AbstractHighlighter

Highlighter implementation which uses Painter.

NOTE: this will change once the Painter api is stable.


Field Summary
 
Fields inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
listenerList
 
Constructor Summary
PainterHighlighter()
          Instantiates a PainterHighlighter with null painter and default predicate.
PainterHighlighter(Painter painter)
          Instantiates a PainterHighlighter with the given Painter and default predicate.
PainterHighlighter(Painter painter, HighlightPredicate predicate)
          Instantiates a PainterHighlighter with the given painter and predicate.
 
Method Summary
protected  Component doHighlight(Component component, ComponentAdapter adapter)
          Apply the highlights.
 Painter getPainter()
          Returns to Painter used in this Highlighter.
 Component highlight(Component component, ComponentAdapter adapter)
          Decorates the specified component for the given component adapter. This implementation checks the HighlightPredicate and calls doHighlight to apply the decoration. Overridden to type check the component.
 void setPainter(Painter painter)
          Sets the Painter to use in this Highlighter, may be null.
 
Methods inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
addChangeListener, fireStateChanged, getChangeListeners, getHighlightPredicate, removeChangeListener, setHighlightPredicate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PainterHighlighter

public PainterHighlighter()
Instantiates a PainterHighlighter with null painter and default predicate.


PainterHighlighter

public PainterHighlighter(Painter painter)
Instantiates a PainterHighlighter with the given Painter and default predicate.

Parameters:
painter - the painter to use

PainterHighlighter

public PainterHighlighter(Painter painter,
                          HighlightPredicate predicate)
Instantiates a PainterHighlighter with the given painter and predicate.

Parameters:
painter -
predicate -
Method Detail

setPainter

public void setPainter(Painter painter)
Sets the Painter to use in this Highlighter, may be null. PENDING: Null indicates to not highlight (?). Or up to subclasses

Parameters:
painter -

getPainter

public Painter getPainter()
Returns to Painter used in this Highlighter.

Returns:
the Painter used in this Highlighter, may be null.

highlight

public Component highlight(Component component,
                           ComponentAdapter adapter)
Decorates the specified component for the given component adapter. This implementation checks the HighlightPredicate and calls doHighlight to apply the decoration. Returns the undecorated component if false. Overridden to type check the component. Calls super if the component is PainterAware, returns the undecorated component otherwise.

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

doHighlight

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

This implementation sets the painter if it is not null. Does nothing otherwise.

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