Package org.jdesktop.swingx.decorator
Class BorderHighlighter
- java.lang.Object
-
- org.jdesktop.swingx.decorator.AbstractHighlighter
-
- org.jdesktop.swingx.decorator.BorderHighlighter
-
- All Implemented Interfaces:
Highlighter
public class BorderHighlighter extends AbstractHighlighter
A Highlighter that applies a border the the renderer component. The resulting border can be configured to - ignore the component's border, set this highlighter's border - compound of this highlighter's border and component border, with this highlighter's border either inner or outer. The default setting is compound outer.
-
-
Field Summary
-
Fields inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
listenerList
-
-
Constructor Summary
Constructors Constructor Description BorderHighlighter()
Instantiates a BorderHighlighter with no padding.BorderHighlighter(Border paddingBorder)
Instantiates a BorderHighlighter with the given padding.BorderHighlighter(HighlightPredicate predicate)
Instantiates a BorderHighlighter with no padding, using the given predicate.BorderHighlighter(HighlightPredicate predicate, Border paddingBorder)
Instantiates a BorderHighlighter with the given padding, HighlightPredicate and default compound property.BorderHighlighter(HighlightPredicate predicate, Border paddingBorder, boolean compound)
Instantiates a BorderHighlighter with the given padding, HighlightPredicate, compound property and default inner property.BorderHighlighter(HighlightPredicate predicate, Border paddingBorder, boolean compound, boolean inner)
Instantiates a BorderHighlighter with the given padding, HighlightPredicate and compound property.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canHighlight(Component component, ComponentAdapter adapter)
Subclasses may override to further limit the highlighting based on Highlighter state, f.i.protected Component
doHighlight(Component renderer, ComponentAdapter adapter)
Apply the highlights.Border
getBorder()
Returns the border used for highlighing.boolean
isCompound()
boolean
isInner()
Returns the inner property.void
setBorder(Border padding)
Sets the Border used for highlighting.void
setCompound(boolean compound)
Sets the compound property.void
setInner(boolean inner)
Sets the inner property.-
Methods inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
addChangeListener, areEqual, fireStateChanged, getChangeListeners, getHighlightPredicate, highlight, removeChangeListener, setHighlightPredicate
-
-
-
-
Constructor Detail
-
BorderHighlighter
public BorderHighlighter()
Instantiates a BorderHighlighter with no padding. The Highlighter is applied unconditionally.
-
BorderHighlighter
public BorderHighlighter(HighlightPredicate predicate)
Instantiates a BorderHighlighter with no padding, using the given predicate.- Parameters:
predicate
- the HighlightPredicate to use
-
BorderHighlighter
public BorderHighlighter(Border paddingBorder)
Instantiates a BorderHighlighter with the given padding. The Highlighter is applied unconditionally.- Parameters:
paddingBorder
- the border to apply as visual decoration.
-
BorderHighlighter
public BorderHighlighter(HighlightPredicate predicate, Border paddingBorder)
Instantiates a BorderHighlighter with the given padding, HighlightPredicate and default compound property. If the predicate is null, the highlighter will be applied unconditionally.- Parameters:
predicate
- the HighlightPredicate to usepaddingBorder
- the border to apply as visual decoration.
-
BorderHighlighter
public BorderHighlighter(HighlightPredicate predicate, Border paddingBorder, boolean compound)
Instantiates a BorderHighlighter with the given padding, HighlightPredicate, compound property and default inner property. If the predicate is null, the highlighter will be applied unconditionally.- Parameters:
predicate
- the HighlightPredicate to usepaddingBorder
- the border to apply as visual decoration.compound
- the compound property.
-
BorderHighlighter
public BorderHighlighter(HighlightPredicate predicate, Border paddingBorder, boolean compound, boolean inner)
Instantiates a BorderHighlighter with the given padding, HighlightPredicate and compound property. If the predicate is null, the highlighter will be applied unconditionally.- Parameters:
predicate
- the HighlightPredicate to usepaddingBorder
- the border to apply as visual decoration.compound
- the compound propertyinner
- the inner property
-
-
Method Detail
-
doHighlight
protected Component doHighlight(Component renderer, ComponentAdapter adapter)
Apply the highlights.- Specified by:
doHighlight
in classAbstractHighlighter
- Parameters:
renderer
- the cell renderer component that is to be decoratedadapter
- the ComponentAdapter for this decorate operation- See Also:
AbstractHighlighter.highlight(Component, ComponentAdapter)
-
canHighlight
protected boolean canHighlight(Component component, ComponentAdapter adapter)
Subclasses may override to further limit the highlighting based on Highlighter state, f.i. a PainterHighlighter can only be applied to PainterAware components.This implementation returns true always.
Overridden to prevent highlighting if there's no padding available or the renderer is not of type JComponent.
- Overrides:
canHighlight
in classAbstractHighlighter
- Parameters:
component
- the cell renderer component that is to be decoratedadapter
- the ComponentAdapter for this decorate operation- Returns:
- true padding is available and the renderer is a JComponent. False otherwise.
-
setCompound
public void setCompound(boolean compound)
Sets the compound property. If true, the highlight border will be compounded with the renderer's border, if any. Otherwise, the highlight border will replace the renderer's border.The default value is true;
- Parameters:
compound
- a boolean indicating whether the highlight border should be compounded with the component's border.
-
isCompound
public boolean isCompound()
- Returns:
- the compound property.
- See Also:
setCompound(boolean)
-
setInner
public void setInner(boolean inner)
Sets the inner property. If true/false and compounded is enabled the highlight border will be the inner/outer border of the compound. The default value is false;- Parameters:
inner
- a boolean indicating whether the highlight border should be compounded as inner or outer border.- See Also:
isInner()
-
isInner
public boolean isInner()
Returns the inner property.- Returns:
- the inner property.
- See Also:
setInner(boolean)
-
setBorder
public void setBorder(Border padding)
Sets the Border used for highlighting.The default value is null.
- Parameters:
padding
- the Border to use
-
getBorder
public Border getBorder()
Returns the border used for highlighing.- Returns:
- the border used to highlight.
-
-