src/basis/dom/wrapper.js
function(name, satellite, autoSet){
      var oldSatellite = this.satellite[name] || null;
      var auto = this.satellite[AUTO];
      var autoConfig = auto && auto[name];
      var preserveAuto = autoSet && autoConfig;

      if (preserveAuto)
      {
        satellite = autoConfig.instance;
        if (satellite && autoConfig.config.instance)
          delete autoConfig.config.instance.setOwner;
      }
      else
      {
        satellite = processSatelliteConfig(satellite);

        if (satellite && satellite.owner === this && auto && satellite.ownerSatelliteName && auto[satellite.ownerSatelliteName])
        {
          /** @cut */ basis.dev.warn(namespace + ': auto-create satellite can\'t change name inside owner');
          return;
        }

        // if setSatellite was called not on auto-satellite update
        if (autoConfig)
        {
          // remove old auto-config
          delete auto[name];

          if (autoConfig.config.instance)
            autoConfig.config.instance.removeHandler(AUTO_SATELLITE_INSTANCE_HANDLER, autoConfig);

          if (autoConfig.config.handler)
            this.removeHandler(autoConfig.config.handler, autoConfig);
        }
      }

      if (oldSatellite !== satellite)
      {
        var satelliteListen = this.listen.satellite;
        var satellitePersonalListen = this.listen['satellite:' + name];
        var destroySatellite;

        if (oldSatellite)
        {
          // unlink old satellite
          delete this.satellite[name];
          var oldSatelliteName = oldSatellite.ownerSatelliteName;
          if (oldSatelliteName != null)
          {
            oldSatellite.ownerSatelliteName = null;
            oldSatellite.emit_ownerSatelliteNameChanged(oldSatelliteName);
          }

          if (autoConfig && oldSatellite.destroy === warnOnAutoSatelliteDestoy)
          {
            destroySatellite = oldSatellite;
          }
          else
          {
            // regular satellite
            if (satelliteListen)
              oldSatellite.removeHandler(satelliteListen, this);
            if (satellitePersonalListen)
              oldSatellite.removeHandler(satellitePersonalListen, this);

            oldSatellite.setOwner(null);
          }

          if (preserveAuto && !satellite && autoConfig.config.instance)
            autoConfig.config.instance.setOwner = warnOnAutoSatelliteOwnerChange;
        }

        if (satellite)
        {
          // check value is auto-config
          if (satellite instanceof AbstractNode == false)
          {
            // auto-create satellite
            var autoConfig = {
              owner: this,
              name: name,
              config: satellite,
              factoryType: null,
              factory: null,
              instance: null,
              instanceRA_: null,
              existsRA_: null
            };

            // auto-create satellite
            if (satellite.handler)
              this.addHandler(satellite.handler, autoConfig);

            if (satellite.instance)
            {
              satellite.instance.addHandler(AUTO_SATELLITE_INSTANCE_HANDLER, autoConfig);
              satellite.instance.setOwner = warnOnAutoSatelliteOwnerChange;
            }

            // create auto
            if (!auto)
            {
              if (this.satellite === NULL_SATELLITE)
                this.satellite = {};
              auto = this.satellite[AUTO] = {};
            }

            auto[name] = autoConfig;
            SATELLITE_UPDATE.call(autoConfig, this);

            if (!autoConfig.instance && oldSatellite)
              this.emit_satelliteChanged(name, oldSatellite);

            if (destroySatellite)
            {
              // auto create satellite must be destroyed
              delete destroySatellite.destroy;
              destroySatellite.destroy();
            }

            return;
          }

          // link new satellite
          if (satellite.owner !== this)
          {
            if (autoConfig && autoConfig.config.delegate)
            {
              // ignore autoDelegate if satellite is auto-satellite and config has delegate setting
              var autoDelegate = satellite.autoDelegate;
              satellite.autoDelegate = false;
              satellite.setOwner(this);
              satellite.autoDelegate = autoDelegate;
            }
            else
              satellite.setOwner(this);

            // reset satellite if owner was not set
            if (satellite.owner !== this)
            {
              this.setSatellite(name, null);
              return;
            }

            if (satelliteListen)
              satellite.addHandler(satelliteListen, this);
            if (satellitePersonalListen)
              satellite.addHandler(satellitePersonalListen, this);
          }
          else
          {
            // move satellite inside owner
            if (satellite.ownerSatelliteName)
            {
              delete this.satellite[satellite.ownerSatelliteName];
              this.emit_satelliteChanged(satellite.ownerSatelliteName, satellite);
            }
          }

          if (this.satellite == NULL_SATELLITE)
            this.satellite = {};

          this.satellite[name] = satellite;
          var oldSatelliteName = satellite.ownerSatelliteName;
          if (oldSatelliteName != name)
          {
            satellite.ownerSatelliteName = name;
            satellite.emit_ownerSatelliteNameChanged(oldSatelliteName);
          }
        }

        this.emit_satelliteChanged(name, oldSatellite);

        if (destroySatellite)
        {
          // auto create satellite must be destroyed
          delete destroySatellite.destroy;
          destroySatellite.destroy();
        }
      }
    }
