Overview | Package | Class | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.smardec.asc.table
Class FilteredTableModel

    java.lang.Object
      |
      +--javax.swing.table.AbstractTableModel
            |
            +--com.smardec.asc.table.TableModelMapping
                  |
                  +--com.smardec.asc.table.FilteredTableModel

All Implemented Interfaces:
  java.util.EventListener, java.io.Serializable, javax.swing.table.TableModel, javax.swing.event.TableModelListener

public class FilteredTableModel
extends com.smardec.asc.table.TableModelMapping

An `AbstractTableModel` implementation with filtering support. It uses supplied `RowFilter` to filter table rows. The original `TableModel` is used only as the data source and is not modified.

Sample usage:

        // Old code:
        //    JTable jTable = new JTable(tableModel);
        // New code:
        JTable jTable = new JTable(new FilteredTableModel(tableModel));

See Also:
  `RowFilter`

Field Summary
`protected javax.swing.table.TableModel` | `model` Original `TableModel` used as data source.

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

Constructor Summary
`FilteredTableModel(javax.swing.table.TableModel model)` Creates `FilteredTableModel` object with specified `TableModel` as the data source.

Method Summary
`void` | `filter()` Forces filtering of data contained in `TableModelMapping.model`.
`javax.swing.table.TableModel` | `getModel()` Returns original `TableModel` used as data source.
`int` | `getRealRowIndex(int rowIndex)` Returns row index in original `TableModelMapping.model` by index in current model (view index).
`RowFilter` | `getRowFilter()` Returns `RowFilter` used to filter table rows.
`void` | `setModel(javax.swing.table.TableModel model)` Sets original `TableModel` used as data source.
`void` | `setRowFilter(RowFilter rowFilter)` Sets `RowFilter` used to filter table rows.

Methods inherited from class javax.swing.table.AbstractTableModel
`addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.swing.event.TableModelListener
`tableChanged`

Methods inherited from interface javax.swing.table.TableModel
`getColumnCount, getRowCount, getValueAt`

Field Detail

### model

    protected javax.swing.table.TableModel model

  Original `TableModel` used as data source.

Constructor Detail

### FilteredTableModel

    public FilteredTableModel(javax.swing.table.TableModel model)

  Creates `FilteredTableModel` object with specified `TableModel` as the data source.

Parameters:
  `model` - `TableModel` used as the data source

Method Detail

### getRowFilter

    public RowFilter getRowFilter()

  Returns `RowFilter` used to filter table rows.

  Returns:
    `RowFilter` used to filter table rows.

### setRowFilter

    public void setRowFilter(RowFilter rowFilter)

  Sets `RowFilter` used to filter table rows. Invokes `filter()` before return.

  Parameters:
    `rowFilter` - `RowFilter` used to filter table rows

### filter

    public void filter()

  Forces filtering of data contained in `TableModelMapping.model`. The original `TableModelMapping.model` is not modified.

### getRealRowIndex

    public int getRealRowIndex(int rowIndex)

  Returns row index in original `TableModelMapping.model` by index in current model (view index).

  Parameters:
    `rowIndex` - index in current model (view index)
  Returns:
    row index in original `TableModelMapping.model`.

### getModel

    public javax.swing.table.TableModel getModel()

  Returns original `TableModel` used as data source.

  Returns:
    original `TableModel` used as data source.

### setModel

    public void setModel(javax.swing.table.TableModel model)

  Sets original `TableModel` used as data source.

  Parameters:
    `model` - original `TableModel` used as data source

Overview | Package | Class | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2006 Smardec. All Rights Reserved.