org.peace_tools.data
Class JobListTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.peace_tools.data.JobListTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, WorkspaceListener

public class JobListTableModel
extends javax.swing.table.AbstractTableModel
implements WorkspaceListener

A bridge class between Job entries in a workspace and a JTable. This class serves as a bridge between the in-memory representation of jobs in a Workspace (represented by the set of classes in the workspace package). This class enables reusing the data set hierarchy maintained by the Workspace object to display it in a JTable. In addition, this class also acts to monitor and update data set views.

Note: This table model currently provides the following information for each job: JobID, Server, Monitor, CPUs, Status. The monitor column indicates the status of the background job monitoring thread.

See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          A generated serial version ID for serializing the information in this class (if needed).
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
JobListTableModel()
          The default constructor.
 
Method Summary
 java.lang.Class<?> getColumnClass(int column)
          Obtain the class that describes the data type of a given column.
 int getColumnCount()
          Method to obtain the columns that are to be displayed by in a Job table.
 java.lang.String getColumnName(int col)
          Override the default names that are set for the columns displayed in the job table.
 Job getJob(int row)
          This is a convenience method to obtain the job data.
 int getRowCount()
          Method to return the number of rows to be displayed in the Job table.
 java.lang.Object getValueAt(int row, int column)
          Obtain the value to be displayed at a given row and column.
 boolean isCellEditable(int row, int column)
          Interface method to determine if an entry in the JTable is editable.
 void workspaceChanged(WorkspaceEvent event)
          This method is invoked on all workspace listeners registered with the current Workspace.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
A generated serial version ID for serializing the information in this class (if needed).

See Also:
Constant Field Values
Constructor Detail

JobListTableModel

public JobListTableModel()
The default constructor. The constructor registers this JobListTableModel with the workspace to receive notifications on Job status updates.

Method Detail

getColumnCount

public int getColumnCount()
Method to obtain the columns that are to be displayed by in a Job table.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
This method currently always returns 5.

getRowCount

public int getRowCount()
Method to return the number of rows to be displayed in the Job table.

Specified by:
getRowCount in interface javax.swing.table.TableModel

getJob

public Job getJob(int row)
This is a convenience method to obtain the job data.

Parameters:
row - The row id whose Job entry is to be returned.
Returns:
The job entry corresponding to a given row. If the entry is unavailable, this method returns null.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Obtain the value to be displayed at a given row and column.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Returns:
The object to be displayed at a given row and column. The value depends on the column being displayed.

getColumnClass

public java.lang.Class<?> getColumnClass(int column)
Obtain the class that describes the data type of a given column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Interface method to determine if an entry in the JTable is editable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Returns:
This method always returns false to indicate that the data in the Job table is not editable.

workspaceChanged

public void workspaceChanged(WorkspaceEvent event)
Description copied from interface: WorkspaceListener
This method is invoked on all workspace listeners registered with the current Workspace. The event contains the necessary information to report the change that has occured to a workspace.

Specified by:
workspaceChanged in interface WorkspaceListener
Parameters:
event - The event that contains the information regarding the change that has occured to the workspace.

getColumnName

public java.lang.String getColumnName(int col)
Override the default names that are set for the columns displayed in the job table.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - The zero-based column index whose title is to be returned.
Returns:
The title associated with the column.