Package ball.swing.table
Class ArrayListTableModel<R>
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- ball.swing.table.AbstractTableModelImpl
-
- ball.swing.table.ArrayListTableModel<R>
-
- Type Parameters:
R
- The type of table row.
- All Implemented Interfaces:
Serializable
,EventListener
,TableModelListener
,TableModel
- Direct Known Subclasses:
ListTableModel
,MapTableModel
,PropertyDescriptorsTableModel
,SimpleTableModel
public abstract class ArrayListTableModel<R> extends AbstractTableModelImpl
Abstract base class forTableModel
implementations based on anArrayList
.- Author:
- Allen D. Ball
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ArrayListTableModel(Iterable<? extends R> iterable, int columns)
protected
ArrayListTableModel(Iterable<? extends R> iterable, String... names)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
getRowCount()
Object
getValueAt(int y, int x)
protected abstract Object
getValueAt(R row, int x)
Implementation method to retrieve a column value from a row object.ArrayList<R>
list()
Method to access the underlying rowList
.-
Methods inherited from class ball.swing.table.AbstractTableModelImpl
column, getColumnClass, getColumnCount, getColumnName, header, isCellEditable, row, setColumnClass, setColumnName, setValueAt, tableChanged
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Constructor Detail
-
ArrayListTableModel
protected ArrayListTableModel(Iterable<? extends R> iterable, String... names)
- Parameters:
iterable
- TheIterable
of row values.names
- The column names.- See Also:
AbstractTableModelImpl(String...)
-
ArrayListTableModel
protected ArrayListTableModel(Iterable<? extends R> iterable, int columns)
- Parameters:
iterable
- TheIterable
of row values.columns
- The number of columns.- See Also:
AbstractTableModelImpl(int)
-
-
Method Detail
-
list
public ArrayList<R> list()
Method to access the underlying rowList
.- Returns:
- The underlying row
List
.
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfaceTableModel
- Specified by:
getRowCount
in classAbstractTableModelImpl
-
getValueAt
protected abstract Object getValueAt(R row, int x)
Implementation method to retrieve a column value from a row object.- Parameters:
row
- TheObject
representing the row.x
- The column index.- Returns:
- The column value from the row.
-
getValueAt
public Object getValueAt(int y, int x)
- Specified by:
getValueAt
in interfaceTableModel
- Specified by:
getValueAt
in classAbstractTableModelImpl
-
-