|
Copyright © 2011 Citra Technologies. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
com.citra.table.ListTableMap
com.citra.table.FilterTableModel
public class FilterTableModel
FilterTableModel offers filtering capabilities to a table. This class needs a ListTableModel that holds the data of the table. FilterTableModel processes filtering requests and updates the data sent to the table accordingly.
Field Summary | |
---|---|
protected boolean |
allowFilter
a boolean flag that determines whether the model will perform the filtering if the underlying model changes (via updates, deletes or additions). |
protected boolean |
clearOnDataChanged
a boolean flag that determines whether the model will assume that all data have changed when a fireTableDataChanged TableModelEvent has been issued. |
protected TableFilter |
tableFilter
the currently installed table filter |
Fields inherited from class com.citra.table.ListTableMap |
---|
tableModel |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
FilterTableModel(ListTableModel tableModel)
Constructs a FilterTableModel having tableModel as the underlying
ListTableModel holding the tabular data. |
Method Summary | |
---|---|
void |
applyFilter(FilterModelEvent e)
Called whenever filtering of data has been requested. |
int |
convertRowIndexToModel(int viewRowIndex)
Determines the index of the row in the underlying model in terms of the row index in this map. |
int |
convertRowIndexToView(int modelRowIndex)
Determines the index of the row in this map in terms of the row index in the underlying model. |
protected int[] |
filterData()
Filters the data of the table. |
boolean |
getAllowFilter()
Determines whether the model will perform the filtering if the underlying model changes (via updates, deletes or additions). |
boolean |
getClearOnDataChanged()
Determines whether the model will assume that all data have changed when a fireTableDataChanged TableModelEvent has been issued. |
int[] |
getFilteredIndexes()
Returns an int array showing the relation between the original and the filtered data. |
int |
getRowCount()
Returns tableModel.getRowCount |
List |
getRows()
Returns tableModel.getRows |
TableFilter |
getTableFilter()
Returns the current TableFilter of this FilterTableModel. |
TableModel |
getUnfilteredTableModel()
Returns a tableModel that holds the unfiltered data. |
Object |
getValueAt(int row,
int column)
Returns tableModel.getValueAt |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns tableModel.isCellEditable |
void |
reIndex()
Reindexes the filter indexes. |
void |
removeRow(int row)
Removes a row from the data model |
void |
removeRows(int[] deletedRows)
Removes a few rows from the data model |
void |
rowsReordered(ReorderEvent e)
Called whenever the rows of a JTable have been restructured. |
void |
setAllowFilter(boolean allowFilter)
Determines whether the model will perform the filtering if the underlying model changes (via updates, deletes or additions). |
void |
setClearOnDataChanged(boolean clearOnDataChanged)
Determines whether the model will assume that all data have changed when a fireTableDataChanged TableModelEvent has been issued. |
void |
setFilteredIndexes(int[] indexes)
Assigns the filter indexes. |
void |
setModel(ListTableModel newModel)
Sets the underlying ListTableModel to newModel. |
void |
setTableFilter(TableFilter tableFilter)
Assigns a new table filter. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Returns tableModel.setValueAt |
void |
tableChanged(TableModelEvent e)
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed. |
Methods inherited from class com.citra.table.ListTableMap |
---|
addReorderListener, addRow, addRows, clear, fireRowsMapped, fireRowsReordered, getCellValue, getColumnClass, getColumnCount, getColumnName, getInnerModel, getModel, removeReorderListener |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, getColumnClass, getColumnCount, getColumnName, removeTableModelListener |
Methods inherited from interface com.citra.table.ListTableModel |
---|
fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged |
Field Detail |
---|
protected boolean clearOnDataChanged
protected boolean allowFilter
protected TableFilter tableFilter
Constructor Detail |
---|
public FilterTableModel(ListTableModel tableModel)
tableModel
as the underlying
ListTableModel holding the tabular data.
tableModel
- the underlying ListTableModelMethod Detail |
---|
public void applyFilter(FilterModelEvent e)
FilterModelListeners can get the TableFilter set by calling e.getTableFilter(). If the returned value is null, the FilterModelListener should remove the filter of the table.
applyFilter
in interface FilterModelListener
e
- the FilterModelEvent objectpublic int convertRowIndexToModel(int viewRowIndex)
convertRowIndexToModel
in class ListTableMap
viewRowIndex
- the index of the row in this map
public int convertRowIndexToView(int modelRowIndex)
convertRowIndexToView
in class ListTableMap
modelRowIndex
- the index of the row in the underlying model
protected int[] filterData()
ReorderEvent
.
public boolean getAllowFilter()
Note that this setting has no effect when a filter is applied to the model via the setTableFilter or applyFilter methods. The filtering will always be performed in this case.
public boolean getClearOnDataChanged()
public int[] getFilteredIndexes()
public int getRowCount()
getRowCount
in interface TableModel
getRowCount
in class ListTableMap
TableModel.getColumnCount()
public List getRows()
getRows
in interface ListTableModel
getRows
in class ListTableMap
public TableFilter getTableFilter()
public TableModel getUnfilteredTableModel()
getUnfilteredTableModel
in interface FilterListModel
public Object getValueAt(int row, int column)
getValueAt
in interface TableModel
getValueAt
in class ListTableMap
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface TableModel
isCellEditable
in class ListTableMap
rowIndex
- the row being queriedcolumnIndex
- the column being queried
TableModel.setValueAt(java.lang.Object, int, int)
public void reIndex()
public void removeRow(int row)
removeRow
in interface ListTableModel
removeRow
in class ListTableMap
row
- the index of the row being removedpublic void removeRows(int[] deletedRows)
removeRows
in interface ListTableModel
removeRows
in class ListTableMap
deletedRows
- an integer array that contains indexes of the rows being deletedpublic void rowsReordered(ReorderEvent e)
rowsReordered
in interface ReorderListener
rowsReordered
in class ListTableMap
e
- the ReorderEvent objectpublic void setAllowFilter(boolean allowFilter)
Note that this setting has no effect when a filter is applied to the model via the setTableFilter or applyFilter methods. The filtering will always be performed in this case.
allowFilter
- true if the model will perform filtering when the underlying data changes,
false otherwise.public void setClearOnDataChanged(boolean clearOnDataChanged)
clearOnDataChanged
- true if all data have changed on a data changed event, false otherwisepublic void setFilteredIndexes(int[] indexes)
indexes
- the indexes to assign.public void setModel(ListTableModel newModel)
setModel
in class ListTableMap
newModel
- the new ListTableModel to setpublic void setTableFilter(TableFilter tableFilter)
FilterTableModel.applyFilter(com.citra.event.FilterModelEvent)
.
tableFilter
- the TableFilter to assign.public void setValueAt(Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
setValueAt
in class ListTableMap
aValue
- value to assign to cellrowIndex
- row of cellcolumnIndex
- column of cellTableModel.getValueAt(int, int)
,
TableModel.isCellEditable(int, int)
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
tableChanged
in class ListTableMap
|
Copyright © 2011 Citra Technologies. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |