public void setValueAt ( Object aValue , int iRowIndex , int iColumnIndex ) { try { this . updateIfNewRow ( iRowIndex ) ; // Update old if new row boolean bPhysicallyLockRecord = true ; // Fix this? if ( this . getFieldInfo ( iColumnIndex ) == null ) bPhysicallyLockRecord = false ; // No need to lock if this control isn't tied into a field. // Note: The record has to be locked in case there are any behaviors that change other fields and lock the record. // This code was originally designed to change the fields in the buffer, then update the record when the row changed // Unfortunately, if there was a listener that locked the record, the changes to that point would be lost since the record is not locked. FieldList fieldList = this . makeRowCurrent ( iRowIndex , bPhysicallyLockRecord ) ; boolean bFieldChanged = this . setColumnValue ( iColumnIndex , aValue , Constants . DISPLAY , Constants . SCREEN_MOVE ) ; // if (this.isRecordChanged()) if ( bFieldChanged ) { this . cacheCurrentLockedData ( iRowIndex , fieldList ) ; this . fireTableRowsUpdated ( iRowIndex , iRowIndex ) ; } int iRowCount = this . getRowCount ( false ) ; if ( ( this . isAppending ( ) ) && ( iRowIndex == m_iLastRecord + 1 ) // Changing a new last row && ( iRowCount == m_iLastRecord + 1 ) && ( m_iLastRecord != RECORD_UNKNOWN ) ) // Last row = new row { // Changing the last row (If changes, add a row) bFieldChanged = this . isRecordChanged ( ) ; if ( ( fieldList . getEditMode ( ) == Constants . EDIT_CURRENT ) || ( fieldList . getEditMode ( ) == Constants . EDIT_IN_PROGRESS ) ) { m_iLastRecord ++ ; // Special case (A listener possibly wrote and refreshed the record) bFieldChanged = true ; } if ( bFieldChanged ) { // Currently adding a new record to the end, so add a blank for a new next record this . setRowCount ( iRowCount + 1 ) ; // new EOF this . fireTableRowsInserted ( iRowCount + 1 , iRowCount + 1 ) ; } } if ( this . getSelectedRow ( ) != iRowIndex ) this . updateIfNewRow ( this . getSelectedRow ( ) ) ; // If no longer selected, update it! } catch ( Exception ex ) { ex . printStackTrace ( ) ; } }
Set the value at this location .