com.monkeycoder.monkeynes.gui
Class GameGenieTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--com.monkeycoder.monkeynes.gui.GameGenieTableModel
All Implemented Interfaces:
Serializable, TableModel

public class GameGenieTableModel
extends AbstractTableModel

This is the table model used for the display of GameGenieCodes by the GameGenieGui.

Originally part of the MonkeyNES project.

Author:
David Stephens
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
GameGenieTableModel()
          Creates a new GameGenieTableModel with no headers or data.
GameGenieTableModel(String[] inColNames)
          Creates a new GameGenieTableModel with the supplied headers.
GameGenieTableModel(String[] inColNames, ArrayList inData)
          Creates a new GameGenieTableModel with the supplied headers and data.
GameGenieTableModel(String[] inColNames, Object[][] inData)
          Creates a new GameGenieTableModel with the supplied headers and raw data.
 
Method Summary
 void addRow(GameGenieCode inCode)
          Adds a row to the bottom of the table.
 Class getColumnClass(int col)
          Returns the object class of the requested column.
 int getColumnCount()
          Returns the number of columns in this table.
 String getColumnName(int col)
          Returns the column header name for the requested column.
 ArrayList getDataSet()
          Builds an ArrayList full of all the GameGenieCode objects currently in the table.
 int getRowCount()
          Returns the number of data rows in this table.
 Object getValueAt(int row, int col)
          Returns the data at the specified table coordinates.
 boolean isCellEditable(int row, int col)
          Returns whether or not the data at the specified table coordinates is editable.
 void removeRow(int row)
          Removes a row from the table.
 void setDataSet(ArrayList inData)
          Replaces the data used with new data.
 void setValueAt(Object value, int row, int col)
          Sets the raw data at the specified table coordinates.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameGenieTableModel

public GameGenieTableModel()
Creates a new GameGenieTableModel with no headers or data.


GameGenieTableModel

public GameGenieTableModel(String[] inColNames)
Creates a new GameGenieTableModel with the supplied headers.

Parameters:
inColNames - A string array containing column headers labels.

GameGenieTableModel

public GameGenieTableModel(String[] inColNames,
                           Object[][] inData)
Creates a new GameGenieTableModel with the supplied headers and raw data.

Parameters:
inColNames - A string array containing column headers labels.
inData - Object data for each cell of the table.

GameGenieTableModel

public GameGenieTableModel(String[] inColNames,
                           ArrayList inData)
Creates a new GameGenieTableModel with the supplied headers and data.

Parameters:
inColNames - A string array containing column headers labels.
inData - An ArrayList expected to contain GameGenieCode objects.
Method Detail

getDataSet

public ArrayList getDataSet()
Builds an ArrayList full of all the GameGenieCode objects currently in the table.

Returns:
An ArrayList containing GameGenieCode objects.

setDataSet

public void setDataSet(ArrayList inData)
Replaces the data used with new data.

Parameters:
inData - An ArrayList expected to contain GameGenieCode objects.

getColumnCount

public int getColumnCount()
Returns the number of columns in this table. Should always be 4.

Returns:
The number of columns in this table.

getRowCount

public int getRowCount()
Returns the number of data rows in this table.

Returns:
The number of data rows in this table.

getColumnName

public String getColumnName(int col)
Returns the column header name for the requested column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
col - The requested column.
Returns:
The column header name for the requested column.

getValueAt

public Object getValueAt(int row,
                         int col)
Returns the data at the specified table coordinates.

Parameters:
row - The row coordinate.
col - The column coordinate.
Returns:
The data at the specified table coordinates.

getColumnClass

public Class getColumnClass(int col)
Returns the object class of the requested column.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
col - The requested column.
Returns:
The object class of the requested column.

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Returns whether or not the data at the specified table coordinates is editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - The row coordinate.
col - The column coordinate.
Returns:
Whether or not the data at the specified table coordinates is editable.

setValueAt

public void setValueAt(Object value,
                       int row,
                       int col)
Sets the raw data at the specified table coordinates.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
value - The raw data.
row - The row coordinate.
col - The column coordinate.

addRow

public void addRow(GameGenieCode inCode)
Adds a row to the bottom of the table.

Parameters:
inCode - The GameGenieCode that will be used to add a row to the table.

removeRow

public void removeRow(int row)
Removes a row from the table.

Parameters:
row - The index of the row to remove.