home *** CD-ROM | disk | FTP | other *** search
/ The Complete Idiot's Guide to Microsoft Excel 2010 / CIGExcel.iso / Videos / Flash / controller.swf / scripts / __Packages / mx / controls / treeclasses / TreeRow.as < prev   
Encoding:
Text File  |  2010-09-09  |  3.7 KB  |  120 lines

  1. class mx.controls.treeclasses.TreeRow extends mx.controls.listclasses.SelectableRow
  2. {
  3.    var node;
  4.    var owner;
  5.    var disclosure;
  6.    var nodeIcon;
  7.    var open;
  8.    var cell;
  9.    var item;
  10.    var rowIndex;
  11.    var __height;
  12.    var __width;
  13.    var indentAdjust = 3;
  14.    function TreeRow()
  15.    {
  16.       super();
  17.    }
  18.    function setValue(item, state)
  19.    {
  20.       this.node = item;
  21.       var _loc4_ = this.owner.getIsBranch(this.node);
  22.       super.setValue(this.node,state);
  23.       if(this.node == undefined)
  24.       {
  25.          this.disclosure._visible = this.nodeIcon._visible = false;
  26.          return undefined;
  27.       }
  28.       this.nodeIcon._visible = true;
  29.       this.open = this.owner.getIsOpen(this.node);
  30.       var _loc6_ = (this.owner.getNodeDepth(this.node) - 1) * this.getStyle("indentation");
  31.       var _loc5_ = this.owner.getStyle(!this.open ? "disclosureClosedIcon" : "disclosureOpenIcon");
  32.       this.disclosure = this.createObject(_loc5_,"disclosure",3);
  33.       this.disclosure.onPress = this.disclosurePress;
  34.       this.disclosure.useHandCursor = false;
  35.       this.disclosure._visible = _loc4_;
  36.       this.disclosure._x = _loc6_ + 4;
  37.       var _loc3_ = this.owner.nodeIcons[this.node.getID()][!this.open ? "iconID" : "iconID2"];
  38.       if(_loc3_ == undefined)
  39.       {
  40.          _loc3_ = this.owner.__iconFunction(this.node);
  41.       }
  42.       if(_loc4_)
  43.       {
  44.          if(_loc3_ == undefined)
  45.          {
  46.             _loc3_ = this.owner.getStyle(!this.open ? "folderClosedIcon" : "folderOpenIcon");
  47.          }
  48.       }
  49.       else
  50.       {
  51.          if(_loc3_ == undefined)
  52.          {
  53.             _loc3_ = this.node.attributes[this.owner.iconField];
  54.          }
  55.          if(_loc3_ == undefined)
  56.          {
  57.             _loc3_ = this.owner.getStyle("defaultLeafIcon");
  58.          }
  59.       }
  60.       this.nodeIcon.removeMovieClip();
  61.       this.nodeIcon = this.createObject(_loc3_,"nodeIcon",20);
  62.       this.nodeIcon._x = this.disclosure._x + this.disclosure._width + 2;
  63.       this.cell._x = this.nodeIcon._x + this.nodeIcon._width + 2;
  64.       this.size();
  65.    }
  66.    function getNormalColor()
  67.    {
  68.       this.node = this.item;
  69.       var _loc6_ = super.getNormalColor();
  70.       var _loc7_ = this.rowIndex + this.owner.__vPosition;
  71.       var _loc5_ = this.owner.getColorAt(_loc7_);
  72.       if(_loc5_ == undefined)
  73.       {
  74.          var _loc4_ = this.owner.getStyle("depthColors");
  75.          if(_loc4_ == undefined)
  76.          {
  77.             return _loc6_;
  78.          }
  79.          var _loc3_ = this.owner.getNodeDepth(this.node);
  80.          if(_loc3_ == undefined)
  81.          {
  82.             _loc3_ = 1;
  83.          }
  84.          _loc5_ = _loc4_[(_loc3_ - 1) % _loc4_.length];
  85.       }
  86.       return _loc5_;
  87.    }
  88.    function createChildren()
  89.    {
  90.       super.createChildren();
  91.       if(this.disclosure == undefined)
  92.       {
  93.          this.createObject("Disclosure","disclosure",3,{_visible:false});
  94.          this.disclosure.onPress = this.disclosurePress;
  95.          this.disclosure.useHandCursor = false;
  96.       }
  97.    }
  98.    function size()
  99.    {
  100.       super.size();
  101.       this.disclosure._y = (this.__height - this.disclosure._height) / 2;
  102.       this.nodeIcon._y = (this.height - this.nodeIcon._height) / 2;
  103.       this.cell.setSize(this.__width - this.cell._x,this.__height);
  104.    }
  105.    function disclosurePress()
  106.    {
  107.       var _loc3_ = this._parent;
  108.       var _loc2_ = _loc3_.owner;
  109.       if(_loc2_.isOpening || !_loc2_.enabled)
  110.       {
  111.          return undefined;
  112.       }
  113.       var _loc4_ = !_loc3_.open ? 0 : 90;
  114.       _loc3_.open = !this._parent.open;
  115.       _loc2_.pressFocus();
  116.       _loc2_.releaseFocus();
  117.       _loc2_.setIsOpen(_loc3_.node,_loc3_.open,true,true);
  118.    }
  119. }
  120.