|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jdesktop.swingx.decorator.Filter
public abstract class Filter
A Filter
is used to filter the data presented in 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.
FilterPipeline
,
JXTable
Field Summary | |
---|---|
protected ComponentAdapter |
adapter
|
protected int[] |
fromPrevious
TODO: make private |
protected FilterPipeline |
pipeline
|
Constructor Summary | |
---|---|
Filter()
Constructs a new filter for the first column of a data model. |
|
Filter(int column)
Constructs a new filter for the specified column of a data model in absolute model coordinates. |
Method Summary | |
---|---|
protected void |
assign(ComponentAdapter adapter)
Binds this filter to the specified ComponentAdapter . |
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 abstract void |
filter()
Performs the filter operation defined by this filter. |
protected void |
fireFilterChanged()
Notifies interested parties that this filter has changed. |
int |
getColumnIndex()
Returns the model index of the column that this filter has been bound to. |
String |
getColumnName()
|
protected int |
getInputSize()
Returns the number of records of this filter's input ("model"). |
protected String |
getInputString(int row,
int column)
Returns the string representation of cell at the specified row and column. |
protected Object |
getInputValue(int row,
int column)
Returns the value of the cell at the specified row and column. |
protected Filter |
getMappingFilter()
Returns the filter to use for accessing input. |
protected FilterPipeline |
getPipeline()
|
abstract int |
getSize()
Returns the number of records that remain in this filter's output ("view") after the input records have been filtered. |
String |
getStringAt(int row,
int column)
Returns the string representation at the specified row and column. |
Object |
getValueAt(int row,
int column)
Returns the value at the specified row and column. |
protected abstract void |
init()
Provides filter-specific initialization. |
boolean |
isCellEditable(int row,
int column)
Returns editability of the cell identified by the specified row and column index. |
protected abstract int |
mapTowardModel(int row)
PRE: 0 <= row < getSize(); |
protected int |
mapTowardView(int row)
PRE: 0 <= row < getInputSize(); |
void |
refresh()
Refreshes the internal state of the filter, performs the filter
operation and regenerates row mappings from the previous filter. |
protected void |
refresh(boolean reset)
Refreshes the internal state of the filter, optionally resetting the cache of existing row mappings from this filter to the previous filter. |
protected abstract void |
reset()
Resets the internal row mappings from this filter to the previous filter. |
void |
setColumnIndex(int modelColumn)
TODO: PENDING: not tested! |
void |
setValueAt(Object aValue,
int row,
int column)
Sets the specified value as the new value for the cell identified by the specified row and column index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FilterPipeline pipeline
protected ComponentAdapter adapter
protected int[] fromPrevious
Constructor Detail |
---|
public Filter()
public Filter(int column)
column
- column index in absolute model coordinatesMethod Detail |
---|
public void refresh()
filter
operation and regenerates row mappings from the previous filter. If this
filter is bound to a filter pipeline (as most filters are), it also triggers a
filterChanged
notification.
public int getColumnIndex()
public void setColumnIndex(int modelColumn)
modelColumn
- column index in absolute model coordinatespublic String getColumnName()
public int convertRowIndexToModel(int row)
row
- the row index in this filter's output ("view") coordinates
public int convertRowIndexToView(int row)
row
- row index in model coordinates
public Object getValueAt(int row, int column)
row
- the row index in this filter's output ("view") coordinatescolumn
- column index in absolute model coordinates
public String getStringAt(int row, int column)
row
- the row index in this filter's output ("view") coordinatescolumn
- column index in model coordinates
public void setValueAt(Object aValue, int row, int column)
aValue
- new value for the specified cellrow
- the row index in this filter's output ("view") coordinatescolumn
- the column index in absolute model coordinatespublic boolean isCellEditable(int row, int column)
getSize()
row
- the row index in this filter's output ("view") coordinatescolumn
- column index in model coordinates
public abstract int getSize()
protected int getInputSize()
protected Object getInputValue(int row, int column)
row
- in the coordinates of what is the filter's input ("model").column
- in model coordinates
protected String getInputString(int row, int column)
row
- in the coordinates of what is the filter's "model" (== input) coordinatescolumn
- in model coordinates
protected abstract void init()
Filter
constructor.
protected abstract void reset()
protected abstract void filter()
protected abstract int mapTowardModel(int row)
getSize();
row
-
protected int mapTowardView(int row)
getInputSize();
row
-
protected Filter getMappingFilter()
protected void refresh(boolean reset)
filter
operation and regenerates
row mappings from the previous filter. If this filter is bound to a filter
pipeline (as most filters are), it also triggers a
filterChanged
notification.
reset
- true if existing row mappings from this filter to the previous
filter should be reset; false, if the existing row mappings should be preserved.protected void fireFilterChanged()
protected void assign(ComponentAdapter adapter)
ComponentAdapter
.
Called by FilterPipeline.assign(ComponentAdapter)
adapter
- adapter that this filter is bound toprotected FilterPipeline getPipeline()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |