org.vizzini.ui.table
Class FilteredTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.vizzini.ui.table.DescribedTableModel
          extended by org.vizzini.ui.table.FilteredTableModel
All Implemented Interfaces:
Serializable, TableModel

public class FilteredTableModel
extends DescribedTableModel

Provides a table model which works with IFilter s to limit the data in the table.

Since:
v0.2
Version:
v0.2
Author:
Jeffrey M. Thompson
See Also:
IFilter, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
FilteredTableModel(TableDescriptor tableDescriptor)
          Construct this object with the given parameter.
 
Method Summary
 void addData(Object data)
          Add the given data object.
 IFilter getFilter()
           
 List getFilteredData()
          Return the collection of filtered data.
 int getRowCount()
          Return the number of rows.
 Object getValueAt(int rowIndex)
          Return the data object in the given row.
 Object getValueAt(int rowIndex, int columnIndex)
          Return the object in the given cell.
protected  boolean passesFilter(Object item)
          Return true if the given item passes the filter, or if there is no filter.
 void removeAll()
          Remove all the data.
 void removeRows(int[] rows)
          Remove the given rows.
 void setData(List data)
          Set the model data.
 void setData(Object[] data)
          Set the model data.
 void setFilter(IFilter filter)
           
 void setValueAt(Object obj, int rowIndex, int columnIndex)
          Set the value of the given cell.
 
Methods inherited from class org.vizzini.ui.table.DescribedTableModel
getColumnClass, getColumnCount, getColumnName, getData, getTableDescriptor, indexOf, isCellEditable, isEditMode, setEditMode
 
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
 

Constructor Detail

FilteredTableModel

public FilteredTableModel(TableDescriptor tableDescriptor)
Construct this object with the given parameter.

Parameters:
tableDescriptor - The table descriptor.
Since:
v0.2
Method Detail

addData

public void addData(Object data)
Add the given data object. Extends the super method to add to the filtered data.

Overrides:
addData in class DescribedTableModel
Parameters:
data - The new data to add.
Since:
v0.2

getFilter

public IFilter getFilter()
Returns:
Return filter.
Since:
v0.2

getFilteredData

public List getFilteredData()
Return the collection of filtered data.

Since:
v0.2

getRowCount

public int getRowCount()
Return the number of rows.

Specified by:
getRowCount in interface TableModel
Overrides:
getRowCount in class DescribedTableModel
Since:
v0.2

getValueAt

public Object getValueAt(int rowIndex)
Return the data object in the given row.

Overrides:
getValueAt in class DescribedTableModel
Parameters:
rowIndex - The index of the row of interest.
Since:
v0.2

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Return the object in the given cell.

Specified by:
getValueAt in interface TableModel
Overrides:
getValueAt in class DescribedTableModel
Parameters:
rowIndex - The index of the row of interest.
columnIndex - The index of the column of interest.
Since:
v0.2

removeAll

public void removeAll()
Remove all the data.

Overrides:
removeAll in class DescribedTableModel
Since:
v0.2

removeRows

public void removeRows(int[] rows)
Remove the given rows.

Overrides:
removeRows in class DescribedTableModel
Parameters:
rows - The indices of the rows to remove.
Since:
v0.2

setData

public void setData(List data)
Set the model data.

Overrides:
setData in class DescribedTableModel
Parameters:
data - The new model data.
Since:
v0.2

setData

public void setData(Object[] data)
Set the model data.

Overrides:
setData in class DescribedTableModel
Parameters:
data - The new model data.
Since:
v0.2

setFilter

public void setFilter(IFilter filter)
Parameters:
filter - The filter to set.
Since:
v0.2

setValueAt

public void setValueAt(Object obj,
                       int rowIndex,
                       int columnIndex)
Set the value of the given cell.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class DescribedTableModel
Parameters:
obj - The new value.
rowIndex - The index of the row of interest.
columnIndex - The index of the column of interest.
Since:
v0.2

passesFilter

protected boolean passesFilter(Object item)
Return true if the given item passes the filter, or if there is no filter.

Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02