|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel org.afcs.warts.gui.TableMap org.afcs.warts.gui.TableModelRowColumnMap
The TableModelRowColumnMap class can be used to filter
any class implementing Swing's TableModel
interface using
row and column checkers (defined using a public interface) to filter the
rows and columns. A row and column map that maps the filtered model to the
base model is created at initialisation using the filters supplied, and
these are used to map all indices specified in API calls to the approriate
indices in the base model.
LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.
Nested Class Summary | |
static interface |
TableModelRowColumnMap.RowColumnChecker
This interface must be implemented by any class that will be used to determine whether a row or column should be included in the model that a TableModelRowColumnMap is used to wrap. |
Field Summary |
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
TableModelRowColumnMap(javax.swing.table.TableModel baseModel,
TableModelRowColumnMap.RowColumnChecker rowChecker,
TableModelRowColumnMap.RowColumnChecker columnChecker)
Constructs a new map with the specified base model and the specified filters for both rows and columns. |
Method Summary | |
int |
getBaseModelColumnIndex(int columnIndex)
Returns the column index in the base table model that corresponds to the specified column index in the filtered table model. |
int |
getBaseModelRowIndex(int rowIndex)
Returns the row index in the base table model that corresponds to the specified row index in the filtered table model. |
java.lang.Class |
getColumnClass(int columnIndex)
Returns the class of object in the specified column, which is mapped to the appropriate column in the unfiltered base model. |
int |
getColumnCount()
Returns the number of columns in the filtered table model. |
java.lang.String |
getColumnName(int columnIndex)
Returns the name of the specified column, which is mapped to the appropriate column in the unfiltered base model. |
int |
getRowCount()
Returns the number of rows in the filtered table model. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value at the specified row and column, which are mapped to the appropriate unfiltered row and column indices in the base model. |
java.lang.String |
toString()
Returns a text description of the current instance that can be used for debugging purposes. |
Methods inherited from class org.afcs.warts.gui.TableMap |
getModel, isCellEditable, setValueAt, tableChanged |
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, wait, wait, wait |
Methods inherited from interface javax.swing.table.TableModel |
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt |
Constructor Detail |
public TableModelRowColumnMap(javax.swing.table.TableModel baseModel, TableModelRowColumnMap.RowColumnChecker rowChecker, TableModelRowColumnMap.RowColumnChecker columnChecker)
baseModel
- The base model to wrap.rowChecker
- The class that will be responsible for deciding whether
a row in the base model should be included or not.columnChecker
- The class that will be responsible for deciding
whether a column in the base model should be included or
not.Method Detail |
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
getValueAt
in class TableMap
rowIndex
- The row to return data from.columnIndex
- The column to return data from.
java.lang.IllegalArgumentException
- If either index is out of bounds.public int getBaseModelRowIndex(int rowIndex)
rowIndex
- A row index in the filtered table model.
java.lang.IllegalArgumentException
- If rowIndex is out of bounds.public int getBaseModelColumnIndex(int columnIndex)
columnIndex
- A column index in the filtered table model.
java.lang.IllegalArgumentException
- If columnIndex is out of bounds.public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
getRowCount
in class TableMap
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
getColumnCount
in class TableMap
public java.lang.Class getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class TableMap
columnIndex
- The column to obtain the class for.
java.lang.IllegalArgumentException
- If columnIndex is out of bounds.public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class TableMap
columnIndex
- The column to return the name of.
java.lang.IllegalArgumentException
- If columnIndex is out of bounds.public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |