SilverStream
Application Server 3.5

com.sssw.rt.util
Class AgoRowCursorTableModel

java.lang.Object
 |
 +--javax.swing.table.AbstractTableModel
       |
       +--com.sssw.rt.util.AgoRowCursorTableModel
All Implemented Interfaces:
AgiRowSetListener, Serializable, TableModel

public class AgoRowCursorTableModel
extends AbstractTableModel
implements AgiRowSetListener

AgoRowCursorTableModel builds a table data model from data in an AgiRowCursor object for use in a AgcJTable control. All columns defined for the AgiRowCursor are included in the table. Rather than binding the control to a single database column, all the displayed columns in the table are bound to database columns via AgiRowCursor.

You can consider AgoRowCursorTableModel a transducer between the SilverStream data model (AgiRowCursor) and the Swing TableModel (TableModel). It allows any SilverStream data to be used in a Swing JTable control (or any other control that uses a table model).

The data is accessed by reference, not copied, and all the data remains bound to the original database columns. You can use the same AgiRowCursor to provide data for both SilverStream and Swing controllers (AgcView and JTable) at the same time. Changes caused by either controller will result in events to the other so that both remain in sync.

See Also:
AgiRowCursor, TableModel, AgcView, JTable, Serialized Form

Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AgoRowCursorTableModel(AgiRowCursor cursor)
          Creates a TableModel object from the specified AgiRowCursor.
AgoRowCursorTableModel(AgiRowCursor cursor, int[] displayableColumns, int[] editableColumns, String[] columnNames)
          Creates a TableModel object from the specified AgiRowCursor with control over which columns are editable.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.event.AgiRowSetListener
dataReceivedAsync, dataReloaded, rowDataChanged, rowDeleted, rowInserted, rowPreDelete, rowPreInsert
 

Constructor Detail

AgoRowCursorTableModel

public AgoRowCursorTableModel(AgiRowCursor cursor)
                       throws AgoException
Creates a TableModel object from the specified AgiRowCursor. All cells will be uneditable.
Parameters:
cursor - an AgiRowCursor object that holds the data you want to use in the table model.

AgoRowCursorTableModel

public AgoRowCursorTableModel(AgiRowCursor cursor,
                              int[] displayableColumns,
                              int[] editableColumns,
                              String[] columnNames)
                       throws AgoException
Creates a TableModel object from the specified AgiRowCursor with control over which columns are editable.
Parameters:
cursor - an AgiRowCursor object that holds the data you want to use in the table model.
displayableColumns - an int array containing index values for properties in the AgiRowCursor object. These properties correspond to database columns.
editableColumns - an int array containing index values for properties in the AgiRowCursor object. These properties correspond to database columns.
columnNames - String array of column names
Usage:
Each index in the array enables a property in the table for the corresponding table column. Property indices begin with 0. The parameters work as follows:
  • If 'editableColumns' is not null, then the cells in those columns will be editable, and other cells are not editable.
  • If 'editableColumns' is null, then no cells will be editable.
  • If 'columnNames' is not null, then the getColumnName() method will return names from 'columnNames' array. Otherwise, the AgiRowCursor is used to obtain column names.

SilverStream
Application Server 3.5