Package org.jdesktop.swingx.decorator
Class PatternFilter
- java.lang.Object
-
- org.jdesktop.swingx.decorator.Filter
-
- org.jdesktop.swingx.decorator.PatternFilter
-
- All Implemented Interfaces:
PatternMatcher
public class PatternFilter extends Filter implements PatternMatcher
Pluggable pattern filter.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.regex.Patternpattern-
Fields inherited from class org.jdesktop.swingx.decorator.Filter
adapter, fromPrevious, pipeline
-
-
Constructor Summary
Constructors Constructor Description PatternFilter()Instantiates a includeAll PatternFilter with matchFlag 0 on column 0.PatternFilter(java.lang.String regularExpr, int matchFlags, int col)Instantiates a PatternFilter with a Pattern compiled from the given regex and matchFlags on the column in model coordinates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfilter()Performs the filter operation defined by this filter.java.util.regex.PatterngetPattern()Returns the pattern used by this filter for matching.intgetSize()Returns the number of records that remain in this filter's output ("view") after the input records have been filtered.protected voidinit()Provides filter-specific initialization.protected intmapTowardModel(int row)PRE: 0 <= row <getSize();protected voidreset()Resets the internal row mappings from this filter to the previous filter.voidsetPattern(java.lang.String regularExpr, int matchFlags)Convenience to set the pattern in terms of a regex and matchFlags, which are used to compile the pattern to apply.voidsetPattern(java.util.regex.Pattern pattern)Sets the pattern used by this filter for matching.booleantest(int row)Tests whether the given row (in this filter's coordinates) should be added.-
Methods inherited from class org.jdesktop.swingx.decorator.Filter
assign, convertRowIndexToModel, convertRowIndexToView, fireFilterChanged, getColumnIndex, getColumnName, getInputSize, getInputString, getInputValue, getMappingFilter, getPipeline, getStringAt, getValueAt, isCellEditable, mapTowardView, refresh, refresh, setColumnIndex, setValueAt
-
-
-
-
Constructor Detail
-
PatternFilter
public PatternFilter()
Instantiates a includeAll PatternFilter with matchFlag 0 on column 0.
-
PatternFilter
public PatternFilter(java.lang.String regularExpr, int matchFlags, int col)Instantiates a PatternFilter with a Pattern compiled from the given regex and matchFlags on the column in model coordinates.- Parameters:
regularExpr- the regex to compile, a null or empty String is interpreted as ".*"matchFlags- the matchflags to use in the compilecol- the column to filter in model coordinates.
-
-
Method Detail
-
setPattern
public void setPattern(java.lang.String regularExpr, int matchFlags)Convenience to set the pattern in terms of a regex and matchFlags, which are used to compile the pattern to apply.- Parameters:
regularExpr- the regex to compile, a null or empty String is interpreted as ".*"matchFlags- the matchflags to use in the compile- See Also:
for details
-
setPattern
public void setPattern(java.util.regex.Pattern pattern)
Sets the pattern used by this filter for matching.- Specified by:
setPatternin interfacePatternMatcher- Parameters:
pattern- the pattern used by this filter for matching- See Also:
Pattern
-
getPattern
public java.util.regex.Pattern getPattern()
Returns the pattern used by this filter for matching.- Specified by:
getPatternin interfacePatternMatcher- Returns:
- the pattern used by this filter for matching
- See Also:
Pattern
-
reset
protected void reset()
Resets the internal row mappings from this filter to the previous filter.
-
filter
protected void filter()
Performs the filter operation defined by this filter.
-
test
public boolean test(int row)
Tests whether the given row (in this filter's coordinates) should be added.PENDING JW: why is this public? called from a protected method?
- Parameters:
row- the row to test- Returns:
- true if the row should be added, false if not.
-
getSize
public int getSize()
Returns the number of records that remain in this filter's output ("view") after the input records have been filtered.
-
mapTowardModel
protected int mapTowardModel(int row)
PRE: 0 <= row <getSize();- Specified by:
mapTowardModelin classFilter- Returns:
- TODO:
-
-