public boolean moveFields ( Record recSource , ResourceBundle resource , boolean bDisplayOption , int iMoveMode , boolean bAllowFieldChange , boolean bOnlyModifiedFields , boolean bMoveModifiedState , boolean syncSelection ) { boolean bFieldsMoved = false ; for ( int iFieldSeq = 0 ; iFieldSeq < this . getFieldCount ( ) ; iFieldSeq ++ ) { BaseField fldDest = this . getField ( iFieldSeq ) ; BaseField fldSource = null ; try { if ( resource == Record . MOVE_BY_NAME ) { String strSourceField = fldDest . getFieldName ( ) ; fldSource = recSource . getField ( strSourceField ) ; } else if ( resource != null ) { String strSourceField = resource . getString ( fldDest . getFieldName ( ) ) ; // Lookup source field name from dest if ( ( strSourceField != null ) && ( strSourceField . length ( ) > 0 ) ) fldSource = recSource . getField ( strSourceField ) ; } else // if (resource == null) { fldSource = recSource . getField ( iFieldSeq ) ; } } catch ( MissingResourceException ex ) { fldSource = null ; } if ( fldSource != null ) { if ( ( ! bOnlyModifiedFields ) || ( fldSource . isModified ( ) ) ) { boolean [ ] rgbEnabled = null ; if ( bAllowFieldChange == false ) // Don't enable a disabled field listener rgbEnabled = fldDest . setEnableListeners ( bAllowFieldChange ) ; // Don't call the HandleFieldChanged beh until ALL inited! FieldDataScratchHandler listenerScratchData = null ; if ( ( bAllowFieldChange == false ) && ( bMoveModifiedState ) ) if ( iMoveMode == DBConstants . READ_MOVE ) // Very obscure - Make sure this fake read move does not change the scratch area if ( fldDest . getNextValidListener ( iMoveMode ) instanceof FieldDataScratchHandler ) // Always enable would have to be true since listeners have been disabled ( listenerScratchData = ( ( FieldDataScratchHandler ) fldDest . getNextValidListener ( iMoveMode ) ) ) . setAlwaysEnabled ( false ) ; fldDest . moveFieldToThis ( fldSource , bDisplayOption , iMoveMode ) ; if ( listenerScratchData != null ) listenerScratchData . setAlwaysEnabled ( true ) ; if ( rgbEnabled != null ) fldDest . setEnableListeners ( rgbEnabled ) ; if ( bAllowFieldChange == false ) fldDest . setModified ( false ) ; // At this point, no changes have been done bFieldsMoved = true ; } if ( ( bAllowFieldChange ) || ( bMoveModifiedState ) ) fldDest . setModified ( fldSource . isModified ( ) ) ; // If you allow field change set if source is modified. if ( syncSelection ) fldDest . setSelected ( fldSource . isSelected ( ) ) ; } } return bFieldsMoved ; }
Copy all the fields from one record to another .