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 ofComparables. ThisRangeMatcherEditoris 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
RangeMatcherEditorrequires that either aFilteratorappropriate for extractingComparableobjects 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 aRangeMatcherEditorwhose Matchers can test only elements which areComparableobjects.RangeMatcherEditor(Filterator<D,E> filterator)Creates aRangeMatcherEditorthat matches Objects using the specifiedFilteratorto get theComparables 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.voidsetRange(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 aRangeMatcherEditorwhose Matchers can test only elements which areComparableobjects.The
Matchers from thisMatcherEditorwill throw aClassCastExceptionwhenMatcher.matches(E)is called with an Object that is not aComparable.
-
RangeMatcherEditor
public RangeMatcherEditor(Filterator<D,E> filterator)
Creates aRangeMatcherEditorthat matches Objects using the specifiedFilteratorto get theComparables to search.- Parameters:
filterator- the object that will extract filter Comparables from each object in thesource;nullindicates 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.nullvalues for eithernewStartornewEndindicate 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
newStartandnewEndare 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 sonewStartisJan 1, 1955andnewEndisJan 1, 2006.- Parameters:
newStart- the new value marking the start of the range;nullindicates there is no startnewEnd- the new value marking the start of the range;nullindicates there is no start
-
-