Package org.ka2ddo.yaac.gui.table
Class RowNumberTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
org.ka2ddo.yaac.gui.table.RowNumberTableModel
- All Implemented Interfaces:
Serializable
,EventListener
,TableModelListener
,TableModel
This table model counts rows, suitable for the row header of a JScrollPane surrounding a JTable.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
ConstructorDescriptionRowNumberTableModel
(TableModel rootTable) Create a table model for displaying row numbers for another table. -
Method Summary
Modifier and TypeMethodDescriptionClass<?>
getColumnClass
(int columnIndex) ReturnsString.class
regardless ofcolumnIndex
.int
Returns the number of columns in the model.getColumnName
(int column) Returns a default name for the column using spreadsheet conventions: A, B, C, ...int
Returns the number of rows in the model.getValueAt
(int rowIndex, int columnIndex) Returns the value for the cell atcolumnIndex
androwIndex
.void
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
Constructor Details
-
RowNumberTableModel
Create a table model for displaying row numbers for another table.- Parameters:
rootTable
- TableModel whose rows should be numbered in the tow header of a table
-
-
Method Details
-
getRowCount
public int getRowCount()Returns the number of rows in the model. AJTable
uses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of rows in the model
- See Also:
-
getColumnCount
public int getColumnCount()Returns the number of columns in the model. AJTable
uses this method to determine how many columns it should create and display by default.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the number of columns in the model
- See Also:
-
getColumnName
Returns a default name for the column using spreadsheet conventions: A, B, C, ... Z, AA, AB, etc. Ifcolumn
cannot be found, returns an empty string.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column being queried- Returns:
- a string containing the default name of
column
-
getColumnClass
ReturnsString.class
regardless ofcolumnIndex
.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the column being queried- Returns:
- the String.class
-
getValueAt
Returns the value for the cell atcolumnIndex
androwIndex
.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queried- Returns:
- the value Object at the specified cell
-
tableChanged
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.- Specified by:
tableChanged
in interfaceTableModelListener
- Parameters:
e
- TableModelEvent reporting the change in the other table model
-