Class TableDataModel
user_interface
java.lang.Object
  javax.swing.table.AbstractTableModel
      user_interface.TableDataModel
All Implemented Interfaces:
javax.swing.table.TableModel

public class TableDataModel
extends AbstractTableModel
Create a model of the data. NOTE: We could have built our own local vector to store the sale detail objects, but we are using the GUI object's own instance of a CashSale object to access the information pertaining to its collection of SaleDetails.
See Also:  Node Documentation

Field Summary
private final String[]
colNames
Sale Detail Table Column Header
private NumberFormat
private CashSale
currentSale
Problem Domain Object
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
Constructor Summary
TableDataModel(NumberFormat currencyFormat)
Method Summary
void
dataChanged(int changeType)
Update the table with the changed data model.
Class
getColumnClass(int c)
JTable uses this method to determine the default renderer/ editor for each cell to improve the display.
int
String
getColumnName(int column)
int
Object
getValueAt(int row)
boolean
void
setValueAt(Object aValue)
Methods inherited from class javax.swing.table.AbstractTableModel
getColumnClass, getColumnName, isCellEditable, setValueAt
Methods inherited from interface javax.swing.table.TableModel
getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, setValueAt
Field Detail
currentSale
private CashSale currentSale
Problem Domain Object

currencyFormat
private NumberFormat currencyFormat

colNames
private final String[] colNames = {"Item", "Name", "Unit", "Qty", "Price"}
Sale Detail Table Column Header
Constructor Detail
TableDataModel
public TableDataModel(NumberFormat currencyFormat)
Method Detail
getColumnCount
public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getRowCount
public int getRowCount()
Specified by:
getRowCount in interface TableModel

getValueAt
public Object getValueAt(int row)
Specified by:
getValueAt in interface TableModel

getColumnName
public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

isCellEditable
public boolean isCellEditable(int row)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

setValueAt
public void setValueAt(Object aValue)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

dataChanged
public void dataChanged(int changeType)
Update the table with the changed data model.

getColumnClass
public Class getColumnClass(int c)
JTable uses this method to determine the default renderer/ editor for each cell to improve the display.
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel