jgnash.ui.reconcile
Class AbstractReconcileTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jgnash.ui.reconcile.AbstractReconcileTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, MessageListener, PackableTableModel
Direct Known Subclasses:
CreditModel, DebitModel

public abstract class AbstractReconcileTableModel
extends javax.swing.table.AbstractTableModel
implements MessageListener, PackableTableModel

Model initializes itself by grabbing all of the transactions from the account and then filters for transactions that have not been reconciled and are after the startDate(inclusive). Any new transactions added to the account that are after the start date (reconciled or not) will be added to the list of transactions shown.

Version:
$Id$
Author:
Craig Cavanaugh
See Also:
Serialized Form

Nested Class Summary
private  class AbstractReconcileTableModel.RecTransaction
          Decorator around a Transaction to maintain the original reconciled state
 
Field Summary
(package private)  Account account
           
private  java.lang.Class<?>[] cClass
           
private  java.lang.String[] cNames
           
private  int[] columnWidths
           
private  java.util.List<AbstractReconcileTableModel.RecTransaction> list
           
private  java.util.Date openingDate
           
private  Resource rb
           
private static long serialVersionUID
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AbstractReconcileTableModel(Account account, java.util.Date openingDate)
           
 
Method Summary
protected  void clearAll()
           
protected  void commitChanges()
           
private  AbstractReconcileTableModel.RecTransaction findTransaction(Transaction t)
           
 java.lang.Class<?> getColumnClass(int column)
           
 int getColumnCount()
          Returns the number of columns in the model.
 java.lang.String getColumnName(int column)
           
 int[] getPreferredColumnWeights()
           
 java.math.BigDecimal getReconciledTotal()
           
 int getRowCount()
          Returns the number of rows in the model.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at columnIndex and rowIndex.
(package private) abstract  boolean isShowable(Transaction t)
           
private  void loadModel()
           
 void messagePosted(Message event)
           
private  boolean reconcilable(Transaction t)
           
protected  void selectAll()
           
protected  void toggleReconciledState(int index)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

account

final Account account

openingDate

private final java.util.Date openingDate

list

private java.util.List<AbstractReconcileTableModel.RecTransaction> list

rb

private final Resource rb

cNames

private java.lang.String[] cNames

cClass

private java.lang.Class<?>[] cClass

columnWidths

private int[] columnWidths
Constructor Detail

AbstractReconcileTableModel

AbstractReconcileTableModel(Account account,
                            java.util.Date openingDate)
Method Detail

getPreferredColumnWeights

public int[] getPreferredColumnWeights()
Specified by:
getPreferredColumnWeights in interface PackableTableModel

loadModel

private void loadModel()

reconcilable

private boolean reconcilable(Transaction t)

isShowable

abstract boolean isShowable(Transaction t)

getColumnCount

public int getColumnCount()
Returns the number of columns in the model. A JTable uses this method to determine how many columns it should create and display by default.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
the number of columns in the model
See Also:
getRowCount()

getColumnName

public java.lang.String getColumnName(int column)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getColumnClass

public java.lang.Class<?> getColumnClass(int column)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

getRowCount

public int getRowCount()
Returns the number of rows in the model. A JTable uses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
the number of rows in the model
See Also:
getColumnCount()

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
rowIndex - the row whose value is to be queried
columnIndex - the column whose value is to be queried
Returns:
the value Object at the specified cell

messagePosted

public void messagePosted(Message event)
Specified by:
messagePosted in interface MessageListener

getReconciledTotal

public java.math.BigDecimal getReconciledTotal()

findTransaction

private AbstractReconcileTableModel.RecTransaction findTransaction(Transaction t)

toggleReconciledState

protected void toggleReconciledState(int index)

selectAll

protected void selectAll()

clearAll

protected void clearAll()

commitChanges

protected void commitChanges()