com.darwinsys.util
Class ArrayListTableModel
java.lang.Object
|
+--javax.swing.table.AbstractTableModel
|
+--com.darwinsys.util.ArrayListTableModel
- public abstract class ArrayListTableModel
- extends javax.swing.table.AbstractTableModel
JTable model for ArrayList of heterogeneous objects.
Subclasses must set String columnNames[] and
Class columnClasses[], which MUST be in the same order.
Subclasses need only implement these AbstractTableModel methods:
public int getColumnCount() {
public Object getValueAt(int row, int col) {
public void setValueAt(Object val, int row, int col) {
- See Also:
- Serialized Form
|
Field Summary |
protected java.lang.Class[] |
columnClasses
List of column names, must be provided by subclass. |
protected java.lang.String[] |
columnNames
List of column names, must be provided by subclass. |
protected java.util.ArrayList |
m
The list of Method object |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
|
Constructor Summary |
ArrayListTableModel(java.util.ArrayList m)
Constructor requires the list of objects |
|
Method Summary |
java.lang.Object |
getCached(int row)
Cache one most-recently-used item. |
java.lang.Class |
getColumnClass(int n)
Get the class of a given column, from the list provided by subclass |
java.lang.String |
getColumnName(int n)
Get the name of a given column, from the list provided by subclass |
int |
getRowCount()
Returns the number of objects in the list. |
void |
invalidateCache()
Invalidate the cache. |
boolean |
HREF="../../../com/darwinsys/util/ArrayListTableModel.html#isCellEditable(int, int)">isCellEditable(int rowIndex,
int columnIndex)
All cells are editable. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener,
findColumn,
fireTableCellUpdated,
fireTableChanged,
fireTableDataChanged,
fireTableRowsDeleted,
fireTableRowsInserted,
fireTableRowsUpdated,
fireTableStructureChanged,
getColumnCount,
getValueAt,
removeTableModelListener,
setValueAt |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
columnNames
protected java.lang.String[] columnNames
- List of column names, must be provided by subclass.
columnClasses
protected java.lang.Class[] columnClasses
- List of column names, must be provided by subclass.
m
protected java.util.ArrayList m
- The list of Method object
ArrayListTableModel
public ArrayListTableModel(java.util.ArrayList m)
- Constructor requires the list of objects
getColumnName
public java.lang.String getColumnName(int n)
- Get the name of a given column, from the list provided by subclass
- Overrides:
- getColumnName in class javax.swing.table.AbstractTableModel
getColumnClass
public java.lang.Class getColumnClass(int n)
- Get the class of a given column, from the list provided by subclass
- Overrides:
- getColumnClass in class javax.swing.table.AbstractTableModel
getRowCount
public int getRowCount()
- Returns the number of objects in the list.
- Overrides:
- getRowCount in class javax.swing.table.AbstractTableModel
isCellEditable
public boolean isCellEditable(int rowIndex,
int columnIndex)
- All cells are editable.
Subclasses can override this if only some cells should be editable.
- Overrides:
- isCellEditable in class javax.swing.table.AbstractTableModel
getCached
public java.lang.Object getCached(int row)
- Cache one most-recently-used item. This is a convenience
routine that subclasses are invited but not required to use.
Normal use would be, in get/setValueAt():
public void setValueAt(int row, ...) {
MyDataType current = (MyDataType) getCached(row);
...
}
invalidateCache
public void invalidateCache()
- Invalidate the cache. Called automatically by setListData();
must be called if you otherwise change the ArrayList.