My Movies 1.0.0

hirondelle.movies.edit
Class MovieTableModel

Object
  extended by AbstractTableModel
      extended by MovieTableModel
All Implemented Interfaces:
Serializable, TableModel

public final class MovieTableModel
extends AbstractTableModel

Table model used by 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.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class AbstractTableModel
listenerList
 
Constructor Summary
MovieTableModel()
          Constructor.
 
Method Summary
 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.
 
Methods inherited from class AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovieTableModel

public MovieTableModel()
Constructor.

Method Detail

refreshView

public void refreshView()
Explicitly refresh the view.

This style seems to be cleaner and simpler than implementing a listener on the DAO.


getId

public String getId(int aRow)
Returned the selected movie's id.


getMovie

public Movie getMovie(int aRow)
Return the selected Movie.


sortByColumn

public void sortByColumn(int aIdx)
Sort the movies. When called repeatedly, this method will toggle the sort between ascending and descending.

Parameters:
aIdx - index of the column by which to sort.

getColumnCount

public int getColumnCount()
Return the number of columns in the table.


getRowCount

public int getRowCount()
Return the number of rows in the table.


getValueAt

public Object getValueAt(int aRow,
                         int aCol)
Return the Object in a specific table cell.


getColumnName

public String getColumnName(int aIdx)
Return the name of a specific column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

My Movies 1.0.0

Copyright Hirondelle Systems - Generated 2008Dec30.15.53