public void addListener ( FieldListener listener , BaseField field ) { super . addListener ( listener , field ) ; if ( listener . getOwner ( ) . getRecord ( ) == this . getRecord ( ) ) // Only replicate listeners added to base. { Iterator < BaseTable > iterator = this . getTables ( ) ; while ( iterator . hasNext ( ) ) { BaseTable table = iterator . next ( ) ; if ( ( table != null ) && ( table != this . getNextTable ( ) ) ) { BaseField fldInTable = table . getRecord ( ) . getField ( field . getFieldName ( ) ) ; if ( fldInTable != null ) { FieldListener newBehavior = null ; // Clone the file behaviors try { newBehavior = ( FieldListener ) listener . clone ( fldInTable ) ; // Clone the file behaviors } catch ( CloneNotSupportedException ex ) { newBehavior = null ; } if ( newBehavior != null ) if ( newBehavior . getOwner ( ) == null ) // This should have been set, just being careful (ie., next line never called) fldInTable . addListener ( newBehavior ) ; // Add them to the new query } } } } }
Add a field listener to the chain . The listener must be cloned and added to all records on the list .