faa.tg.departure.client
Class DepartureTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by faa.tg.departure.client.DepartureTableModel
All Implemented Interfaces:
java.awt.event.MouseListener, java.io.Serializable, java.util.EventListener, javax.swing.table.TableModel

 class DepartureTableModel
extends javax.swing.table.AbstractTableModel
implements java.awt.event.MouseListener

  This class defines DepartureTableModel which is the model that controls
  a departure table.
  

Version:
$Id: DepartureTableModel.java,v 3.1 2006/03/14 15:50:18 samf Exp $
Author:
Sam Fullerton, ACT-510 See the source: DepartureTableModel.java

Field Summary
static int COL_ACID
           
static int COL_DEPT_APT
           
static int COL_DEPT_RWY
           
static int COL_FLYING_STATUS
           
static int COL_NAS_SECTOR
           
static int COL_START_TIME
           
static ColumnHeaders[] COLUMN_DATA
          defines the headers for the table columns
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
private  DepartureTableComparator dataComparator
           
private  java.util.Vector rowData
           
(package private) static long serialVersionUID
           
private  DepartureTable table
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DepartureTableModel(DepartureTable table)
          Constructor
 
Method Summary
 void addRow(DepartureFlight deptFlight)
          adds an aircraft to the table
 int findPlace(DepartureRow deptRow)
          Deprecated. Please call DepartureTableModel.sort(DepartureTableModel, DepartureTableComparator);
 int getColumnCount()
          Returns the number of columns in the model Required by AbstractTableModel to define
 java.lang.String getColumnName(int column)
          Returns the name of the given column number
 int getIndex(DepartureRow row)
          Returns the index of a given departure row
 DepartureRow getRow(Acid acid)
          get row by acid
 DepartureRow getRow(int row)
          returns the departure row at the given index
 int getRowCount()
          Returns the number of rows in the model Required by AbstractTableModel to define
 java.lang.Object getValueAt(int row, int column)
          Returns the value for the cell at column and row, or null if unable to find location [row, column] Required by AbstractTableModel to define
 boolean isCellEditable(int nRow, int nCol)
          Returns true if the cell at rowIndex and columnIndex is editable.
 void mouseClicked(java.awt.event.MouseEvent me)
          Required by MouseListener Interface Invoked when the mouse button has been clicked (pressed and released) on a component.
 void mouseEntered(java.awt.event.MouseEvent me)
          Required by MouseListener Interface Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent me)
          Required by MouseListener Interface Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent me)
          Required by MouseListener Interface Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent me)
          Required by MouseListener Interface Invoked when a mouse button has been released on a component.
 void removeRow(DepartureFlight deptFlight)
          removes a given aircraft from the table
 void setValueAt(java.lang.Object value, int row, int column)
          Sets the value for the cell at column and row Had to overwrite so that departure runway could be changed
static void sort(DepartureTableModel model, DepartureTableComparator dataComparator)
          Sort a DepartureTable given the DepartureTableModel, and the DepartureTableComparator to use when sorting Based on Andrey's fpEditor sort
 void updateRow(Acid acid, AirportRwyID aptRwyID)
          updates the departure rwy of the table given an acid
 void updateRow(Acid acid, SimulationTime startTime)
          update a row in the tables start time given an acid
 void updateRow(Acid acid, java.lang.String flyingStatus)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID

See Also:
Constant Field Values

COLUMN_DATA

public static final ColumnHeaders[] COLUMN_DATA
defines the headers for the table columns


table

private DepartureTable table

COL_START_TIME

public static final int COL_START_TIME
See Also:
Constant Field Values

COL_ACID

public static final int COL_ACID
See Also:
Constant Field Values

COL_DEPT_APT

public static final int COL_DEPT_APT
See Also:
Constant Field Values

COL_DEPT_RWY

public static final int COL_DEPT_RWY
See Also:
Constant Field Values

COL_NAS_SECTOR

public static final int COL_NAS_SECTOR
See Also:
Constant Field Values

COL_FLYING_STATUS

public static final int COL_FLYING_STATUS
See Also:
Constant Field Values

rowData

private java.util.Vector rowData

dataComparator

private DepartureTableComparator dataComparator
Constructor Detail

DepartureTableModel

public DepartureTableModel(DepartureTable table)
Constructor

Parameters:
DepartureTable - - the departure table the model is controlling
Method Detail

getRowCount

public int getRowCount()
Returns the number of rows in the model Required by AbstractTableModel to define

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

getColumnCount

public int getColumnCount()
Returns the number of columns in the model Required by AbstractTableModel to define

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

getColumnName

public java.lang.String getColumnName(int column)
Returns the name of the given column number

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

isCellEditable

public boolean isCellEditable(int nRow,
                              int nCol)
Returns true if the cell at rowIndex and columnIndex is editable. In this case only the column containing departure runways is editable. Everything else is not editable.

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

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the value for the cell at column and row, or null if unable to find location [row, column] Required by AbstractTableModel to define

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

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int column)
Sets the value for the cell at column and row Had to overwrite so that departure runway could be changed

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

getRow

public DepartureRow getRow(Acid acid)
get row by acid

Returns:
the first row in the table that contains the given acid, or null.

addRow

public void addRow(DepartureFlight deptFlight)
adds an aircraft to the table


getRow

public DepartureRow getRow(int row)
returns the departure row at the given index


getIndex

public int getIndex(DepartureRow row)
Returns the index of a given departure row


removeRow

public void removeRow(DepartureFlight deptFlight)
removes a given aircraft from the table


updateRow

public void updateRow(Acid acid,
                      AirportRwyID aptRwyID)
updates the departure rwy of the table given an acid


updateRow

public void updateRow(Acid acid,
                      java.lang.String flyingStatus)

updateRow

public void updateRow(Acid acid,
                      SimulationTime startTime)
update a row in the tables start time given an acid


findPlace

public int findPlace(DepartureRow deptRow)
Deprecated. Please call DepartureTableModel.sort(DepartureTableModel, DepartureTableComparator);

Finds a place for a given departure row based on: 1. StartTime 2. Airport 3. Runway 4. Acid


mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
Required by MouseListener Interface Invoked when the mouse button has been clicked (pressed and released) on a component. Implemented so that I could sort table rows based on what column the user picked

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
me - - the MouseEvent to respond to

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent me)
Required by MouseListener Interface Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
me - - the MouseEvent to respond to

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)
Required by MouseListener Interface Invoked when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
me - - the MouseEvent to respond to

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Required by MouseListener Interface Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
me - - the MouseEvent to respond to

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Required by MouseListener Interface Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
me - - the MouseEvent to respond to

sort

public static void sort(DepartureTableModel model,
                        DepartureTableComparator dataComparator)
Sort a DepartureTable given the DepartureTableModel, and the DepartureTableComparator to use when sorting Based on Andrey's fpEditor sort