filters
Class TableParamsFilter

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bytableoperations.TableMap
          extended bytableoperations.TableFilter
              extended byfilters.TableParamsFilter
All Implemented Interfaces:
EventListener, Serializable, TableModel, TableModelListener

public class TableParamsFilter
extends TableFilter

A Filter for TableModels, given an array of parameters FilterParam. This Filter listens to its parameters so as to be up to date at every time it is needed. However calling reallocateIndexes may be used to refresh the contents of the table. fireTableDataChanged alerts all the listeners that the table has changed. Usually a call to reallocateIndexes should be followed by a call to fireTableDataChanged.

Author:
Etienne Fort
See Also:
FilterParam, Serialized Form

Field Summary
private  Double[] maxValues
           
private  Double[] minValues
           
private  FilterParam[] params
           
 
Fields inherited from class tableoperations.TableFilter
 
Fields inherited from class tableoperations.TableMap
model
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableParamsFilter(TableModel model, FilterParam[] params)
          Creates a new TableParamsFilter given the original table and a set of params.
 
Method Summary
 boolean filterFunction(int row)
          Filters Double values, given a FilterParam.
 void reallocateIndexes()
          Besides computing the mapping Arraylist, computes first the max and min values in the filtered column.
 void setParams(FilterParam[] params)
          Defines the params for the filtering operation.
 
Methods inherited from class tableoperations.TableFilter
checkModel, getRowCount, getValueAt, isCellEditable, setModel, setValueAt, tableChanged
 
Methods inherited from class tableoperations.TableMap
getColumnClass, getColumnCount, getColumnName, getModel, writeToFileAsCsv
 
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
 

Field Detail

maxValues

private Double[] maxValues

minValues

private Double[] minValues

params

private FilterParam[] params
Constructor Detail

TableParamsFilter

public TableParamsFilter(TableModel model,
                         FilterParam[] params)
Creates a new TableParamsFilter given the original table and a set of params. The table registers itself as a listener to the params.

Parameters:
model - the original table
params - the set of params taken into account
Method Detail

filterFunction

public boolean filterFunction(int row)
Filters Double values, given a FilterParam. Doubles are filtered relatively to the original table max values and min values in the fixed column.

Specified by:
filterFunction in class TableFilter
Parameters:
row - index of the row to check.
Returns:
false if the line must be ignored, true otherwise
See Also:
TableFilter.filterFunction(int)

reallocateIndexes

public void reallocateIndexes()
Besides computing the mapping Arraylist, computes first the max and min values in the filtered column.

Overrides:
reallocateIndexes in class TableFilter
See Also:
TableFilter.reallocateIndexes()

setParams

public void setParams(FilterParam[] params)
Defines the params for the filtering operation.

Parameters:
params - The params to set.