Holger's Java API

## com.antelmann.util.table
Class FilteredTableModel

    java.lang.Object
      javax.swing.table.AbstractTableModel
          com.antelmann.util.table.FilteredTableModel

All Implemented Interfaces:
  Wrapped<TableModel>, Serializable, EventListener, TableModelListener, TableModel

    public class FilteredTableModel

extends AbstractTableModel
implements TableModelListener, Wrapped<TableModel>

a wrapper around a TableModel allowing filtering

Since:
  6. Oktober 2006, 00:17
Author:
  Holger Antelmann
See Also:
  `SimpleTableRowFilter`, `TableModelView`, Serialized Form

Field Summary

Fields inherited from class javax.swing.table.AbstractTableModel
`listenerList`

Constructor Summary
`FilteredTableModel(TableModel model)`
`FilteredTableModel(TableModel model, Filter<? super TableRow> filter)`

Method Summary
`Class<?>` `getColumnClass(int column)`
`int` `getColumnCount()`
`String` `getColumnName(int column)`
`Filter<? super TableRow>` `getFilter()` filter may be null
`int` `getOriginalRow(int row)` returns the row that corresponds to the unfiltered embedded model
`int` `getRowCount()`
`int` `getRowPosition(int originalRow)` returns where to find the given original row in the filtered view; if the row is currently not visible, a negative number is returned.
`Object` `getValueAt(int row, int column)`
`boolean` `isCellEditable(int row, int column)`
`void` `setFilter(Filter<? super TableRow> filter)` this method must also be called whenever the filter itself changes its behaviour; the filter itself may be null
`void` `setValueAt(Object value, int row, int column)`
`void` `tableChanged(TableModelEvent ev)`
`TableModel` `unwrap()` returns the embedded instance that this wrapper encloses

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(TableModel model)

### FilteredTableModel

    public FilteredTableModel(TableModel model,
                              Filter<? super TableRow> filter)

Method Detail

### getFilter

    public Filter<? super TableRow> getFilter()

  filter may be null

### unwrap

    public TableModel unwrap()

  Description copied from interface: `Wrapped`
  returns the embedded instance that this wrapper encloses

  Specified by:
    `unwrap` in interface `Wrapped<TableModel>`

### setFilter

    public void setFilter(Filter<? super TableRow> filter)

  this method must also be called whenever the filter itself changes its behaviour; the filter itself may be null

### tableChanged

    public void tableChanged(TableModelEvent ev)

  Specified by:
    `tableChanged` in interface `TableModelListener`

### getOriginalRow

    public int getOriginalRow(int row)

  returns the row that corresponds to the unfiltered embedded model

### getRowPosition

    public int getRowPosition(int originalRow)

  returns where to find the given original row in the filtered view; if the row is currently not visible, a negative number is returned.

### getValueAt

    public Object getValueAt(int row,
                             int column)

  Specified by:
    `getValueAt` in interface `TableModel`

### setValueAt

    public void setValueAt(Object value,
                           int row,
                           int column)

  Specified by:
    `setValueAt` in interface `TableModel`
  Overrides:
    `setValueAt` in class `AbstractTableModel`

### getRowCount

    public int getRowCount()

  Specified by:
    `getRowCount` in interface `TableModel`

### getColumnCount

    public int getColumnCount()

  Specified by:
    `getColumnCount` in interface `TableModel`

### getColumnName

    public String getColumnName(int column)

  Specified by:
    `getColumnName` in interface `TableModel`
  Overrides:
    `getColumnName` in class `AbstractTableModel`

### getColumnClass

    public Class<?> getColumnClass(int column)

  Specified by:
    `getColumnClass` in interface `TableModel`
  Overrides:
    `getColumnClass` in class `AbstractTableModel`

### isCellEditable

    public boolean isCellEditable(int row,
                                  int column)

  Specified by:
    `isCellEditable` in interface `TableModel`
  Overrides:
    `isCellEditable` in class `AbstractTableModel`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads