public class PatternPredicate extends Object implements HighlightPredicate
Turns on the highlight of a single or all columns of the current row if a match of the String representation of cell content against the given Pattern is found.
The match logic can be configured to either test one specific column in the current row or all columns. In the latter case the logic is the same as in RowFilters.GeneralFilter: the row is included if any of the cell contents in the row are matches.
HighlightPredicate.AndHighlightPredicate, HighlightPredicate.ColumnHighlightPredicate, HighlightPredicate.ColumnTypeHighlightPredicate, HighlightPredicate.DepthHighlightPredicate, HighlightPredicate.EqualsHighlightPredicate, HighlightPredicate.IdentifierHighlightPredicate, HighlightPredicate.NotHighlightPredicate, HighlightPredicate.OrHighlightPredicate, HighlightPredicate.RowGroupHighlightPredicate, HighlightPredicate.TypeHighlightPredicate
Modifier and Type | Field and Description |
---|---|
static int |
ALL |
private int |
highlightColumn |
private Pattern |
pattern |
private int |
testColumn |
ALWAYS, BIG_DECIMAL_NEGATIVE, EDITABLE, EMPTY_INTEGER_ARRAY, EMPTY_OBJECT_ARRAY, EMPTY_PREDICATE_ARRAY, EVEN, HAS_FOCUS, INTEGER_NEGATIVE, IS_FOLDER, IS_LEAF, IS_SELECTED, IS_TEXT_TRUNCATED, NEVER, ODD, READ_ONLY, ROLLOVER_CELL, ROLLOVER_COLUMN, ROLLOVER_ROW
Constructor and Description |
---|
PatternPredicate(Pattern pattern)
Instantiates a Predicate with the given Pattern testing against
all columns and highlighting all columns.
|
PatternPredicate(Pattern pattern,
int testColumn)
Instantiates a Predicate with the given Pattern and testColumn index
(in model coordinates) highlighting all columns.
|
PatternPredicate(Pattern pattern,
int testColumn,
int decorateColumn)
Instantiates a Predicate with the given Pattern and test-/decorate
column index in model coordinates.
|
PatternPredicate(String pattern)
Instantiates a Predicate with the given Pattern testing against
all columns and highlighting all columns.
|
PatternPredicate(String regex,
int testColumn)
Instantiates a Predicate with the given regex and test
column index in model coordinates.
|
PatternPredicate(String regex,
int testColumn,
int decorateColumn)
Instantiates a Predicate with the given regex and test-/decorate
column index in model coordinates.
|
Modifier and Type | Method and Description |
---|---|
int |
getHighlightColumn() |
Pattern |
getPattern() |
int |
getTestColumn() |
private boolean |
isHighlightCandidate(ComponentAdapter adapter)
A quick pre-check.
|
boolean |
isHighlighted(Component renderer,
ComponentAdapter adapter)
Returns a boolean to indicate whether the component should be
highlighted.
|
private boolean |
test(ComponentAdapter adapter)
Test the value.
|
private boolean |
testColumn(ComponentAdapter adapter,
int testColumn) |
public static final int ALL
private int highlightColumn
private int testColumn
public PatternPredicate(Pattern pattern, int testColumn)
pattern
- the Pattern to test the cell value againsttestColumn
- the column index in model coordinates
of the cell which contains the value to test against the patternpublic PatternPredicate(Pattern pattern)
pattern
- the Pattern to test the cell value againstpublic PatternPredicate(Pattern pattern, int testColumn, int decorateColumn)
pattern
- the Pattern to test the cell value againsttestColumn
- the column index in model coordinates
of the cell which contains the value
to test against the patterndecorateColumn
- the column index in model coordinates
of the cell which should be
decorated if the test against the value succeeds.public PatternPredicate(String pattern)
pattern
- the Pattern to test the cell value againstpublic PatternPredicate(String regex, int testColumn)
regex
- the regex string to test the cell value againsttestColumn
- the column index in model coordinates
of the cell which contains the value
to test against the patternpublic PatternPredicate(String regex, int testColumn, int decorateColumn)
regex
- the regex string to test the cell value againsttestColumn
- the column index in model coordinates
of the cell which contains the value
to test against the patterndecorateColumn
- the column index in model coordinates
of the cell which should be
decorated if the test against the value succeeds.public boolean isHighlighted(Component renderer, ComponentAdapter adapter)
HighlightPredicate
Note: both parameters should be considered strictly read-only!
isHighlighted
in interface HighlightPredicate
renderer
- the cell renderer component that is to be decorated,
must not be nulladapter
- the ComponentAdapter for this decorate operation,
most not be nullprivate boolean test(ComponentAdapter adapter)
adapter
- private boolean testColumn(ComponentAdapter adapter, int testColumn)
adapter
- testColumn
- private boolean isHighlightCandidate(ComponentAdapter adapter)
adapter
- public int getHighlightColumn()
public Pattern getPattern()
public int getTestColumn()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses