com.monkeycoder.monkeyfractal.gui
Class ParameterListTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.monkeycoder.monkeyfractal.gui.ParameterListTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class ParameterListTableModel
extends javax.swing.table.AbstractTableModel

This is the table model used for the display of ParameterList key and value pairs by ParameterListGui.

Originally part of the MonkeyFractal project.

Author:
David Stephens
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ParameterListTableModel()
          Creates a new ParameterListTableModel with no headers or data.
ParameterListTableModel(java.lang.String[] inColNames)
          Creates a new ParameterListTableModel with the supplied headers.
ParameterListTableModel(java.lang.String[] inColNames, java.lang.Object[][] inData)
          Creates a new ParameterListTableModel with the supplied headers and raw data.
ParameterListTableModel(java.lang.String[] inColNames, ParameterList inData)
          Creates a new ParameterListTableModel with the supplied headers and data.
 
Method Summary
 void addRow(java.lang.String inParamName, double inValue)
          Adds a row to the table.
 java.lang.Class getColumnClass(int col)
          Returns the object class of the requested column.
 int getColumnCount()
          Returns the number of columns in this table.
 java.lang.String getColumnName(int col)
          Returns the column header name for the requested column.
 ParameterList getDataSet()
          Builds a ParameterList using the data objects currently in the table.
 int getRowCount()
          Returns the number of data rows in this table.
 java.lang.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(ParameterList inData)
          Replaces the data used with new data.
 void setValueAt(java.lang.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

ParameterListTableModel

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


ParameterListTableModel

public ParameterListTableModel(java.lang.String[] inColNames)
Creates a new ParameterListTableModel with the supplied headers.

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

ParameterListTableModel

public ParameterListTableModel(java.lang.String[] inColNames,
                               java.lang.Object[][] inData)
Creates a new ParameterListTableModel 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.

ParameterListTableModel

public ParameterListTableModel(java.lang.String[] inColNames,
                               ParameterList inData)
Creates a new ParameterListTableModel 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 ParameterList getDataSet()
Builds a ParameterList using the data objects currently in the table.

Returns:
An ParameterList containing the data from this table.

setDataSet

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

Parameters:
inData - A ParameterList containing the key value pairs to use in the table.

getColumnCount

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

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 java.lang.String getColumnName(int col)
Returns the column header name for the requested column.

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

getValueAt

public java.lang.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 java.lang.Class getColumnClass(int col)
Returns the object class of the requested column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.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 javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.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(java.lang.Object value,
                       int row,
                       int col)
Sets the raw data at the specified table coordinates.

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

addRow

public void addRow(java.lang.String inParamName,
                   double inValue)
Adds a row to the table.

Parameters:
inParamName - The name of the parameter to add.
inValue - The value to which the named parameter will be set.

removeRow

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

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