ilog.ds.adapter
Class IlAbstractJTableAdapter

java.lang.Object
  |
  +--ilog.ds.adapter.IlAbstractAdapter
        |
        +--ilog.ds.adapter.IlAbstractJTableAdapter
All Implemented Interfaces:
BatchListener, DataSourceListener, EventListener, IlFreezableAdapter, TableDSListener, TableModelListener
Direct Known Subclasses:
IlDefaultJTableAdapter

public abstract class IlAbstractJTableAdapter
extends IlAbstractAdapter
implements TableDSListener, TableModelListener

This class adapts the events from the IlTableDataSource to a Swing TableModel. It does not implement how cells values are created or updated, that is, how the properties from the data source are mapped to the Object to be put in the cells. This class supports the mapping between the data source objects and the model objects. It stores the datasource reference.

See Also:
IlTableDataSource, TableModel

Field Summary
protected  IlTableColumnInfo[] _model
           
protected  Vector _number2row
           
protected  ilog.util.IlObj2IntHashMap _row2number
           
protected  IlTableDataSource _tds
           
protected  IlTableDataSourceEditor _tdse
           
protected  TableModel _tm
           
 
Fields inherited from class ilog.ds.adapter.IlAbstractAdapter
_dispatchListeners, _events, _frozenEvents, _inBatchedEvents, _inTransaction, _isFrozen, _syncStrategy
 
Constructor Summary
IlAbstractJTableAdapter()
           
 
Method Summary
 void columnChange(ColumnEvent evt)
           
 void dataSourceChange(DataSourceEvent evt)
           
protected  void dispatchBatchedEvent(EventObject event)
           
 Object getDSRow(int rowNumber)
           
 TableModel getModel()
           
 int getRowNumber(Object dsRow)
           
protected  Object getSynchronizationObject()
           
 IlTableColumnInfo getTableColumnInfo(int column)
           
 int getTableColumnInfoCount()
           
 IlTableDataSource getTableDataSource()
           
 IlTableDataSourceEditor getTableDataSourceEditor()
           
protected abstract  void internalColumnChange(ColumnEvent e)
           
protected abstract  void internalModelCreated(TableModelEvent e)
           
protected abstract  void internalRowAdded(RowEvent evt)
           
protected abstract  void internalRowRemoved(RowEvent evt)
           
protected abstract  void internalRowUpdated(RowEvent evt)
           
 void modelCreated(TableModelEvent evt)
           
 void rowChange(RowEvent evt)
           
 void setModel(TableModel dtm)
           
protected  void setRowData(List rowData, IlTableCellInfo info)
          Sets a cell value in the row data from a IlTableCellInfo.
 void setTableDataSource(IlTableDataSource tds)
           
 void setTableDataSourceEditor(IlTableDataSourceEditor tdse)
           
 void tableChanged(TableModelEvent evt)
           
protected abstract  void updateCell(Object row, int colNumber, Object value)
          Updates a cell in the data source
protected  void updateCells(Object row, IlTableCellInfo[] cellInfos)
          Updates some cells in the data source
 
Methods inherited from class ilog.ds.adapter.IlAbstractAdapter
addDispatchListener, addDSEvent, clearDSEvents, dispatchBatchedEvents, endBatch, firePostDispatchBatchedEventsEvent, firePreDispatchBatchedEventsEvent, GetColor, getSynchronizationStrategy, internalDataSourceChange, isFrozen, isInBatchedEvents, isInTransaction, postDispatchBatchedEvents, preDispatchBatchedEvents, removeDispatchListener, setFrozen, setSynchronizationStrategy, startBatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_model

protected IlTableColumnInfo[] _model

_tds

protected IlTableDataSource _tds

_tdse

protected IlTableDataSourceEditor _tdse

_tm

protected TableModel _tm

_row2number

protected ilog.util.IlObj2IntHashMap _row2number

_number2row

protected Vector _number2row
Constructor Detail

IlAbstractJTableAdapter

public IlAbstractJTableAdapter()
Method Detail

getSynchronizationObject

protected Object getSynchronizationObject()
Description copied from class: IlAbstractAdapter
Gets the object to synchronize in the synchronization strategy used by this adapter.
Overrides:
getSynchronizationObject in class IlAbstractAdapter
Following copied from class: ilog.ds.adapter.IlAbstractAdapter
Returns:
this by default, the data model generally (in subsclasses)

getModel

public TableModel getModel()

getTableColumnInfo

public IlTableColumnInfo getTableColumnInfo(int column)

getTableColumnInfoCount

public int getTableColumnInfoCount()

getRowNumber

public int getRowNumber(Object dsRow)

getDSRow

public Object getDSRow(int rowNumber)

getTableDataSource

public IlTableDataSource getTableDataSource()

getTableDataSourceEditor

public IlTableDataSourceEditor getTableDataSourceEditor()

updateCell

protected abstract void updateCell(Object row,
                                   int colNumber,
                                   Object value)
Updates a cell in the data source
Parameters:
row - The row to update in the data source
colNumber - The number of the column to update in the data source
value - The new value to set in the data source

updateCells

protected void updateCells(Object row,
                           IlTableCellInfo[] cellInfos)
Updates some cells in the data source
Parameters:
row - The row to update in the data source
colNumber - The number of the column to update in the data source

setRowData

protected void setRowData(List rowData,
                          IlTableCellInfo info)
Sets a cell value in the row data from a IlTableCellInfo. This method is called when an update comes from the data source. Its default implementation is:
rowData.set(info.getColNumber(), info.getValue());

dataSourceChange

public void dataSourceChange(DataSourceEvent evt)
Description copied from interface: DataSourceListener
This method is invoked when the data source object properties are updated .
Following copied from interface: ilog.ds.DataSourceListener
Parameters:
e - The event
See Also:
DataSourceEvent

modelCreated

public void modelCreated(TableModelEvent evt)
Description copied from interface: TableDSListener
The model of the columns is created.
Specified by:
modelCreated in interface TableDSListener
Following copied from interface: ilog.ds.TableDSListener
Parameters:
e - The corresponding event.
See Also:
TableModelEvent, IlTableColumnInfo

columnChange

public void columnChange(ColumnEvent evt)
Description copied from interface: TableDSListener
A column property is changed.
Specified by:
columnChange in interface TableDSListener
Following copied from interface: ilog.ds.TableDSListener
Parameters:
e - The corresponding event.
See Also:
ColumnEvent

rowChange

public void rowChange(RowEvent evt)
Description copied from interface: TableDSListener
A row is added, updated, or removed.
Specified by:
rowChange in interface TableDSListener
Following copied from interface: ilog.ds.TableDSListener
Parameters:
e - The corresponding event.
See Also:
RowEvent

internalColumnChange

protected abstract void internalColumnChange(ColumnEvent e)

internalModelCreated

protected abstract void internalModelCreated(TableModelEvent e)

internalRowAdded

protected abstract void internalRowAdded(RowEvent evt)

internalRowRemoved

protected abstract void internalRowRemoved(RowEvent evt)

internalRowUpdated

protected abstract void internalRowUpdated(RowEvent evt)

setModel

public void setModel(TableModel dtm)

setTableDataSource

public void setTableDataSource(IlTableDataSource tds)

setTableDataSourceEditor

public void setTableDataSourceEditor(IlTableDataSourceEditor tdse)

dispatchBatchedEvent

protected void dispatchBatchedEvent(EventObject event)
Overrides:
dispatchBatchedEvent in class IlAbstractAdapter

tableChanged

public void tableChanged(TableModelEvent evt)
Specified by:
tableChanged in interface TableModelListener