public void tableChanged(Table t, int start, int end, int col, int type) {
// must come from parent
if ( t != m_parent )
return;
CascadedRowManager rowman = (CascadedRowManager)m_rows;
// switch on the event type
switch ( type ) {
case EventConstants.UPDATE:
{
// do nothing if update on all columns, as this is only
// used to indicate a non-measurable update.
if ( col == EventConstants.ALL_COLUMNS ) {
break;
}
// process each update, check if filtered state changes
for ( int r=start, cr=-1; r<=end; ++r ) {
if ( (cr=rowman.getChildRow(r)) != -1 ) {
// the parent row has a corresponding row in this table
if ( m_rowFilter.getBoolean(m_parent.getTuple(r)) ) {
// row still passes the filter, check the column
int idx = getColumnNumber(m_parent.getColumnName(col));
if ( idx >= getLocalColumnCount() )
fireTableEvent(cr, cr, idx, EventConstants.UPDATE);
} else {
// row no longer passes the filter, remove it
removeCascadedRow(cr);
}
} else {
// does it now pass the filter due to the update?
if ( m_rowFilter.getBoolean(m_parent.getTuple(r)) ) {
if ( (cr=rowman.getChildRow(r)) < 0 )
addCascadedRow(r);
}
}
}
break;
}
case EventConstants.DELETE:
{
if ( col == EventConstants.ALL_COLUMNS ) {
// entire rows deleted
for ( int r=start, cr=-1; r<=end; ++r ) {
if ( (cr=rowman.getChildRow(r)) != -1 )
removeCascadedRow(cr);
}
} else {
// column deleted
filterColumns();
}
break;
}
case EventConstants.INSERT:
if ( col == EventConstants.ALL_COLUMNS ) {
// entire rows added
for ( int r=start; r<=end; ++r ) {
if ( m_rowFilter.getBoolean(m_parent.getTuple(r)) ) {
if ( rowman.getChildRow(r) < 0 )
addCascadedRow(r);
}
}
} else {
// column added