gui.prio
Class DollarWindow.RequirementTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byjavax.swing.table.DefaultTableModel
          extended bygui.prio.DollarWindow.RequirementTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Enclosing class:
DollarWindow

class DollarWindow.RequirementTableModel
extends javax.swing.table.DefaultTableModel

DefaultTableModel used for checking the input into the cells. Makes sure that only valid characters are entered and that the $100 limit is not exceeded.

If incorrect values are entered en error message is displayed.


Field Summary
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DollarWindow.RequirementTableModel(java.lang.Object[][] data, java.lang.Object[] columnNames)
           
 
Method Summary
private  boolean allowInsert(int value, int row)
          Check if it is allowed to set the value in the specified row of the $ column, according to the ordinal scale given by the PlanningGame.
 boolean isCellEditable(int row, int column)
           
 void setValueAt(java.lang.Object value, int row, int col)
          Set the value in the specified cell.
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
 
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
 

Constructor Detail

DollarWindow.RequirementTableModel

public DollarWindow.RequirementTableModel(java.lang.Object[][] data,
                                          java.lang.Object[] columnNames)
Method Detail

isCellEditable

public boolean isCellEditable(int row,
                              int column)

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Set the value in the specified cell. Also makes sure that the value is valid for the specified cell.

Parameters:
value - the value to set
row - the row of the cell to set the value in
col - the column of the cell to set the value in

allowInsert

private boolean allowInsert(int value,
                            int row)
Check if it is allowed to set the value in the specified row of the $ column, according to the ordinal scale given by the PlanningGame.

Only used after the PlanningGame method has been used.

Parameters:
value - the value to check
row - the specified row
Returns:
true if the value is valid for the cell