org.jcreme.swing.reporting
Class ReportTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byorg.jcreme.swing.table.AbstractSortableTableModel
          extended byorg.jcreme.swing.reporting.ReportTableModel
All Implemented Interfaces:
ReportChangeListener, java.io.Serializable, SortableTableModel, javax.swing.table.TableModel

public class ReportTableModel
extends AbstractSortableTableModel
implements ReportChangeListener

This is an implementation of an AbstractSortableTableModel based on the TableReport interface. This model enables to present a TableReport in a sortable way.

Version:
$Revision: 1.1 $
Author:
$Author: dbregeon $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ReportTableModel(Report report)
          Creates new BondPositionReportTableModel
 
Method Summary
 void fireTableDataChanged()
          Override the original method to provide a more precise behaviour when the change originates in the report (partial change).
 java.lang.Class getColumnClass(int columnIndex)
          Gives access to the class of the values that are in a column.
 int getColumnCount()
          Gives access to the number of columns in the report.
 java.lang.String getColumnName(int column)
          Gives access to the name of a column.
protected  java.lang.Object getOriginalValueAt(int row, int column)
          This method returns the value at the original (non sorted) row.
 int getRowCount()
          Gives access to the number of rows in the report.
protected  boolean isOriginalCellEditable(int row, int column)
          This method enables to determine if the value at the original (non sorted) row can be modified.
 void reportChanged(ReportChangeEvent e)
          This method enables to transform the changes in the report into event that report changes in the model.
protected  void setOriginalValueAt(java.lang.Object value, int row, int column)
          This method enables to change the value at the original (non sorted) row.
 
Methods inherited from class org.jcreme.swing.table.AbstractSortableTableModel
compare, compareRowsByColumn, getOriginalRow, getSortingColumns, getValueAt, initConverterArray, isCellEditable, originalIntervalToSortedIntervals, setValueAt, shuttleSort, sort
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, 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
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
 

Constructor Detail

ReportTableModel

public ReportTableModel(Report report)
Creates new BondPositionReportTableModel

Parameters:
report - the report to be displayed in a JTable.
Method Detail

getRowCount

public int getRowCount()
Gives access to the number of rows in the report.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
the number of rows in the model.

getOriginalValueAt

protected java.lang.Object getOriginalValueAt(int row,
                                              int column)
This method returns the value at the original (non sorted) row.

Specified by:
getOriginalValueAt in class AbstractSortableTableModel
Parameters:
row - the row for which the value is requested.
column - the column for which the value is requested.
Returns:
the value at the original (non sorted) row for the given column.

setOriginalValueAt

protected void setOriginalValueAt(java.lang.Object value,
                                  int row,
                                  int column)
This method enables to change the value at the original (non sorted) row.

Specified by:
setOriginalValueAt in class AbstractSortableTableModel
Parameters:
value - the value to set these coordinates in the original model.
row - the row number in the original model.
column - the column in the model.

getColumnCount

public int getColumnCount()
Gives access to the number of columns in the report.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
the number of columns in the model.

getColumnName

public java.lang.String getColumnName(int column)
Gives access to the name of a column.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Parameters:
column - the index of the column for which we want the name.
Returns:
the name of the column at the given index.

reportChanged

public void reportChanged(ReportChangeEvent e)
This method enables to transform the changes in the report into event that report changes in the model.

Specified by:
reportChanged in interface ReportChangeListener
Parameters:
e - the event sent by the report.

fireTableDataChanged

public void fireTableDataChanged()
Override the original method to provide a more precise behaviour when the change originates in the report (partial change). When the change does not originate in the report, the original behaviour is upheld.


getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Gives access to the class of the values that are in a column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
columnIndex - the column for which we want the type.
Returns:
the type of the values in the given column.

isOriginalCellEditable

protected boolean isOriginalCellEditable(int row,
                                         int column)
Description copied from class: AbstractSortableTableModel
This method enables to determine if the value at the original (non sorted) row can be modified.

Specified by:
isOriginalCellEditable in class AbstractSortableTableModel
Parameters:
row - the row number in the original model.
column - the column in the model.
Returns:
true if the cell at the original coordinates is editable.


Copyright 2006 null. All Rights Reserved.