public void disconnectControls ( FieldList fieldList ) { if ( fieldList == null ) { // Disconnect controls from all fieldlists for ( int i = 0 ; ; i ++ ) { // Step 1 - Disconnect the controls from the fields fieldList = this . getFieldList ( i ) ; if ( fieldList == null ) break ; this . disconnectControls ( fieldList ) ; } } else { // Step 1 - Disconnect the controls from the fields for ( int iFieldSeq = 0 ; iFieldSeq < fieldList . getFieldCount ( ) ; iFieldSeq ++ ) { FieldInfo field = fieldList . getField ( iFieldSeq ) ; Component component = null ; int iIndex = 0 ; while ( ( component = ( Component ) field . getComponent ( iIndex ) ) != null ) { if ( ( component . getParent ( ) == null ) || ( this . isAncestorOf ( component ) ) ) { if ( component instanceof Freeable ) ( ( Freeable ) component ) . free ( ) ; field . removeComponent ( component ) ; // No need to change the index } else iIndex ++ ; // Skip this one } } } }
Go through all the fields in this record and remove all their components . Free the component if they are freeable .