com.anthonyeden.lib.util
Class TableFilter

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bycom.anthonyeden.lib.util.TableMap
          extended bycom.anthonyeden.lib.util.TableFilter
All Implemented Interfaces:
java.util.EventListener, java.io.Serializable, javax.swing.table.TableModel, javax.swing.event.TableModelListener
Direct Known Subclasses:
TableMatchFilter

public abstract class TableFilter
extends TableMap

A filter for TableModels. The filter has a model (conforming to TableModel) and itself implements TableModel.

Author:
Anthony Eden
See Also:
Serialized Form

Field Summary
protected  int column
           
protected  int[] indexes
           
protected  java.util.ArrayList tempIndexes
           
protected  java.lang.Object[] values
           
 
Fields inherited from class com.anthonyeden.lib.util.TableMap
model
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableFilter()
          Construct a new TableFilter with no backing model.
TableFilter(javax.swing.table.TableModel model)
          Construct a new TableFilter with the given backing model.
 
Method Summary
abstract  void filter()
          Filter the model.
 void filter(int column, java.lang.Object value)
          Filter the given column using the specified value.
 void filter(int column, java.lang.Object[] values)
          Filter the given column using the values in the given array.
 int getColumn()
          Get the current filtered column.
 int getRowCount()
          Get the number of rows in the table.
 java.lang.Object getValueAt(int row, int column)
          Get the value at the given row and column.
 java.lang.Object[] getValues()
          Get the current filter value array.
 void setTableModel(javax.swing.table.TableModel model)
          Set the table model to filter.
 void setValueAt(java.lang.Object newValue, int row, int column)
          Set the value at the given row and column.
 void tableChanged(javax.swing.event.TableModelEvent evt)
          Signal that the table has changed in some way.
 
Methods inherited from class com.anthonyeden.lib.util.TableMap
getColumnClass, getColumnCount, getColumnName, getModel, isCellEditable, setModel
 
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

indexes

protected int[] indexes

column

protected int column

values

protected java.lang.Object[] values

tempIndexes

protected java.util.ArrayList tempIndexes
Constructor Detail

TableFilter

public TableFilter()
Construct a new TableFilter with no backing model.


TableFilter

public TableFilter(javax.swing.table.TableModel model)
Construct a new TableFilter with the given backing model.

Parameters:
model - The TableModel
Method Detail

setTableModel

public void setTableModel(javax.swing.table.TableModel model)
Set the table model to filter.

Parameters:
model - The model to filter

filter

public abstract void filter()
Filter the model. Subclasses should implement this method to provide the filter logic.


tableChanged

public void tableChanged(javax.swing.event.TableModelEvent evt)
Signal that the table has changed in some way.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener
Overrides:
tableChanged in class TableMap
Parameters:
evt - The TableModelEvent

getRowCount

public int getRowCount()
Get the number of rows in the table.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Overrides:
getRowCount in class TableMap
Returns:
The row count

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Get the value at the given row and column.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Overrides:
getValueAt in class TableMap
Parameters:
row - The row
column - The column
Returns:
The value

setValueAt

public void setValueAt(java.lang.Object newValue,
                       int row,
                       int column)
Set the value at the given row and column.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class TableMap
Parameters:
newValue - The new value
row - The row
column - The column

filter

public void filter(int column,
                   java.lang.Object value)
Filter the given column using the specified value.

Parameters:
column - The column
value - The value

filter

public void filter(int column,
                   java.lang.Object[] values)
Filter the given column using the values in the given array.

Parameters:
column - The column
values - An array of value objects

getColumn

public int getColumn()
Get the current filtered column.

Returns:
The column

getValues

public java.lang.Object[] getValues()
Get the current filter value array.

Returns:
An array of filter values


Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.