org.peace_tools.data
Class ServerListTableModel

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

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

A bridge class between Server entries in a workspace and a JTable. This class serves as a bridge between the in-memory representation of server 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 server: Host Name, Status.

See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          A generated serial version ID for serializing the information in this class (if needed).
private static java.lang.String[] StatusStrings
          The set of better formatted status strings to be displayed to the user in the ServerList table associated with this data model.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ServerListTableModel()
          The default constructor.
 
Method Summary
 int getColumnCount()
          Method to obtain the columns that are to be displayed by in a Server table.
 java.lang.String getColumnName(int col)
          Override the default names that are set for the columns displayed in the job table.
 int getRowCount()
          Method to return the number of rows to be displayed in the Server table.
 Server getServer(int row)
          This is a convenience method to obtain the server entry.
 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, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

StatusStrings

private static final java.lang.String[] StatusStrings
The set of better formatted status strings to be displayed to the user in the ServerList table associated with this data model.


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

ServerListTableModel

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

Method Detail

getColumnCount

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

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

getRowCount

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

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
This method returns the number of servers currently in this workspace.

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.

getServer

public Server getServer(int row)
This is a convenience method to obtain the server entry.

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

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.