CC.extendx(CTab.prototype, CContainerBase);CC.extend(CTab.prototype,  {  type: 'CTab',  //默认TabItem长度.
  defItemLen: 130,  //该面板存放当前显示的TabItem中的面板,TabItem中的面板将放入该面板内,即Tab显示主体.
  ctxPanel: null,  selected: null,  initialize: function(opt) {
    this._super(opt); if (!this.ctxPanel) {
      this.ctxPanel = CC. $C('DIV');
    }    //重写容器类的add方法.
    this.override('add', function(it) {
      //selected event.
      it.view.onclick = this.select.bind(this, it);
      //close event.
      it.view.ondblclick = this.show.bind(this, it, false); it.setOnclose(this.show.bind(this, it, false)); this._ajust(); it.parent = this;
    }
    );
  }
  ,  //设置Tab控件显示主板面板.
  setCtxPanel: function(v) {
    this.ctxPanel = v;
  }
  ,  _ajust: function() {
    var sty = this.view.style; var w = this.view.clientWidth; var ch = this.children; var tcnt = this.children.length; var vcnt = 0; for (var i = 0; i < tcnt; i++) {
      if (ch[i].isVisible()) {
        vcnt++
      }
    }    var perw = Math.floor(w / vcnt);    if (perw > this.defItemLen) {
      perw = this.defItemLen;
    }    for (var i = 0; i < tcnt; i++) {
      ch[i].setWidth(perw);
    }
  }
  ,  //是否显示指定的TabItem,
  //参数a可为TabItem实例也可为TabItem的id,b为true或false.
  show: function(a, b) {
    //only one,can't set it.
    if (!b && this.getDisc() == 1) {
      return ;
    }
    a = this. $(a);    //Cann't change this attribute.
    if (!a.closeable && !b) {
      return false;
    }    var isv = a.isVisible();    if (isv != b) {
      this._ajust();
    }    a.setVisible(b);    if (!b && this.selected == a) {
      var idx = this.indexOf(a); var tmp = idx - 1; var chs = this.children;
      while (tmp >= 0 && !chs[tmp].isVisible()) {
        tmp--;
      }
      if (tmp >= 0) {
        this.select(chs[tmp]); 
        if(!b){
           this.remove(a);
        }
        return ;
        
      }      tmp = chs.length; idx += 1;
      while (idx < tmp && !chs[idx].isVisible()) {
        idx++;
      }
      if (idx < tmp) {
        this.select(chs[idx]);
      }
    }
  }
  ,  //选择某个TabItem,
  //参数a可为TabItem实例也可为id.
  select: function(a) {    if (a == '' || a == null) {
      var sel = this.selected; if (sel) {
        sel.setViewAttr('className', ''); this.ctxPanel.removeChild(sel.panel);
      }
      this.selected = ''; return ;
    }    if (a == this.selected) {
      return ;
    }    a = this.get(a); if (a == null) {
      return ;
    }    this.show(a, true);    var sel = this.selected; if (sel) {
      sel.setViewAttr('className', ''); this.ctxPanel.removeChild(sel.panel);
    }    this.selected = a; a.setViewAttr('className', 'on'); this.ctxPanel.appendChild(a.panel); if (this.onselect) {
      this.onselect(a);
    }
  }
  ,
  //返回显示的TabItem个数.
  getDisc: function() {
    var cnt = 0; var chs = this.children; for (var i = 0, len = chs.length; i < len; i++) {
      if (chs[i].isVisible()) {
        cnt++;
      }
    }
    return cnt;
  }
});谁能解释下上面的代码?看不懂,望赐教!