|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
javax.swing
|
Nested Class Summary | |
---|---|
static class |
RowFilter.ComparisonType
Enumeration of the possible comparison values supported by some of the default RowFilter s. |
static class |
RowFilter.Entry<M,I>
An Entry object is passed to instances of
RowFilter , allowing the filter to get the value of the
entry's data, and thus to determine whether the entry should be shown. |
Constructor Summary | |
---|---|
RowFilter()
|
Method Summary | ||
---|---|---|
static
|
andFilter(Iterable<? extends RowFilter<? super M,? super I>> filters)
Returns a RowFilter that includes entries if all
of the supplied filters include the entry. |
|
static
|
dateFilter(RowFilter.ComparisonType type,
Date date,
int... indices)
Returns a RowFilter that includes entries that
have at least one Date value meeting the specified
criteria. |
|
abstract boolean |
include(RowFilter.Entry<? extends M,? extends I> entry)
Returns true if the specified entry should be shown; returns false if the entry should be hidden. |
|
static
|
notFilter(RowFilter<M,I> filter)
Returns a RowFilter that includes entries if the
supplied filter does not include the entry. |
|
static
|
numberFilter(RowFilter.ComparisonType type,
Number number,
int... indices)
Returns a RowFilter that includes entries that
have at least one Number value meeting the
specified criteria. |
|
static
|
orFilter(Iterable<? extends RowFilter<? super M,? super I>> filters)
Returns a RowFilter that includes entries if any
of the supplied filters includes the entry. |
|
static
|
regexFilter(String regex,
int... indices)
Returns a RowFilter that uses a regular
expression to determine which entries to include. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RowFilter()
Method Detail |
---|
public static <M,I> RowFilter<M,I> regexFilter(String regex, int... indices)
RowFilter
that uses a regular
expression to determine which entries to include. Only entries
with at least one matching value are included. For
example, the following creates a RowFilter
that
includes entries with at least one value starting with
"a":
RowFilter.regexFilter("^a");
The returned filter uses Matcher.find()
to test for inclusion. To test for exact matches use the
characters '^' and '$' to match the beginning and end of the
string respectively. For example, "^foo$" includes only rows whose
string is exactly "foo" and not, for example, "food". See
Pattern
for a complete description of
the supported regular-expression constructs.
regex
- the regular expression to filter onindices
- the indices of the values to check. If not supplied all
values are evaluated
RowFilter
implementing the specified criteria
NullPointerException
- if regex
is
null
IllegalArgumentException
- if any of the indices
are < 0
PatternSyntaxException
- if regex
is
not a valid regular expression.Pattern
public static <M,I> RowFilter<M,I> dateFilter(RowFilter.ComparisonType type, Date date, int... indices)
RowFilter
that includes entries that
have at least one Date
value meeting the specified
criteria. For example, the following RowFilter
includes
only entries with at least one date value after the current date:
RowFilter.dateFilter(ComparisonType.AFTER, new Date());
type
- the type of comparison to performdate
- the date to compare againstindices
- the indices of the values to check. If not supplied all
values are evaluated
RowFilter
implementing the specified criteria
NullPointerException
- if date
is
null
IllegalArgumentException
- if any of the indices
are < 0 or type
is
null
Calendar
,
Date
public static <M,I> RowFilter<M,I> numberFilter(RowFilter.ComparisonType type, Number number, int... indices)
RowFilter
that includes entries that
have at least one Number
value meeting the
specified criteria. For example, the following
filter will only include entries with at
least one number value equal to 10:
RowFilter.numberFilter(ComparisonType.EQUAL, 10);
type
- the type of comparison to performindices
- the indices of the values to check. If not supplied all
values are evaluated
RowFilter
implementing the specified criteria
IllegalArgumentException
- if any of the indices
are < 0, type
is null
or number
is null
public static <M,I> RowFilter<M,I> orFilter(Iterable<? extends RowFilter<? super M,? super I>> filters)
RowFilter
that includes entries if any
of the supplied filters includes the entry.
The following example creates a RowFilter
that will
include any entries containing the string "foo" or the string
"bar":
List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2); filters.add(RowFilter.regexFilter("foo")); filters.add(RowFilter.regexFilter("bar")); RowFilter<Object,Object> fooBarFilter = RowFilter.orFilter(filters);
filters
- the RowFilter
s to test
RowFilter
implementing the specified criteria
IllegalArgumentException
- if any of the filters
are null
NullPointerException
- if filters
is nullArrays.asList(T...)
public static <M,I> RowFilter<M,I> andFilter(Iterable<? extends RowFilter<? super M,? super I>> filters)
RowFilter
that includes entries if all
of the supplied filters include the entry.
The following example creates a RowFilter
that will
include any entries containing the string "foo" and the string
"bar":
List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2); filters.add(RowFilter.regexFilter("foo")); filters.add(RowFilter.regexFilter("bar")); RowFilter<Object,Object> fooBarFilter = RowFilter.andFilter(filters);
filters
- the RowFilter
s to test
RowFilter
implementing the specified criteria
IllegalArgumentException
- if any of the filters
are null
NullPointerException
- if filters
is nullArrays.asList(T...)
public static <M,I> RowFilter<M,I> notFilter(RowFilter<M,I> filter)
RowFilter
that includes entries if the
supplied filter does not include the entry.
filter
- the RowFilter
to negate
RowFilter
implementing the specified criteria
IllegalArgumentException
- if filter
is
null
public abstract boolean include(RowFilter.Entry<? extends M,? extends I> entry)
The entry
argument is valid only for the duration of
the invocation. Using entry
after the call returns
results in undefined behavior.
entry
- a non-null
object that wraps the underlying
object from the model