public void syncReference ( Record record ) { this . setReferenceRecord ( record ) ; BaseField recordKeyField = ( BaseField ) record . getCounterField ( ) ; if ( ( recordKeyField . isNull ( ) ) && ( ! this . isNull ( ) ) && ( ! record . isModified ( ) ) && ( record . getEditMode ( ) != DBConstants . EDIT_CURRENT ) && ( record . getEditMode ( ) != DBConstants . EDIT_IN_PROGRESS ) && ( ( record . getOpenMode ( ) & DBConstants . OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY ) == 0 ) ) { recordKeyField . moveFieldToThis ( this , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; // Start with this field's value if you arn't going to mess up the record recordKeyField . setModified ( false ) ; } else this . setReference ( record , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; // If the screen field is changed, make sure the passed in header record's key field is changed to match. MoveOnChangeHandler listener = ( MoveOnChangeHandler ) this . getListener ( MoveOnChangeHandler . class . getName ( ) ) ; if ( ( listener == null ) || ( listener . getDestField ( ) != recordKeyField ) ) this . addListener ( new MoveOnChangeHandler ( recordKeyField , null ) ) ; // If the record is externally selected, sync the record's key with the screenfield MoveOnValidHandler listener2 = ( MoveOnValidHandler ) record . getListener ( MoveOnValidHandler . class . getName ( ) ) ; if ( ( listener2 == null ) || ( listener2 . getSourceField ( ) != recordKeyField ) ) record . addListener ( new MoveOnValidHandler ( this , recordKeyField ) ) ; MainReadOnlyHandler listener3 = ( MainReadOnlyHandler ) recordKeyField . getListener ( MainReadOnlyHandler . class . getName ( ) ) ; if ( listener3 == null ) recordKeyField . addListener ( new MainReadOnlyHandler ( null ) ) ; }
Synchronize this refernce field with this record . Adds the behaviors to sync this field and the record . Used for popup screenfields where the referencerecord has a detail to display on change .