home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 136 / MOBICLIC136.ISO / pc / DATA / HOTE / libs / amfphp / amfphp.swf / scripts / __Packages / mx / remoting / DataGlue.as < prev    next >
Text File  |  2011-07-20  |  3KB  |  127 lines

  1. class mx.remoting.DataGlue extends Object
  2. {
  3.    static var version = "1.2.0.124";
  4.    function DataGlue(dp)
  5.    {
  6.       super();
  7.       this.__dataProv = dp;
  8.    }
  9.    function get dataProvider()
  10.    {
  11.       return this.__dataProv;
  12.    }
  13.    function get labelString()
  14.    {
  15.       return this.__labelStr;
  16.    }
  17.    function set labelString(val)
  18.    {
  19.       this.__labelStr = val;
  20.    }
  21.    function get dataString()
  22.    {
  23.       return this.__dataStr;
  24.    }
  25.    function set dataString(val)
  26.    {
  27.       this.__dataStr = val;
  28.    }
  29.    static function bindFormatStrings(dataConsumer, dp, labelStr, dataStr)
  30.    {
  31.       var _loc1_ = new mx.remoting.DataGlue(dp);
  32.       _loc1_.__set__labelString(labelStr);
  33.       _loc1_.__set__dataString(dataStr);
  34.       _loc1_.getItemAt = mx.remoting.DataGlue.prototype.getItemAt_FormatString;
  35.       dataConsumer.dataProvider = _loc1_;
  36.    }
  37.    static function bindFormatFunction(dataConsumer, dp, formatFunc)
  38.    {
  39.       var _loc1_ = new mx.remoting.DataGlue(dp);
  40.       _loc1_.formatFunction = formatFunc;
  41.       _loc1_.getItemAt = mx.remoting.DataGlue.prototype.getItemAt_FormatFunction;
  42.       dataConsumer.setDataProvider(_loc1_);
  43.    }
  44.    function addEventListener(eventName, listener)
  45.    {
  46.       this.dataProvider.addEventListener(eventName,listener);
  47.    }
  48.    function get length()
  49.    {
  50.       return this.getLength();
  51.    }
  52.    function getLength()
  53.    {
  54.       return this.dataProvider.length;
  55.    }
  56.    function format(formatString, item)
  57.    {
  58.       var _loc3_ = formatString.split("#");
  59.       var result = "";
  60.       var tlen = _loc3_.length;
  61.       var _loc2_ = undefined;
  62.       var _loc1_ = 0;
  63.       while(_loc1_ < tlen)
  64.       {
  65.          result += _loc3_[_loc1_];
  66.          _loc2_ = _loc3_[_loc1_ + 1];
  67.          if(_loc2_ != undefined)
  68.          {
  69.             result += item[_loc2_];
  70.          }
  71.          _loc1_ += 2;
  72.       }
  73.       return result;
  74.    }
  75.    function getItemAt_FormatString(index)
  76.    {
  77.       var _loc2_ = this;
  78.       var _loc1_ = _loc2_.dataProvider.getItemAt(index);
  79.       if(_loc1_ == "in progress" || _loc1_ == undefined)
  80.       {
  81.          return _loc1_;
  82.       }
  83.       return {label:_loc2_.format(_loc2_.__get__labelString(),_loc1_),data:(_loc2_.__get__dataString() != null ? _loc2_.format(_loc2_.__get__dataString(),_loc1_) : _loc1_)};
  84.    }
  85.    function getItemAt_FormatFunction(index)
  86.    {
  87.       var _loc1_ = this.dataProvider.getItemAt(index);
  88.       if(_loc1_ == "in progress" || _loc1_ == undefined)
  89.       {
  90.          return _loc1_;
  91.       }
  92.       return this.formatFunction(_loc1_);
  93.    }
  94.    function getItemID(index)
  95.    {
  96.       return this.dataProvider.getItemID(index);
  97.    }
  98.    function addItemAt(index, value)
  99.    {
  100.       this.dataProvider.addItemAt(index,value);
  101.    }
  102.    function addItem(value)
  103.    {
  104.       this.dataProvider.addItem(value);
  105.    }
  106.    function removeItemAt(index)
  107.    {
  108.       this.dataProvider.removeItemAt(index);
  109.    }
  110.    function removeAll()
  111.    {
  112.       this.dataProvider.removeAll();
  113.    }
  114.    function replaceItemAt(index, itemObj)
  115.    {
  116.       this.dataProvider.replaceItemAt(index,itemObj);
  117.    }
  118.    function sortItemsBy(fieldNames, optionFlags)
  119.    {
  120.       this.dataProvider.sortItemsBy(fieldNames,optionFlags);
  121.    }
  122.    function sortItems(compareFunc, optionFlags)
  123.    {
  124.       this.dataProvider.sortItems(compareFunc,optionFlags);
  125.    }
  126. }
  127.