docs: public void setReferenceRecord(Record record)
      {
          if (m_recordReference != record)
          {
              if (m_recordReference != null)
              { // Take behaviors off old references
                 // You only want to disconnect the referenced record (not free it).
                  if (this.getRecord() != null)
                  {
                      FreeOnFreeHandler freeListener = (FreeOnFreeHandler)this.getRecord().getListener(FreeOnFreeHandler.class);
                      while (freeListener != null)
                      {
                          if (freeListener.getDependentObject() == m_recordReference)
                          {
                              freeListener.setDependentObject(null);
                              this.getRecord().removeListener(freeListener, true);
                              break;
                          }
                          freeListener = (FreeOnFreeHandler)freeListener.getListener(FreeOnFreeHandler.class);
                      }
                  }
  
                  ClearFieldReferenceOnCloseHandler listener = (ClearFieldReferenceOnCloseHandler)m_recordReference.getListener(ClearFieldReferenceOnCloseHandler.class.getName());
                  while (listener != null)
                  {
                      if (listener.getField() == this)
                      {
                          Record recordTemp = m_recordReference;
                          m_recordReference = null; // Cancel echo
                          recordTemp.removeListener(listener, true);
                          listener = null;    // Got it!
                      }
                      else
                          listener = (ClearFieldReferenceOnCloseHandler)listener.getListener(ClearFieldReferenceOnCloseHandler.class.getName());
                  }
              }
              if (record != null)
              { // Make sure reference is cleared when record is discarded
                  record.addListener(new ClearFieldReferenceOnCloseHandler(this));
              }
              m_recordReference = record;
          }
      }