public final class MovieTableModel extends AbstractTableModel
JTable
, explicitly for Movie
objects.
When a database operation occurs, the view is refreshed by calling
refreshView()
.
Note this class includes some methods which are unrelated to the needs of the superclass, but are useful in the context of this application.
listenerList
Constructor and Description |
---|
MovieTableModel()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getColumnCount()
Return the number of columns in the table.
|
String |
getColumnName(int aIdx)
Return the name of a specific column.
|
String |
getId(int aRow)
Returned the selected movie's id.
|
Movie |
getMovie(int aRow)
Return the selected
Movie . |
int |
getRowCount()
Return the number of rows in the table.
|
Object |
getValueAt(int aRow,
int aCol)
Return the Object in a specific table cell.
|
void |
refreshView()
Explicitly refresh the view.
|
void |
sortByColumn(int aIdx)
Sort the movies.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
public MovieTableModel()
public void refreshView()
This style seems to be cleaner and simpler than implementing a listener on the DAO.
public void sortByColumn(int aIdx)
aIdx
- index of the column by which to sort.public int getColumnCount()
public int getRowCount()
public Object getValueAt(int aRow, int aCol)
public String getColumnName(int aIdx)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
Copyright Hirondelle Systems - Generated 2013Sep20.11.16