home *** CD-ROM | disk | FTP | other *** search
/ One Click 5 / ONCE005.iso / Interface / it.dig / scripts / __Packages / mx / data / components / datasetclasses / DeltaImpl.as < prev    next >
Encoding:
Text File  |  2006-06-12  |  2.7 KB  |  110 lines

  1. class mx.data.components.datasetclasses.DeltaImpl extends Object implements mx.data.components.datasetclasses.Delta
  2. {
  3.    var _deltaItems;
  4.    var _id;
  5.    var _source;
  6.    var _op;
  7.    var _message;
  8.    var _accessCl;
  9.    var _owner;
  10.    function DeltaImpl(id, curSrc, op, msg, acl)
  11.    {
  12.       super();
  13.       this._deltaItems = new Array();
  14.       this._id = id;
  15.       this._source = curSrc;
  16.       this._op = op;
  17.       this._message = msg != undefined ? msg : "";
  18.       this._accessCl = acl != undefined ? acl : false;
  19.    }
  20.    function addDeltaItem(item)
  21.    {
  22.       var _loc2_ = this.getItemIndexByName(item.name);
  23.       if(_loc2_ < 0 || item.kind == mx.data.components.datasetclasses.DeltaItem.Method)
  24.       {
  25.          this._deltaItems.push(item);
  26.       }
  27.       else
  28.       {
  29.          this._deltaItems.splice(_loc2_,1);
  30.          this._deltaItems.splice(_loc2_,0,item);
  31.       }
  32.    }
  33.    function getId()
  34.    {
  35.       return this._id;
  36.    }
  37.    function getOperation()
  38.    {
  39.       return this._op;
  40.    }
  41.    function getChangeList()
  42.    {
  43.       if(this._op != mx.data.components.datasetclasses.DeltaPacketConsts.Added || this._accessCl)
  44.       {
  45.          return this._deltaItems;
  46.       }
  47.       return null;
  48.    }
  49.    function getItemByName(name)
  50.    {
  51.       var _loc2_ = this.getItemIndexByName(name);
  52.       if(_loc2_ >= 0)
  53.       {
  54.          return this._deltaItems[_loc2_];
  55.       }
  56.       return null;
  57.    }
  58.    function getSource()
  59.    {
  60.       var _loc4_ = this._source;
  61.       if(this._op == mx.data.components.datasetclasses.DeltaPacketConsts.Added && arguments.length > 0)
  62.       {
  63.          if(this._source.clone == undefined)
  64.          {
  65.             _loc4_ = new Object();
  66.             var _loc3_ = undefined;
  67.             for(var _loc5_ in this._source)
  68.             {
  69.                _loc3_ = this._source[_loc5_];
  70.                if(typeof _loc3_ != "function")
  71.                {
  72.                   _loc4_[_loc5_] = _loc3_;
  73.                }
  74.             }
  75.          }
  76.          else
  77.          {
  78.             _loc4_ = this._source.clone();
  79.          }
  80.       }
  81.       return _loc4_;
  82.    }
  83.    function getMessage()
  84.    {
  85.       return this._message;
  86.    }
  87.    function getDeltaPacket()
  88.    {
  89.       return this._owner;
  90.    }
  91.    function getItemIndexByName(name)
  92.    {
  93.       var _loc3_ = undefined;
  94.       if(this._op == mx.data.components.datasetclasses.DeltaPacketConsts.Modified || this._accessCl)
  95.       {
  96.          var _loc2_ = 0;
  97.          while(_loc2_ < this._deltaItems.length)
  98.          {
  99.             _loc3_ = this._deltaItems[_loc2_];
  100.             if(_loc3_.name == name)
  101.             {
  102.                return _loc2_;
  103.             }
  104.             _loc2_ = _loc2_ + 1;
  105.          }
  106.       }
  107.       return -1;
  108.    }
  109. }
  110.