Package org.jdesktop.swingx.decorator
Class CompoundHighlighter
- java.lang.Object
-
- org.jdesktop.swingx.decorator.AbstractHighlighter
-
- org.jdesktop.swingx.decorator.CompoundHighlighter
-
- All Implemented Interfaces:
Highlighter
,UIDependent
public class CompoundHighlighter extends AbstractHighlighter implements UIDependent
A class which manages the lists ofHighlighter
s.- See Also:
Highlighter
-
-
Field Summary
Fields Modifier and Type Field Description static Highlighter[]
EMPTY_HIGHLIGHTERS
private javax.swing.event.ChangeListener
highlighterChangeListener
the listener for changes in contained Highlighters.protected java.util.List<Highlighter>
highlighters
-
Fields inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
listenerList
-
-
Constructor Summary
Constructors Constructor Description CompoundHighlighter(Highlighter... inList)
Instantiates a CompoundHighlighter containing the givenHighlighter
s.CompoundHighlighter(HighlightPredicate predicate, Highlighter... inList)
Instantiates a CompoundHighlighter with the given predicate containing the givenHighlighter
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHighlighter(Highlighter highlighter)
Appends a highlighter to the pipeline.void
addHighlighter(Highlighter highlighter, boolean prepend)
Adds a highlighter to the pipeline.private void
addHighlighterSilently(Highlighter highlighter, boolean prepend)
protected javax.swing.event.ChangeListener
createHighlighterChangeListener()
Creates and returns the ChangeListener registered to containedHighlighter
s.protected java.awt.Component
doHighlight(java.awt.Component stamp, ComponentAdapter adapter)
Apply the highlights.protected javax.swing.event.ChangeListener
getHighlighterChangeListener()
Returns theChangeListner
to containedHighlighter
s.Highlighter[]
getHighlighters()
Returns an array of contained Highlighters.private void
removeAllHighlightersSilently()
Removes all contained highlighters without firing an event.void
removeHighlighter(Highlighter hl)
Removes a highlighter from the pipeline.void
setHighlighters(Highlighter... inList)
Sets the givenHighlighter
s.void
updateUI()
Updates all internal visuals after changing a UI-delegate.private void
updateUI(Highlighter hl)
Updates the ui-dependent state of the given Highlighter.-
Methods inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
addChangeListener, areEqual, canHighlight, fireStateChanged, getChangeListeners, getHighlightPredicate, highlight, removeChangeListener, setHighlightPredicate
-
-
-
-
Field Detail
-
EMPTY_HIGHLIGHTERS
public static final Highlighter[] EMPTY_HIGHLIGHTERS
-
highlighters
protected java.util.List<Highlighter> highlighters
-
highlighterChangeListener
private javax.swing.event.ChangeListener highlighterChangeListener
the listener for changes in contained Highlighters.
-
-
Constructor Detail
-
CompoundHighlighter
public CompoundHighlighter(Highlighter... inList)
Instantiates a CompoundHighlighter containing the givenHighlighter
s.- Parameters:
inList
- zero or more not-null Highlighters to manage by this CompoundHighlighter.- Throws:
java.lang.NullPointerException
- if array is null or array contains null values.
-
CompoundHighlighter
public CompoundHighlighter(HighlightPredicate predicate, Highlighter... inList)
Instantiates a CompoundHighlighter with the given predicate containing the givenHighlighter
s.- Parameters:
predicate
- the highlightPredicate to useinList
- zero or more not-null Highlighters to manage by this CompoundHighlighter.- Throws:
java.lang.NullPointerException
- if array is null or array contains null values.
-
-
Method Detail
-
setHighlighters
public void setHighlighters(Highlighter... inList)
Sets the givenHighlighter
s.- Parameters:
inList
- zero or more not-null Highlighters to manage by this CompoundHighlighter.- Throws:
java.lang.NullPointerException
- if array is null or array contains null values.
-
removeAllHighlightersSilently
private void removeAllHighlightersSilently()
Removes all contained highlighters without firing an event. Deregisters the listener from all.
-
addHighlighter
public void addHighlighter(Highlighter highlighter)
Appends a highlighter to the pipeline.- Parameters:
highlighter
- highlighter to add- Throws:
java.lang.NullPointerException
- if highlighter is null.
-
addHighlighter
public void addHighlighter(Highlighter highlighter, boolean prepend)
Adds a highlighter to the pipeline. PENDING: Duplicate inserts?- Parameters:
highlighter
- highlighter to addprepend
- prepend the highlighter if true; false will append- Throws:
java.lang.NullPointerException
- if highlighter is null.
-
addHighlighterSilently
private void addHighlighterSilently(Highlighter highlighter, boolean prepend)
-
removeHighlighter
public void removeHighlighter(Highlighter hl)
Removes a highlighter from the pipeline.- Parameters:
hl
- highlighter to remove
-
getHighlighters
public Highlighter[] getHighlighters()
Returns an array of contained Highlighters.- Returns:
- the contained Highlighters, might be empty but never null.
-
updateUI
public void updateUI()
Updates all internal visuals after changing a UI-delegate.Implemented to call updateUI on contained Highlighters.
- Specified by:
updateUI
in interfaceUIDependent
- See Also:
JComponent.updateUI()
-
getHighlighterChangeListener
protected javax.swing.event.ChangeListener getHighlighterChangeListener()
Returns theChangeListner
to containedHighlighter
s. The listener is lazily created.- Returns:
- the listener for contained highlighters, guaranteed to be not null.
-
createHighlighterChangeListener
protected javax.swing.event.ChangeListener createHighlighterChangeListener()
Creates and returns the ChangeListener registered to containedHighlighter
s. Here: fires a stateChanged on each notification.- Returns:
- the listener for contained Highlighters.
-
updateUI
private void updateUI(Highlighter hl)
Updates the ui-dependent state of the given Highlighter.- Parameters:
hl
- the highlighter to update.
-
doHighlight
protected java.awt.Component doHighlight(java.awt.Component stamp, ComponentAdapter adapter)
Apply the highlights.- Specified by:
doHighlight
in classAbstractHighlighter
- Parameters:
stamp
- the cell renderer component that is to be decoratedadapter
- the ComponentAdapter for this decorate operation- See Also:
AbstractHighlighter.highlight(Component, ComponentAdapter)
-
-