function(name, satellite, autoSet){
      var oldSatellite = this.satellite[name] || null;
      var auto = this.satellite[AUTO];
      var autoConfig = auto && auto[name];
      var preserveAuto = autoSet && autoConfig;

      if (preserveAuto)
      {
        satellite = autoConfig.instance;
        if (satellite && autoConfig.config.instance)
          delete autoConfig.config.instance.setOwner;
      }
      else
      {
        satellite = processSatelliteConfig(satellite);

        if (satellite && satellite.owner === this && auto && satellite.ownerSatelliteName && auto[satellite.ownerSatelliteName])
        {
          /** @cut */ basis.dev.warn(namespace + ': auto-create satellite can\'t change name inside owner');
          return;
        }

        // if setSatellite was called not on auto-satellite update
        if (autoConfig)
        {
          // remove old auto-config
          delete auto[name];

          if (autoConfig.config.instance)
            autoConfig.config.instance.removeHandler(AUTO_SATELLITE_INSTANCE_HANDLER, autoConfig);

          if (autoConfig.config.handler)
            this.removeHandler(autoConfig.config.handler, autoConfig);
        }
      }

      if (oldSatellite !== satellite)
      {
        var satelliteListen = this.listen.satellite;
        var satellitePersonalListen = this.listen['satellite:' + name];
        var destroySatellite;

        if (oldSatellite)
        {
          // unlink old satellite
          delete this.satellite[name];
          var oldSatelliteName = oldSatellite.ownerSatelliteName;
          if (oldSatelliteName != null)
          {
            oldSatellite.ownerSatelliteName = null;
            oldSatellite.emit_ownerSatelliteNameChanged(oldSatelliteName);
          }

          if (autoConfig && oldSatellite.destroy === warnOnAutoSatelliteDestoy)
          {
            destroySatellite = oldSatellite;
          }
          else
          {
            // regular satellite
            if (satelliteListen)
              oldSatellite.removeHandler(satelliteListen, this);
            if (satellitePersonalListen)
              oldSatellite.removeHandler(satellitePersonalListen, this);

            oldSatellite.setOwner(null);
          }

          if (preserveAuto && !satellite && autoConfig.config.instance)
            autoConfig.config.instance.setOwner = warnOnAutoSatelliteOwnerChange;
        }

        if (satellite)
        {
          // check value is auto-config
          if (satellite instanceof AbstractNode == false)
          {
            // auto-create satellite
            var autoConfig = {
              owner: this,
              name: name,
              config: satellite,
              factoryType: null,
              factory: null,
              instance: null,
              instanceRA_: null,
              existsRA_: null
            };

            // auto-create satellite
            if (satellite.handler)
              this.addHandler(satellite.handler, autoConfig);

            if (satellite.instance)
            {
              satellite.instance.addHandler(AUTO_SATELLITE_INSTANCE_HANDLER, autoConfig);
              satellite.instance.setOwner = warnOnAutoSatelliteOwnerChange;
            }

            // create auto
            if (!auto)
            {
              if (this.satellite === NULL_SATELLITE)
                this.satellite = {};
              auto = this.satellite[AUTO] = {};
            }

            auto[name] = autoConfig;
            SATELLITE_UPDATE.call(autoConfig, this);

            if (!autoConfig.instance && oldSatellite)
              this.emit_satelliteChanged(name, oldSatellite);

            if (destroySatellite)
            {
              // auto create satellite must be destroyed
              delete destroySatellite.destroy;
              destroySatellite.destroy();
            }

            return;
          }

          // link new satellite
          if (satellite.owner !== this)
          {
            if (autoConfig && autoConfig.config.delegate)
            {
              // ignore autoDelegate if satellite is auto-satellite and config has delegate setting
              var autoDelegate = satellite.autoDelegate;
              satellite.autoDelegate = false;
              satellite.setOwner(this);
              satellite.autoDelegate = autoDelegate;
            }
            else
              satellite.setOwner(this);

            // reset satellite if owner was not set
            if (satellite.owner !== this)
            {
              this.setSatellite(name, null);
              return;
            }

            if (satelliteListen)
              satellite.addHandler(satelliteListen, this);
            if (satellitePersonalListen)
              satellite.addHandler(satellitePersonalListen, this);
          }
          else
          {
            // move satellite inside owner
            if (satellite.ownerSatelliteName)
            {
              delete this.satellite[satellite.ownerSatelliteName];
              this.emit_satelliteChanged(satellite.ownerSatelliteName, satellite);
            }
          }

          if (this.satellite == NULL_SATELLITE)
            this.satellite = {};

          this.satellite[name] = satellite;
          var oldSatelliteName = satellite.ownerSatelliteName;
          if (oldSatelliteName != name)
          {
            satellite.ownerSatelliteName = name;
            satellite.emit_ownerSatelliteNameChanged(oldSatelliteName);
          }
        }

        this.emit_satelliteChanged(name, oldSatellite);

        if (destroySatellite)
        {
          // auto create satellite must be destroyed
          delete destroySatellite.destroy;
          destroySatellite.destroy();
        }
      }
    }
