Class RangeMatcherEditor<D extends java.lang.Comparable,E>
- java.lang.Object
-
- ca.odell.glazedlists.matchers.AbstractMatcherEditorListenerSupport<E>
-
- ca.odell.glazedlists.matchers.AbstractMatcherEditor<E>
-
- ca.odell.glazedlists.matchers.RangeMatcherEditor<D,E>
-
- All Implemented Interfaces:
MatcherEditor<E>
public class RangeMatcherEditor<D extends java.lang.Comparable,E> extends AbstractMatcherEditor<E>
A MatcherEditor that produces Matchers which match Objects if they lie within a range ofComparable
s. ThisRangeMatcherEditor
is not coupled with any UI component that allows the user to edit the range. That job is left to subclasses. This MatcherEditor is fully concrete, and may be used directly by headless applications.The
RangeMatcherEditor
requires that either aFilterator
appropriate for extractingComparable
objects be specified in its constructor, or that every Object to be matched is aComparable
.- Author:
- James Lemieux
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ca.odell.glazedlists.matchers.MatcherEditor
MatcherEditor.Event<E>, MatcherEditor.Listener<E>
-
-
Constructor Summary
Constructors Constructor Description RangeMatcherEditor()
Creates aRangeMatcherEditor
whose Matchers can test only elements which areComparable
objects.RangeMatcherEditor(Filterator<D,E> filterator)
Creates aRangeMatcherEditor
that matches Objects using the specifiedFilterator
to get theComparable
s to search.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Filterator<D,E>
getFilterator()
Get the filterator used to extract Comparables from the matched elements.void
setRange(D newStart, D newEnd)
This method is used to change the range currently matched by this MatcherEditor.-
Methods inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditor
fireChanged, fireConstrained, fireMatchAll, fireMatchNone, fireRelaxed, getMatcher, isCurrentlyMatchingAll, isCurrentlyMatchingNone
-
Methods inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditorListenerSupport
addMatcherEditorListener, createChangedEvent, createConstrainedEvent, createMatchAllEvent, createMatchNoneEvent, createRelaxedEvent, fireChangedMatcher, removeMatcherEditorListener
-
-
-
-
Constructor Detail
-
RangeMatcherEditor
public RangeMatcherEditor()
Creates aRangeMatcherEditor
whose Matchers can test only elements which areComparable
objects.The
Matcher
s from thisMatcherEditor
will throw aClassCastException
whenMatcher.matches(E)
is called with an Object that is not aComparable
.
-
RangeMatcherEditor
public RangeMatcherEditor(Filterator<D,E> filterator)
Creates aRangeMatcherEditor
that matches Objects using the specifiedFilterator
to get theComparable
s to search.- Parameters:
filterator
- the object that will extract filter Comparables from each object in thesource
;null
indicates the list elements are Comparables
-
-
Method Detail
-
getFilterator
public Filterator<D,E> getFilterator()
Get the filterator used to extract Comparables from the matched elements.
-
setRange
public void setRange(D newStart, D newEnd)
This method is used to change the range currently matched by this MatcherEditor. When a change to the range is detected, users of this class are expected to call this method with the new bounds of the range to be matched.null
values for eithernewStart
ornewEnd
indicate there is no start of end to the range respectively. Consequently, callingsetRange(null, null)
causes this matcher editor match all values it filters.Note: if
newStart
andnewEnd
are out of their natural order with respect to each other, their values are swapped. For example,setRange(Jan 1, 2006, Jan 1, 1955)
would swap the values sonewStart
isJan 1, 1955
andnewEnd
isJan 1, 2006
.- Parameters:
newStart
- the new value marking the start of the range;null
indicates there is no startnewEnd
- the new value marking the start of the range;null
indicates there is no start
-
-