cayleytable
Class groupTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by cayleytable.groupTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class groupTableModel
extends javax.swing.table.AbstractTableModel

Extended AbstractTableModel class describing how a group stored in a groupMatrix object is displayed in a JTable object.

Author:
Jeffrey Barr
See Also:
Serialized Form

Field Summary
private  boolean canEditTable
          boolean that determines if the JTable can be manually edited
private  int order
          int that contains the current order of the group on display
private  java.util.ArrayList<java.util.ArrayList<java.lang.String>> tableRows
          ArrayList of ArrayList of String objects which contains every cell in the JTable which is the groupMatrix object passed to the groupTableModel constructor.
private  groupPanel topPanel
          groupPanel object that contains the JTable that the current instanced of groupTableModel defines.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
groupTableModel(groupPanel inputPanel)
          Creates a new instance of groupTableModel with an empty group of order 0
 
Method Summary
 void displayTable(groupMatrix matrix, boolean makeEditable)
          Method that fills the column headers and cells in the JTable with the newest groupMatrix object.
 int getColumnCount()
          Method to return number of columns in the JTable.
 java.lang.String getColumnName(int column)
          Method used to return value to display as column name for a specific column in the JTable.
 int getRowCount()
          Method to return number of rows in the JTable.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Method used to return value to display for a specific row, column in the JTable.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Method to determine if a specific cell is editable on the JTable.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          Method to set the value of a cell in the JTable as well as resets the value of the same cell in the group stored in topPanel.
 
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

order

private int order
int that contains the current order of the group on display


canEditTable

private boolean canEditTable
boolean that determines if the JTable can be manually edited


tableRows

private java.util.ArrayList<java.util.ArrayList<java.lang.String>> tableRows
ArrayList of ArrayList of String objects which contains every cell in the JTable which is the groupMatrix object passed to the groupTableModel constructor.


topPanel

private groupPanel topPanel
groupPanel object that contains the JTable that the current instanced of groupTableModel defines.

Constructor Detail

groupTableModel

public groupTableModel(groupPanel inputPanel)
Creates a new instance of groupTableModel with an empty group of order 0

Parameters:
inputPanel - groupPanel object which contains the JTable object
Method Detail

displayTable

public void displayTable(groupMatrix matrix,
                         boolean makeEditable)
Method that fills the column headers and cells in the JTable with the newest groupMatrix object.

Parameters:
matrix - groupMatrix object that contains the newest group to be displayed.
makeEditable - Boolean variable that defines if the newest group can be manually edited in the JTable

getColumnName

public java.lang.String getColumnName(int column)
Method used to return value to display as column name for a specific column in the JTable.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
column - int value of column name to retrieve
Returns:
Name of column based upon position

getRowCount

public int getRowCount()
Method to return number of rows in the JTable.

Returns:
int value containing the order of the group being displayed.

getColumnCount

public int getColumnCount()
Method to return number of columns in the JTable.

Returns:
int value containing the order of the group + one for each element in the group and the first column containing the element names.

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Method to set the value of a cell in the JTable as well as resets the value of the same cell in the group stored in topPanel.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
aValue - Object that is the new value of the cell in the table.
rowIndex - integer containing row of the cell to change in the JTable
columnIndex - integer containing column of the cell to change in the JTable

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Method used to return value to display for a specific row, column in the JTable.

Parameters:
rowIndex - integer containing row of cell in JTable to retrieve.
columnIndex - integer containing column of cell in JTable to retrieve.
Returns:
Value of cell in JTable that was retrieved

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Method to determine if a specific cell is editable on the JTable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
rowIndex - integer containing row of cell in JTable to check.
columnIndex - integer containing column of cell in JTable to check.
Returns:
Boolean that determines if cell is editable