function ( name , satellite , autoSet ) { var oldSatellite = this . satellite [ name ] || null ; var auto = this . satellite [ AUTO ] ; var autoConfig = auto && auto [ name ] ; var preserveAuto = autoSet && autoConfig ; if ( preserveAuto ) { satellite = autoConfig . instance ; if ( satellite && autoConfig . config . instance ) delete autoConfig . config . instance . setOwner ; } else { satellite = processSatelliteConfig ( satellite ) ; if ( satellite && satellite . owner === this && auto && satellite . ownerSatelliteName && auto [ satellite . ownerSatelliteName ] ) { /** @cut */ basis . dev . warn ( namespace + ': auto-create satellite can\'t change name inside owner' ) ; return ; } // if setSatellite was called not on auto-satellite update if ( autoConfig ) { // remove old auto-config delete auto [ name ] ; if ( autoConfig . config . instance ) autoConfig . config . instance . removeHandler ( AUTO_SATELLITE_INSTANCE_HANDLER , autoConfig ) ; if ( autoConfig . config . handler ) this . removeHandler ( autoConfig . config . handler , autoConfig ) ; } } if ( oldSatellite !== satellite ) { var satelliteListen = this . listen . satellite ; var satellitePersonalListen = this . listen [ 'satellite:' + name ] ; var destroySatellite ; if ( oldSatellite ) { // unlink old satellite delete this . satellite [ name ] ; var oldSatelliteName = oldSatellite . ownerSatelliteName ; if ( oldSatelliteName != null ) { oldSatellite . ownerSatelliteName = null ; oldSatellite . emit_ownerSatelliteNameChanged ( oldSatelliteName ) ; } if ( autoConfig && oldSatellite . destroy === warnOnAutoSatelliteDestoy ) { destroySatellite = oldSatellite ; } else { // regular satellite if ( satelliteListen ) oldSatellite . removeHandler ( satelliteListen , this ) ; if ( satellitePersonalListen ) oldSatellite . removeHandler ( satellitePersonalListen , this ) ; oldSatellite . setOwner ( null ) ; } if ( preserveAuto && ! satellite && autoConfig . config . instance ) autoConfig . config . instance . setOwner = warnOnAutoSatelliteOwnerChange ; } if ( satellite ) { // check value is auto-config if ( satellite instanceof AbstractNode == false ) { // auto-create satellite var autoConfig = { owner : this , name : name , config : satellite , factoryType : null , factory : null , instance : null , instanceRA_ : null , existsRA_ : null } ; // auto-create satellite if ( satellite . handler ) this . addHandler ( satellite . handler , autoConfig ) ; if ( satellite . instance ) { satellite . instance . addHandler ( AUTO_SATELLITE_INSTANCE_HANDLER , autoConfig ) ; satellite . instance . setOwner = warnOnAutoSatelliteOwnerChange ; } // create auto if ( ! auto ) { if ( this . satellite === NULL_SATELLITE ) this . satellite = { } ; auto = this . satellite [ AUTO ] = { } ; } auto [ name ] = autoConfig ; SATELLITE_UPDATE . call ( autoConfig , this ) ; if ( ! autoConfig . instance && oldSatellite ) this . emit_satelliteChanged ( name , oldSatellite ) ; if ( destroySatellite ) { // auto create satellite must be destroyed delete destroySatellite . destroy ; destroySatellite . destroy ( ) ; } return ; } // link new satellite if ( satellite . owner !== this ) { if ( autoConfig && autoConfig . config . delegate ) { // ignore autoDelegate if satellite is auto-satellite and config has delegate setting var autoDelegate = satellite . autoDelegate ; satellite . autoDelegate = false ; satellite . setOwner ( this ) ; satellite . autoDelegate = autoDelegate ; } else satellite . setOwner ( this ) ; // reset satellite if owner was not set if ( satellite . owner !== this ) { this . setSatellite ( name , null ) ; return ; } if ( satelliteListen ) satellite . addHandler ( satelliteListen , this ) ; if ( satellitePersonalListen ) satellite . addHandler ( satellitePersonalListen , this ) ; } else { // move satellite inside owner if ( satellite . ownerSatelliteName ) { delete this . satellite [ satellite . ownerSatelliteName ] ; this . emit_satelliteChanged ( satellite . ownerSatelliteName , satellite ) ; } } if ( this . satellite == NULL_SATELLITE ) this . satellite = { } ; this . satellite [ name ] = satellite ; var oldSatelliteName = satellite . ownerSatelliteName ; if ( oldSatelliteName != name ) { satellite . ownerSatelliteName = name ; satellite . emit_ownerSatelliteNameChanged ( oldSatelliteName ) ; } } this . emit_satelliteChanged ( name , oldSatellite ) ; if ( destroySatellite ) { // auto create satellite must be destroyed delete destroySatellite . destroy ; destroySatellite . destroy ( ) ; } } }
Set replace satellite with defined name for new one.
@param {string} name Satellite name.
@param {basis.data.Object} satellite New satellite node.
@param {boolean} autoSet Method invoked by auto-create
Set replace satellite with defined name for new one .