net.coderazzi.filters.artifacts
Class TableModelFilter

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by net.coderazzi.filters.artifacts.TableModelFilter
All Implemented Interfaces:
Serializable, TableModel, ITableModelFilter

public class TableModelFilter
extends AbstractTableModel
implements ITableModelFilter

Implementation of a ITableModelFilter

It tries to mimic the behaviour in the Java 6 model. In special, updates to the model do not imply reapplying the filter in the modified rows.

Author:
Luis M Pena - lu@coderazzi.net
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableModelFilter(TableModel model)
          Constructor.
 
Method Summary
 int convertRowIndexToModel(int index)
          Returns the location of index in terms of the underlying model.
 int convertRowIndexToView(int index)
          Returns the location of index in terms of the view.
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
 TableModel getModel()
          Returns the underlying model.
 int getRowCount()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void setModel(TableModel tableModel)
          Updates the model used beneath the TableModelFilter.
 void setRowFilter(RowFilter newValue)
          Sets the filter that determines which rows, if any, should be hidden from the view.
 void setValueAt(Object value, int rowIndex, int columnIndex)
           
 
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

TableModelFilter

public TableModelFilter(TableModel model)
Constructor.

Method Detail

setModel

public void setModel(TableModel tableModel)
Updates the model used beneath the TableModelFilter.


getModel

public TableModel getModel()
Description copied from interface: ITableModelFilter
Returns the underlying model.

Specified by:
getModel in interface ITableModelFilter
See Also:
ITableModelFilter.getModel()

setRowFilter

public void setRowFilter(RowFilter newValue)
Description copied from interface: ITableModelFilter
Sets the filter that determines which rows, if any, should be hidden from the view.

Specified by:
setRowFilter in interface ITableModelFilter
See Also:
ITableModelFilter.setRowFilter(RowFilter)

convertRowIndexToModel

public int convertRowIndexToModel(int index)
Returns the location of index in terms of the underlying model.


convertRowIndexToView

public int convertRowIndexToView(int index)
Returns the location of index in terms of the view.


getColumnClass

public Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

setValueAt

public void setValueAt(Object value,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel