|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jdesktop.swingx.decorator.FilterPipeline
public class FilterPipeline
A FilterPipeline
is used to define the set of
filters
for a data-aware component such as a JXList
or a
JXTable
. Filtering involves interposing one or
more filters in a FilterPipeline
between
a data model and a view to change the apparent order and/or number of records
in the data model. The order of filters in the filter pipeline determines the
order in which each filter is applied. The output from one filter in the
pipeline is piped as the input to the next filter in the pipeline.
This is all you need to do in order to useFilter
[] filters = newFilter
[] { newPatternFilter
("S.*", 0, 1), // regex, matchflags, column newShuttleSorter
(1, false), // column 1, descending newShuttleSorter
(0, true), // column 0, ascending };FilterPipeline
pipeline = newFilterPipeline
(filters);JXTable
table = newJXTable
(model); table.setFilters(pipeline);
FilterPipeline
. Most
of the methods in this class are only for advanced developers who want to write
their own filter subclasses and want to override the way a filter pipeline works.
Filter
Nested Class Summary | |
---|---|
static class |
FilterPipeline.IdentityFilter
|
protected class |
FilterPipeline.SorterBasedSortController
|
Field Summary | |
---|---|
protected EventListenerList |
listenerList
|
Constructor Summary | |
---|---|
FilterPipeline()
Creates an empty open pipeline. |
|
FilterPipeline(Filter... inList)
Constructs a new FilterPipeline populated with the specified
filters that are applied in the order they appear in the list. |
Method Summary | |
---|---|
void |
addPipelineListener(PipelineListener l)
Adds a listener to the list that's notified each time there is a change to this pipeline. |
void |
assign(ComponentAdapter adapter)
Assigns a ComponentAdapter to this
pipeline if no adapter has previously been assigned to the pipeline. |
int |
convertRowIndexToModel(int row)
Convert row index from view coordinates to model coordinates accounting for the presence of sorters and filters. |
int |
convertRowIndexToView(int row)
Convert row index from model coordinates to view coordinates accounting for the presence of sorters and filters. |
protected SortController |
createDefaultSortController()
|
protected void |
filterChanged(Filter filter)
Called when the specified filter has changed. |
protected void |
fireContentsChanged()
Notifies all registered PipelineListener
objects that the contents of this pipeline has changed. |
protected void |
fireSortOrderChanged()
Notifies all registered PipelineListener
objects that the contents of this pipeline has changed. |
void |
flush()
Flushes the pipeline by initiating a refresh
on the first filter ,
if any, in this pipeline. |
int |
getInputSize()
returns the unfiltered data adapter size or 0 if unassigned. |
int |
getOutputSize()
Returns the number of records in the filtered view. |
PipelineListener[] |
getPipelineListeners()
Returns an array of all the pipeline listeners registered on this FilterPipeline . |
SortController |
getSortController()
|
protected Sorter |
getSorter()
Returns the sorter that the output of the filter pipeline is piped through. |
Object |
getValueAt(int row,
int column)
Returns the value of the cell at the specified coordinates. |
boolean |
isAssigned()
|
boolean |
isCellEditable(int row,
int column)
|
void |
removePipelineListener(PipelineListener l)
Removes a listener from the list that's notified each time there is a change to this pipeline. |
protected void |
setSorter(Sorter sorter)
Sets the sorter that the output of the filter pipeline is piped through. |
void |
setValueAt(Object aValue,
int row,
int column)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected EventListenerList listenerList
Constructor Detail |
---|
public FilterPipeline()
public FilterPipeline(Filter... inList)
FilterPipeline
populated with the specified
filters that are applied in the order they appear in the list. Since filters
maintain state about the view to which they are attached, an instance of
a filter may not ever be used in more than one pipeline.
inList
- array of filtersMethod Detail |
---|
protected void setSorter(Sorter sorter)
sorter
- the interactive sorter, if any; null otherwise.protected Sorter getSorter()
public SortController getSortController()
protected SortController createDefaultSortController()
public final void assign(ComponentAdapter adapter)
ComponentAdapter
to this
pipeline if no adapter has previously been assigned to the pipeline. Once an
adapter has been assigned to this pipeline, any attempt to change that will
cause an exception to be thrown.
adapter
- the ComponentAdapter
to assign
IllegalArgumentException
- if adapter is null
IllegalStateException
- if an adapter is already assigned to this
pipeline and the new adapter is not the same the existing adapterpublic boolean isAssigned()
protected void filterChanged(Filter filter)
filterChanged
notifications to the next
filter in the pipeline after the specified filter. If the specified filter
is the last filter in the pipeline, this method broadcasts a
filterChanged
notification to all
PipelineListener
objects registered with this pipeline.
filter
- a filter in this pipeline that has changed in any waypublic int getInputSize()
public int getOutputSize()
public int convertRowIndexToModel(int row)
convertRowIndexToModel
method of the last Filter
,
if any, in this pipeline.
row
- row index in view coordinates
public int convertRowIndexToView(int row)
convertRowIndexToModel
method of the last Filter
,
if any, in this pipeline.
row
- row index in model coordinates
public Object getValueAt(int row, int column)
row
- in view coordinatescolumn
- in model coordinates
public void setValueAt(Object aValue, int row, int column)
public boolean isCellEditable(int row, int column)
public void flush()
refresh
on the first filter
,
if any, in this pipeline. After that filter has refreshed itself, it sends a
filterChanged
notification to this pipeline, and the pipeline responds by initiating a
refresh
on the next filter
,
if any, in this pipeline. Eventualy, when there are no more filters left
in the pipeline, it broadcasts a PipelineEvent
signaling a PipelineEvent.CONTENTS_CHANGED
message to all PipelineListener
objects
registered with this pipeline.
public void addPipelineListener(PipelineListener l)
l
- the PipelineListener
to be addedpublic void removePipelineListener(PipelineListener l)
l
- the PipelineListener
to be removedpublic PipelineListener[] getPipelineListeners()
FilterPipeline
.
PipelineListener
s,
or an empty array if no pipeline listeners
are currently registeredaddPipelineListener(org.jdesktop.swingx.decorator.PipelineListener)
,
removePipelineListener(org.jdesktop.swingx.decorator.PipelineListener)
protected void fireContentsChanged()
PipelineListener
objects that the contents of this pipeline has changed. The event instance
is lazily created.
protected void fireSortOrderChanged()
PipelineListener
objects that the contents of this pipeline has changed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |