Sha256: 61c94eb8a5f3529b547e9cb86ce869041bcb4264e68d5dcaae65fc267c3212ce

Contents?: true

Size: 1.97 KB

Versions: 11

Compression:

Stored size: 1.97 KB

Contents

/*   RSence
 *   Copyright 2011 Riassence Inc.
 *   http://riassence.com/
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this software package. If not, contact licensing@riassence.com
 */

var
HValueAction = HClass.extend({
  constructor: function( _rect, _parent, _options ){
    this.parent = _parent;
    this.options = _options;
    if( _options.value ){
      this.value = _options.value;
    }
    if( _options.valueObj ){
      _options.valueObj.bind( this );
    }
    if( this.parent['addView'] instanceof Function ){
      this.viewId = this.parent.addView( this );
    }
    this.refresh();
  },
  remove: function(){
    if( this.parent ) {
      var _viewZIdx = this.parent.viewsZOrder.indexOf(this.viewId),
          _viewPIdx = this.parent.views.indexOf(this.viewId);
      this.parent.views.splice(_viewPIdx,1);
      HSystem.delView(this.viewId);
      this.parent.viewsZOrder.splice( _viewZIdx, 1 );
      var _sysUpdateZIndexOfChildrenBufferIndex = HSystem._updateZIndexOfChildrenBuffer.indexOf( this.viewId );
      if(_sysUpdateZIndexOfChildrenBufferIndex !== -1){
        HSystem._updateZIndexOfChildrenBuffer.splice( _sysUpdateZIndexOfChildrenBufferIndex, 1 );
      }
      this.parent  = null;
      this.parents = [];
    }
    return this;
  },
  die: function(){
    this.parent.removeView( this.viewId );
    if( this.valueObj ){
      this.valueObj.release( this );
    }
    this.value = null;
    this.viewId = null;
  },
  refresh: function(){
    if( this.options[ 'refreshAction' ] ){
      var
      _refreshAction = this.options.refreshAction;
      if( this.parent ){
        if( this.parent[_refreshAction] ){
          if( (this.parent[_refreshAction] instanceof Function) ){
            this.parent[_refreshAction]( this.value );
          }
          else {
            this.parent[_refreshAction] = this.value;
          }
        }
      }
    }
  },
  onIdle: function(){
    
  }
});

HValueAction.implement( HValueResponder );

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rsence-pre-2.2.0.30 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.29 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.28 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.27 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.26 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.25 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.24 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.23 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.22 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.21 js/foundation/control/valueaction/valueaction.js
rsence-pre-2.2.0.20 js/foundation/control/valueaction/valueaction.js