org.peace_tools.data
Class DataSetTableModel

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

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

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
DataSetTableModel()
          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 in a
 java.lang.String getColumnName(int col)
          Override the default names that are set for the columns displayed in the job table.
 java.lang.Object getEntry(int row)
          This is a helper method to obtain a file name corresponding to a given row in the work space.
private  java.lang.String getFileName(int row)
          This is a helper method to obtain a file name corresponding to a given row in the work space.
 int getRow(java.lang.Object entry)
          Obtain the row for a given entry in this list.
 int getRowCount()
          Method to return the number of rows to be displayed in the 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)
          Translates work space change notifications to table changes.
 
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

DataSetTableModel

public DataSetTableModel()
The default constructor. The constructor registers this DataSetTableModel with the work space to receive notifications on Server status updates.

Method Detail

getColumnCount

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

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

getRowCount

public int getRowCount()
Method to return the number of rows to be displayed in the table. This method counts the number of files in the various data sets and returns that number.

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

getFileName

private java.lang.String getFileName(int row)
This is a helper method to obtain a file name corresponding to a given row in the work space.

Parameters:
row - The row in the work space for which the file name is to be returned.
Returns:
The file name corresponding to the given row.

getEntry

public java.lang.Object getEntry(int row)
This is a helper method to obtain a file name corresponding to a given row in the work space.

Parameters:
row - The row in the work space for which the file name is to be returned.
Returns:
The file name corresponding to the given row.

getRow

public int getRow(java.lang.Object entry)
Obtain the row for a given entry in this list. This method can be used to determine the row where the given entry occurs in this table model.

Parameters:
entry - The entry whose rows is to be determined.
Returns:
The row where the entry was found on this table. If the entry was not found, then this method returns -1.

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.

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.

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
Parameters:
column - The zero-based index of the column of the table for which class is required.

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.

workspaceChanged

public void workspaceChanged(WorkspaceEvent event)
Translates work space change notifications to table changes. This method implements the only method in the WorkspaceListener interface to intercept events notifying changes in the work space. This method in-turn fires table changed events.

Note: This method simply fires a table data changed event indicating that all the cells in the model have changed.

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