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

  1. class mx.data.components.DataSet extends MovieClip
  2. {
  3.    var _loading;
  4.    var _eventDispatcher;
  5.    var super_addBinding;
  6.    var _fldValObj;
  7.    var __schema;
  8.    var __toProperties;
  9.    var _calcFields;
  10.    var _enableEvents;
  11.    var _event;
  12.    var _itemClass;
  13.    var _hasDelta;
  14.    var _deltaPacket;
  15.    var _filterFunc;
  16.    var _filtered;
  17.    var _srcSchema;
  18.    var _defValues;
  19.    var __logChanges;
  20.    var __readOnly;
  21.    var __itemClassName;
  22.    var _trapProperties;
  23.    var __curItem;
  24.    var _dpIndexByTransId;
  25.    var getField;
  26.    var _iterator;
  27.    var __items;
  28.    var __schemaXML;
  29.    var _invalidSchema;
  30.    var _iterators;
  31.    var _itemIndexById;
  32.    var _dpTransIdCount;
  33.    var _lastTransId;
  34.    var _optDeltaItems;
  35.    var _deltaItems;
  36.    var _propCage;
  37.    static var DefaultIterator = "__default__";
  38.    static var ItemId = "__ID__";
  39.    static var KeysOnly = 0;
  40.    static var All = 1;
  41.    var _allowReslv = false;
  42.    function DataSet()
  43.    {
  44.       super();
  45.       this._loading = false;
  46.       this._eventDispatcher = new Object();
  47.       mx.events.EventDispatcher.initialize(this._eventDispatcher);
  48.       this.super_addBinding = mx.data.binding.ComponentMixins.prototype.addBinding;
  49.       this._fldValObj = new Object();
  50.       this._fldValObj.__schema = this.__schema;
  51.       mx.data.binding.ComponentMixins.initComponent(this._fldValObj);
  52.       mx.data.binding.ComponentMixins.initComponent(this);
  53.       this.__toProperties = new Object();
  54.       this._calcFields = new Object();
  55.       this._calcFields.__length__ = 0;
  56.       this.initCollection();
  57.       this.initIterators();
  58.       this._enableEvents = 0;
  59.       this._event = null;
  60.       this._itemClass = null;
  61.       this._hasDelta = 0;
  62.       this._deltaPacket = null;
  63.       this._filterFunc = null;
  64.       this._visible = false;
  65.       this._filtered = false;
  66.       this._srcSchema = null;
  67.       this._defValues = new Object();
  68.       this._name = this._name != undefined ? this._name : "";
  69.       this.__logChanges = this.__logChanges != undefined ? this.__logChanges : true;
  70.       this.__readOnly = this.__readOnly != undefined ? this.__readOnly : false;
  71.       this.__itemClassName = this.__itemClassName != undefined ? this.__itemClassName : "";
  72.       this._trapProperties = false;
  73.       this.buildSchema();
  74.       this.createProperties();
  75.    }
  76.    function get currentItem()
  77.    {
  78.       return this.__curItem;
  79.    }
  80.    function get deltaPacket()
  81.    {
  82.       return this._deltaPacket;
  83.    }
  84.    function set deltaPacket(dp)
  85.    {
  86.       if(dp != null)
  87.       {
  88.          var _loc9_ = dp.getIterator();
  89.          var _loc5_ = undefined;
  90.          var _loc13_ = new Array();
  91.          var _loc11_ = this._dpIndexByTransId[dp.getTransactionId()];
  92.          if(_loc11_ != undefined)
  93.          {
  94.             this.internalClearDeltaPacket(dp.getTransactionId());
  95.             while(_loc9_.hasNext())
  96.             {
  97.                _loc5_ = mx.data.components.datasetclasses.Delta(_loc9_.next());
  98.                if(_loc11_.items[_loc5_.getId()] == null)
  99.                {
  100.                   throw new mx.data.components.datasetclasses.DataSetError("Couldn\'t resolve item with ID [" + _loc5_.getId() + "] specified in deltaPacket [" + dp.getTransactionId() + "]. Error for DataSet \'" + this._name + "\'.");
  101.                }
  102.                this.applyResolvePacket(_loc5_,_loc13_,_loc11_.items);
  103.             }
  104.             if(_loc13_.length > 0)
  105.             {
  106.                this.internalDispatchEvent("resolveDelta",{data:_loc13_});
  107.             }
  108.          }
  109.          else
  110.          {
  111.             var _loc3_ = undefined;
  112.             var _loc15_ = this.__logChanges;
  113.             this.__logChanges = dp.logChanges() && this.__logChanges;
  114.             this._enableEvents = this._enableEvents - 1;
  115.             var _loc14_ = dp.getKeyInfo();
  116.             this.addSort(dp.getTransactionId(),_loc14_.keyList,_loc14_.options);
  117.             try
  118.             {
  119.                while(_loc9_.hasNext())
  120.                {
  121.                   _loc5_ = mx.data.components.datasetclasses.Delta(_loc9_.next());
  122.                   switch(_loc5_.getOperation())
  123.                   {
  124.                      case mx.data.components.datasetclasses.DeltaPacketConsts.Modified:
  125.                         _loc3_ = this.convertToRaw(_loc5_.getSource(),mx.data.components.DataSet.KeysOnly);
  126.                         if(_loc3_ != null)
  127.                         {
  128.                            var _loc10_ = this.__curItem;
  129.                            try
  130.                            {
  131.                               this.__curItem = _loc3_;
  132.                               var _loc4_ = undefined;
  133.                               var _loc8_ = _loc5_.getChangeList();
  134.                               var _loc6_ = 0;
  135.                               while(_loc6_ < _loc8_.length)
  136.                               {
  137.                                  _loc4_ = _loc8_[_loc6_];
  138.                                  if(_loc4_.kind == mx.data.components.datasetclasses.DeltaItem.Property)
  139.                                  {
  140.                                     var _loc7_ = this.__toProperties[_loc4_.name].type;
  141.                                     this.getField(_loc4_.name).setTypedValue(new mx.data.binding.TypedValue(_loc4_.newValue,_loc7_.name,_loc7_));
  142.                                  }
  143.                                  else
  144.                                  {
  145.                                     this[_loc4_.name].apply(_loc3_,_loc4_.argList);
  146.                                  }
  147.                                  _loc6_ = _loc6_ + 1;
  148.                               }
  149.                            }
  150.                            finally
  151.                            {
  152.                               this.__curItem = _loc10_;
  153.                            }
  154.                         }
  155.                         break;
  156.                      case mx.data.components.datasetclasses.DeltaPacketConsts.Added:
  157.                         _loc3_ = this.convertToRaw(_loc5_.getSource(true),mx.data.components.DataSet.All);
  158.                         _loc3_ = this.createItem(_loc3_);
  159.                         this.addItem(_loc3_);
  160.                         break;
  161.                      case mx.data.components.datasetclasses.DeltaPacketConsts.Removed:
  162.                         _loc3_ = this.convertToRaw(_loc5_.getSource(),mx.data.components.DataSet.KeysOnly);
  163.                         _loc3_ = this._iterator.find(_loc3_);
  164.                         if(_loc3_ != null)
  165.                         {
  166.                            this.removeItem(_loc3_);
  167.                         }
  168.                   }
  169.                   if(_loc3_ == null)
  170.                   {
  171.                      _global.__dataLogger.logData(null,"Couldn\'t find the following item:",_loc5_.getSource());
  172.                   }
  173.                }
  174.             }
  175.             finally
  176.             {
  177.                this.applyUpdates();
  178.                this.removeSort(dp.getTransactionId());
  179.                this._enableEvents = this._enableEvents + 1;
  180.                this.__logChanges = _loc15_;
  181.                this.internalDispatchEvent("modelChanged",{eventName:"filterModel"});
  182.             }
  183.          }
  184.       }
  185.    }
  186.    function get dataProvider()
  187.    {
  188.       return new mx.data.components.datasetclasses.DataSetDataProvider(this);
  189.    }
  190.    function set dataProvider(dp)
  191.    {
  192.       if(dp != null)
  193.       {
  194.          this._loading = true;
  195.          var _loc7_ = this.__logChanges;
  196.          try
  197.          {
  198.             this.__logChanges = false;
  199.             this.initCollection();
  200.             if(dp.length > 0 && this.hasInvalidSchema())
  201.             {
  202.                this.defaultSchema(dp.getItemAt(0),true);
  203.             }
  204.             var _loc6_ = this._itemClass != null || this.__itemClassName.length > 0 || this._eventDispatcher.__q_newItem != undefined;
  205.             var _loc2_ = undefined;
  206.             var _loc3_ = 0;
  207.             while(_loc3_ < dp.length)
  208.             {
  209.                _loc2_ = dp.getItemAt(_loc3_);
  210.                _loc2_ = !_loc6_ ? _loc2_ : this.createItem(_loc2_);
  211.                for(var _loc5_ in this.__toProperties)
  212.                {
  213.                   val1 = this._defValues[_loc5_];
  214.                   if(val1 != null && _loc2_[_loc5_] == null)
  215.                   {
  216.                      _loc2_[_loc5_] = val1;
  217.                   }
  218.                }
  219.                this.internalAddItem(_loc2_,_loc3_,false,true);
  220.                _loc3_ = _loc3_ + 1;
  221.             }
  222.             this.rebuildItemIndexById();
  223.             this.initIterators();
  224.             this.internalDispatchEvent("afterLoaded");
  225.             this.internalDispatchEvent("modelChanged",{eventName:"updateAll",firstItem:0,lastItem:this.length});
  226.          }
  227.          finally
  228.          {
  229.             this.__logChanges = _loc7_;
  230.             this._loading = false;
  231.          }
  232.       }
  233.    }
  234.    function get filtered()
  235.    {
  236.       return this._filtered;
  237.    }
  238.    function set filtered(value)
  239.    {
  240.       if(this._filtered != value)
  241.       {
  242.          if(this._iterator.setFiltered(value) != 0)
  243.          {
  244.             this.__curItem = this.internalFirst();
  245.             this.internalDispatchEvent("modelChanged",{eventName:"filterModel"});
  246.          }
  247.          this._filtered = value;
  248.       }
  249.    }
  250.    function get filterFunc()
  251.    {
  252.       return this._filterFunc;
  253.    }
  254.    function set filterFunc(value)
  255.    {
  256.       if(this._filterFunc != value)
  257.       {
  258.          if(this._iterator.setFilterFunc(value) != 0)
  259.          {
  260.             this.__curItem = this.internalFirst();
  261.             this.internalDispatchEvent("modelChanged",{eventName:"filterModel"});
  262.          }
  263.          this._filterFunc = value;
  264.       }
  265.    }
  266.    function get items()
  267.    {
  268.       return this.__items;
  269.    }
  270.    function set items(itms)
  271.    {
  272.       var _loc7_ = this.__logChanges;
  273.       this._loading = true;
  274.       try
  275.       {
  276.          this.__logChanges = false;
  277.          this.initCollection();
  278.          if(itms.length > 0 && this.hasInvalidSchema())
  279.          {
  280.             this.defaultSchema(itms[0]);
  281.          }
  282.          var _loc6_ = this._itemClass != null || this.__itemClassName.length > 0 || this._eventDispatcher.__q_newItem != undefined;
  283.          var _loc2_ = undefined;
  284.          var _loc3_ = 0;
  285.          while(_loc3_ < itms.length)
  286.          {
  287.             _loc2_ = itms[_loc3_];
  288.             _loc2_ = !_loc6_ ? _loc2_ : this.createItem(_loc2_);
  289.             for(var _loc5_ in this.__toProperties)
  290.             {
  291.                val = this._defValues[_loc5_];
  292.                if(val != null && _loc2_[_loc5_] == null)
  293.                {
  294.                   _loc2_[_loc5_] = val;
  295.                }
  296.             }
  297.             this.internalAddItem(_loc2_,_loc3_,false,false);
  298.             _loc3_ = _loc3_ + 1;
  299.          }
  300.          this.rebuildItemIndexById();
  301.          this.initIterators();
  302.          this.internalDispatchEvent("afterLoaded");
  303.          this.internalDispatchEvent("modelChanged",{eventName:"updateAll",firstItem:0,lastItem:this.length});
  304.       }
  305.       finally
  306.       {
  307.          this.__logChanges = _loc7_;
  308.          this._loading = false;
  309.       }
  310.    }
  311.    function get itemClassName()
  312.    {
  313.       return this.__itemClassName;
  314.    }
  315.    function set itemClassName(value)
  316.    {
  317.       if(this.__itemClassName != value && this.__items.length > 0)
  318.       {
  319.          throw new mx.data.components.datasetclasses.DataSetError("ItemClass can not be changed when there are already items in the collection. Error for DataSet \'" + this._name + "\'.");
  320.       }
  321.       this.__itemClassName = value;
  322.       this._itemClass = null;
  323.    }
  324.    function get length()
  325.    {
  326.       return this._iterator.getLength();
  327.    }
  328.    function get logChanges()
  329.    {
  330.       return this.__logChanges;
  331.    }
  332.    function set logChanges(value)
  333.    {
  334.       this.__logChanges = value;
  335.    }
  336.    function get properties()
  337.    {
  338.       return this.__toProperties;
  339.    }
  340.    function get readOnly()
  341.    {
  342.       return this.__readOnly;
  343.    }
  344.    function set readOnly(value)
  345.    {
  346.       this.__readOnly = value;
  347.    }
  348.    function get schema()
  349.    {
  350.       return this.__schemaXML;
  351.    }
  352.    function set schema(sch)
  353.    {
  354.       if(sch.firstChild.nodeName != "properties")
  355.       {
  356.          throw new mx.data.components.datasetclasses.DataSetError("First node of schema XML must be \'properties\'");
  357.       }
  358.       this.__schema = new Object();
  359.       this.__schema.elements = new Array();
  360.       var _loc3_ = sch.firstChild.childNodes;
  361.       var _loc2_ = undefined;
  362.       var _loc6_ = undefined;
  363.       for(var _loc4_ in _loc3_)
  364.       {
  365.          _loc2_ = _loc3_[_loc4_];
  366.          if(_loc2_.nodeName == "property")
  367.          {
  368.             this.__schema.elements.push(this.getSchemaObject(_loc2_));
  369.          }
  370.       }
  371.       this.__schemaXML = sch;
  372.       this._invalidSchema = false;
  373.       this.createProperties();
  374.    }
  375.    function get selectedIndex()
  376.    {
  377.       return this._iterator.getItemIndex(this.__curItem);
  378.    }
  379.    function set selectedIndex(index)
  380.    {
  381.       var _loc3_ = this._iterator.getItemIndex(this.__curItem);
  382.       if(_loc3_ == index)
  383.       {
  384.          return;
  385.       }
  386.       var _loc2_ = this._iterator.getItemAt(index);
  387.       if(_loc2_ != null)
  388.       {
  389.          this.__curItem = _loc2_;
  390.          this._iterator.find(_loc2_);
  391.          this.internalDispatchEvent("iteratorScrolled");
  392.       }
  393.    }
  394.    function addBinding(aBinding)
  395.    {
  396.       var _loc2_ = null;
  397.       if(aBinding.source.component == this)
  398.       {
  399.          _loc2_ = aBinding.source;
  400.          if(_loc2_.property == "dataProvider")
  401.          {
  402.             Object(aBinding).queueForExecute();
  403.             _loc2_.event = "NoEvent";
  404.             _loc2_ = null;
  405.          }
  406.       }
  407.       if(aBinding.dest.component == this)
  408.       {
  409.          _loc2_ = aBinding.dest;
  410.       }
  411.       if(_loc2_ != null)
  412.       {
  413.          var _loc4_ = _loc2_.property;
  414.          if(_loc4_ != "deltaPacket" && _loc4_ != "items")
  415.          {
  416.             _loc2_.event = new Array("iteratorScrolled","modelChanged");
  417.          }
  418.       }
  419.       this.super_addBinding(aBinding);
  420.    }
  421.    function addEventListener(name, handler)
  422.    {
  423.       this._eventDispatcher.addEventListener(name,handler);
  424.    }
  425.    function addSort(name, propList, options)
  426.    {
  427.       if(this.hasSort(name))
  428.       {
  429.          throw new mx.data.components.datasetclasses.DataSetError("Sort \'" + name + "\' specified is already added.  Error for dataset \'" + this._name + "\'.");
  430.       }
  431.       var _loc3_ = null;
  432.       var _loc2_ = 0;
  433.       while(_loc2_ < propList.length)
  434.       {
  435.          _loc3_ = this.__toProperties[propList[_loc2_]];
  436.          if(_loc3_ == null)
  437.          {
  438.             throw new mx.data.components.datasetclasses.DataSetError("Property \'" + propList[_loc2_] + "\' not found in schema for DataSet \'" + this._name + "\' can\'t build index.");
  439.          }
  440.          this.addSortInfo(this.getField(_loc3_.name),name,_loc2_);
  441.          _loc2_ = _loc2_ + 1;
  442.       }
  443.       var _loc6_ = new mx.data.components.datasetclasses.DataSetIterator(name,this,this._iterators[mx.data.components.DataSet.DefaultIterator]);
  444.       _loc6_.setFilterFunc(this._filterFunc);
  445.       _loc6_.setFiltered(this._filtered);
  446.       _loc6_.sortOn(propList,options);
  447.       this._iterators[name] = _loc6_;
  448.       this._iterator = _loc6_;
  449.       this.__curItem = this._iterator.next();
  450.       this.internalDispatchEvent("modelChanged",{eventName:"sort"});
  451.    }
  452.    function addItem(transferObj)
  453.    {
  454.       if(arguments.length > 0 && transferObj == null)
  455.       {
  456.          return false;
  457.       }
  458.       return this.addItemAt(this.length,transferObj);
  459.    }
  460.    function addItemAt(index, transferObj)
  461.    {
  462.       this.checkReadOnly();
  463.       var _loc5_ = true;
  464.       if(transferObj == undefined)
  465.       {
  466.          transferObj = this.createItem(null);
  467.       }
  468.       else
  469.       {
  470.          var _loc7_ = transferObj[mx.data.components.DataSet.ItemId];
  471.          _loc5_ = _loc7_ == undefined || this._itemIndexById[_loc7_] == undefined;
  472.       }
  473.       if(_loc5_)
  474.       {
  475.          if(this.hasInvalidSchema())
  476.          {
  477.             this.defaultSchema(transferObj);
  478.          }
  479.          var _loc4_ = this.internalDispatchEvent("addItem",{item:transferObj,result:true});
  480.          _loc5_ = _loc4_ == null || _loc4_.result;
  481.          if(_loc5_ && index <= this.length)
  482.          {
  483.             _loc7_ = this.internalAddItem(transferObj,index,true,false);
  484.             if(this.__logChanges)
  485.             {
  486.                this.logAddItem(transferObj,false);
  487.             }
  488.             _loc4_ = {eventName:"addItems",firstItem:index,lastItem:index};
  489.             this.resyncIterators(_loc4_);
  490.             var _loc6_ = this._iterator.find({__ID__:_loc7_});
  491.             if(_loc6_ != null)
  492.             {
  493.                this.__curItem = _loc6_;
  494.             }
  495.             this.internalDispatchEvent("modelChanged",_loc4_);
  496.             if(this._enableEvents < 0 && this._event != null)
  497.             {
  498.                this._event.data.lastItem = index;
  499.             }
  500.          }
  501.       }
  502.       return _loc5_;
  503.    }
  504.    function applyUpdates()
  505.    {
  506.       if(this._hasDelta > 0)
  507.       {
  508.          var _loc2_ = this.getDPTransId();
  509.          var _loc4_ = 0;
  510.          if(this._dpTransIdCount == 0)
  511.          {
  512.             this._lastTransId = _loc2_;
  513.          }
  514.          else
  515.          {
  516.             _loc4_ = this._dpIndexByTransId[this._lastTransId].index;
  517.          }
  518.          this._dpIndexByTransId[_loc2_] = {index:this._deltaItems.length,prevId:this._lastTransId,items:this._optDeltaItems};
  519.          this._dpTransIdCount = this._dpTransIdCount + 1;
  520.          this._deltaPacket = new mx.data.components.datasetclasses.DeltaPacketImpl(this,_loc2_,this.getKeyInfo(),true,this._srcSchema);
  521.          for(var _loc3_ in this._optDeltaItems)
  522.          {
  523.             this._deltaPacket.addItem(this._optDeltaItems[_loc3_]);
  524.          }
  525.          this._lastTransId = _loc2_;
  526.          this._optDeltaItems = new Array();
  527.          this._hasDelta = 0;
  528.          this.internalDispatchEvent("deltaPacketChanged");
  529.       }
  530.       else
  531.       {
  532.          this._deltaPacket = null;
  533.       }
  534.    }
  535.    function clear()
  536.    {
  537.       var _loc4_ = new Array();
  538.       var _loc5_ = new Array();
  539.       var _loc2_ = undefined;
  540.       var _loc6_ = undefined;
  541.       var _loc8_ = this._iterator.getLength();
  542.       var _loc3_ = 0;
  543.       while(_loc3_ < this.__items.length)
  544.       {
  545.          _loc2_ = this.__items[_loc3_];
  546.          _loc6_ = _loc2_[mx.data.components.DataSet.ItemId];
  547.          if(this._iterator.contains(_loc2_))
  548.          {
  549.             if(this.__logChanges)
  550.             {
  551.                this.logRemoveItem(_loc2_,false);
  552.             }
  553.             _loc5_.push(_loc2_[mx.data.components.DataSet.ItemId]);
  554.          }
  555.          else
  556.          {
  557.             _loc4_.push(_loc2_);
  558.          }
  559.          _loc3_ = _loc3_ + 1;
  560.       }
  561.       this.__items = _loc4_;
  562.       this.rebuildItemIndexById();
  563.       var _loc7_ = {eventName:"removeItems",firstItem:0,lastItem:_loc8_,removedIDs:_loc5_};
  564.       this.resyncIterators(_loc7_);
  565.       this.__curItem = this.getCurrentItem();
  566.       delete _loc7_[this.items];
  567.       this.internalDispatchEvent("modelChanged",_loc7_);
  568.    }
  569.    function createItem(itemData)
  570.    {
  571.       this.checkSchema();
  572.       var _loc5_ = null;
  573.       if(this._itemClass == null)
  574.       {
  575.          if(this.__itemClassName.length > 0)
  576.          {
  577.             this._itemClass = mx.utils.ClassFinder.findClass(this.__itemClassName);
  578.             if(this._itemClass == null)
  579.             {
  580.                throw new mx.data.components.datasetclasses.DataSetError("Item class \'" + this.__itemClassName + "\' specified not found. Error for DataSet \'" + this._name + "\'.");
  581.             }
  582.          }
  583.          else
  584.          {
  585.             this._itemClass = Function(Object);
  586.          }
  587.       }
  588.       if(itemData == null)
  589.       {
  590.          this._propCage = new Object();
  591.       }
  592.       else
  593.       {
  594.          this._propCage = itemData;
  595.       }
  596.       this._trapProperties = true;
  597.       try
  598.       {
  599.          var _loc2_ = undefined;
  600.          for(var _loc3_ in this.__toProperties)
  601.          {
  602.             _loc2_ = this._defValues[_loc3_];
  603.             if(_loc2_ != null && this._propCage[_loc3_] == null)
  604.             {
  605.                this.getField(_loc3_).setTypedValue(new mx.data.binding.TypedValue(_loc2_,"String"));
  606.             }
  607.          }
  608.          itemData = this._propCage;
  609.       }
  610.       finally
  611.       {
  612.          this._trapProperties = false;
  613.       }
  614.       if(this._itemClass == Object)
  615.       {
  616.          _loc5_ = itemData;
  617.       }
  618.       else
  619.       {
  620.          _loc5_ = new this._itemClass();
  621.       }
  622.       _loc5_.setPropertyData(itemData);
  623.       this.internalDispatchEvent("newItem",{item:_loc5_});
  624.       return _loc5_;
  625.    }
  626.    function disableEvents()
  627.    {
  628.       this._enableEvents = this._enableEvents - 1;
  629.    }
  630.    function dispatchEvent(eventObj)
  631.    {
  632.       this.internalDispatchEvent(eventObj.type,eventObj);
  633.    }
  634.    function enableEvents()
  635.    {
  636.       if(this._enableEvents < 0)
  637.       {
  638.          this._enableEvents = this._enableEvents + 1;
  639.       }
  640.       if(this._enableEvents == 0)
  641.       {
  642.          this.internalDispatchEvent(this._event.type,this._event.data);
  643.          this._event = null;
  644.       }
  645.    }
  646.    function find(values)
  647.    {
  648.       var _loc2_ = this._iterator.find(this.convertToRaw(values,mx.data.components.DataSet.KeysOnly));
  649.       if(_loc2_ != null)
  650.       {
  651.          this.__curItem = _loc2_;
  652.          this.internalDispatchEvent("iteratorScrolled");
  653.       }
  654.       return _loc2_ != null;
  655.    }
  656.    function findFirst(values)
  657.    {
  658.       var _loc2_ = this._iterator.findFirst(this.convertToRaw(values,mx.data.components.DataSet.KeysOnly));
  659.       if(_loc2_ != null)
  660.       {
  661.          this.__curItem = _loc2_;
  662.          this.internalDispatchEvent("iteratorScrolled");
  663.       }
  664.       return _loc2_ != null;
  665.    }
  666.    function findLast(values)
  667.    {
  668.       var _loc2_ = this._iterator.findLast(this.convertToRaw(values,mx.data.components.DataSet.KeysOnly));
  669.       if(_loc2_ != null)
  670.       {
  671.          this.__curItem = _loc2_;
  672.          this.internalDispatchEvent("iteratorScrolled");
  673.       }
  674.       return _loc2_ != null;
  675.    }
  676.    function first()
  677.    {
  678.       var _loc2_ = this.internalFirst();
  679.       if(this.__curItem != _loc2_)
  680.       {
  681.          this.__curItem = _loc2_;
  682.          this.internalDispatchEvent("iteratorScrolled");
  683.       }
  684.    }
  685.    function getItemId(index)
  686.    {
  687.       var _loc2_ = "";
  688.       if(this.getLength() > 0)
  689.       {
  690.          _loc2_ = index != undefined ? this._iterator.getItemId(index) : this.__curItem[mx.data.components.DataSet.ItemId];
  691.       }
  692.       return _loc2_;
  693.    }
  694.    function getIterator()
  695.    {
  696.       var _loc3_ = this.internalGetId();
  697.       var _loc2_ = new mx.data.components.datasetclasses.DataSetIterator(_loc3_,this,mx.data.components.datasetclasses.DataSetIterator(this._iterator));
  698.       _loc2_.first();
  699.       this._iterators[_loc3_] = _loc2_;
  700.       return _loc2_;
  701.    }
  702.    function getLength()
  703.    {
  704.       return this.items.length;
  705.    }
  706.    function hasNext()
  707.    {
  708.       return this._iterator.getLength() > 0 && (this._iterator.hasNext() || this._iterator.getCurrentItem() != null);
  709.    }
  710.    function hasPrevious()
  711.    {
  712.       return this._iterator.getLength() > 0 && (this._iterator.hasPrevious() || this._iterator.getCurrentItem() != null);
  713.    }
  714.    function hasSort(name)
  715.    {
  716.       return this._iterators[name] != undefined;
  717.    }
  718.    function isEmpty()
  719.    {
  720.       return this.length == 0;
  721.    }
  722.    function clearDelta(id)
  723.    {
  724.       return this.removeDelta(this._optDeltaItems[id]);
  725.    }
  726.    function changesPending()
  727.    {
  728.       return this._hasDelta > 0;
  729.    }
  730.    function locateById(id)
  731.    {
  732.       var _loc2_ = this._iterator.find({__ID__:id});
  733.       if(_loc2_ != null)
  734.       {
  735.          this.__curItem = _loc2_;
  736.          this.internalDispatchEvent("iteratorScrolled");
  737.       }
  738.       return _loc2_ != null;
  739.    }
  740.    function last()
  741.    {
  742.       this._iterator.last();
  743.       var _loc2_ = this._iterator.previous();
  744.       this._iterator.next();
  745.       if(this.__curItem != _loc2_)
  746.       {
  747.          this.__curItem = _loc2_;
  748.          this.internalDispatchEvent("iteratorScrolled");
  749.       }
  750.    }
  751.    function loadFromSharedObj(objName, localPath)
  752.    {
  753.       var _loc7_ = SharedObject.getLocal(objName,localPath);
  754.       if(_loc7_.data.items != undefined)
  755.       {
  756.          this.items = _loc7_.data.items;
  757.          var _loc4_ = _loc7_.data.optDelta;
  758.          this._optDeltaItems = new Array();
  759.          var _loc2_ = undefined;
  760.          for(var _loc8_ in _loc4_)
  761.          {
  762.             _loc2_ = _loc4_[_loc8_];
  763.             this._optDeltaItems[_loc2_._id] = this.createDelta(_loc2_);
  764.          }
  765.          _loc4_ = _loc7_.data.delta;
  766.          this._deltaItems = new Array();
  767.          var _loc8_ = 0;
  768.          while(_loc8_ < _loc4_.length)
  769.          {
  770.             _loc2_ = _loc4_[_loc8_];
  771.             if(this._optDeltaItems[_loc2_._id] == undefined)
  772.             {
  773.                d = this.createDelta(_loc2_);
  774.             }
  775.             else
  776.             {
  777.                d = this._optDeltaItems[_loc2_._id];
  778.             }
  779.             this._deltaItems.push(d);
  780.             _loc8_ = _loc8_ + 1;
  781.          }
  782.          var _loc5_ = _loc7_.data.dpIndex;
  783.          var _loc3_ = undefined;
  784.          for(_loc8_ in _loc5_)
  785.          {
  786.             _loc3_ = _loc5_[_loc8_].items;
  787.             for(var _loc6_ in _loc3_)
  788.             {
  789.                _loc3_[_loc6_] = this.findDelta(_loc6_);
  790.             }
  791.          }
  792.          this._dpIndexByTransId = _loc5_;
  793.          this._lastTransId = _loc7_.data.lastTransId;
  794.          this._dpTransIdCount = _loc7_.data.transIdCount;
  795.          this._hasDelta = _loc7_.data.hasDelta;
  796.       }
  797.       throw new mx.data.components.datasetclasses.DataSetError("The shared object \'" + objName + "\' was not present or there was a problem retrieving the data from it.");
  798.    }
  799.    function next()
  800.    {
  801.       var _loc2_ = this._iterator.next();
  802.       if(_loc2_ != null)
  803.       {
  804.          if(_loc2_ == this.__curItem)
  805.          {
  806.             _loc2_ = this._iterator.next();
  807.          }
  808.          if(_loc2_ != null)
  809.          {
  810.             this.__curItem = _loc2_;
  811.             this.internalDispatchEvent("iteratorScrolled");
  812.          }
  813.       }
  814.    }
  815.    function previous()
  816.    {
  817.       var _loc2_ = this._iterator.previous();
  818.       if(_loc2_ != null)
  819.       {
  820.          if(_loc2_ == this.__curItem)
  821.          {
  822.             _loc2_ = this._iterator.previous();
  823.          }
  824.          if(_loc2_ != null)
  825.          {
  826.             this.__curItem = _loc2_;
  827.             this.internalDispatchEvent("iteratorScrolled");
  828.          }
  829.       }
  830.    }
  831.    function propertyModified(propName, subProp, typeInfo)
  832.    {
  833.       if(propName == "dataProvider" || propName == "items")
  834.       {
  835.          this._srcSchema = typeInfo;
  836.       }
  837.    }
  838.    function removeAll()
  839.    {
  840.       var _loc3_ = this.__items.length;
  841.       var _loc4_ = new Array();
  842.       var _loc2_ = 0;
  843.       while(_loc2_ < _loc3_)
  844.       {
  845.          itm = this.__items[_loc2_];
  846.          if(this.__logChanges)
  847.          {
  848.             this.logRemoveItem(this.__items[_loc2_],false);
  849.          }
  850.          _loc4_.push(itm[mx.data.components.DataSet.ItemId]);
  851.          _loc2_ = _loc2_ + 1;
  852.       }
  853.       this.__items = new Array();
  854.       this._itemIndexById = new Array();
  855.       var _loc5_ = {eventName:"removeItems",firstItem:0,lastItem:_loc3_,removedIDs:_loc4_};
  856.       this.resyncIterators(_loc5_);
  857.       this.internalDispatchEvent("modelChanged",_loc5_);
  858.    }
  859.    function removeEventListener(name, handler)
  860.    {
  861.       this._eventDispatcher.removeEventListener(name,handler);
  862.    }
  863.    function removeItem(item)
  864.    {
  865.       if(arguments.length > 0 && item == null)
  866.       {
  867.          return false;
  868.       }
  869.       if(item == null)
  870.       {
  871.          item = this.__curItem;
  872.       }
  873.       var _loc4_ = this._itemIndexById[item[mx.data.components.DataSet.ItemId]];
  874.       if(_loc4_ != undefined)
  875.       {
  876.          return this.internalRemoveItem(item);
  877.       }
  878.       return false;
  879.    }
  880.    function removeItemAt(index)
  881.    {
  882.       return this.internalRemoveItem(this._iterator.getItemAt(index));
  883.    }
  884.    function removeRange()
  885.    {
  886.       this._iterator.removeRange();
  887.       this.__curItem = this.internalFirst();
  888.       this.internalDispatchEvent("modelChanged",{eventName:"filterModel"});
  889.    }
  890.    function removeSort(name)
  891.    {
  892.       if(this._iterators[name] != undefined)
  893.       {
  894.          if(name != mx.data.components.DataSet.DefaultIterator)
  895.          {
  896.             if(this._iterator.getId() == name)
  897.             {
  898.                this.setIterator(this._iterators[mx.data.components.DataSet.DefaultIterator]);
  899.             }
  900.             var _loc3_ = this._iterators[name].getSortInfo();
  901.             var _loc2_ = 0;
  902.             while(_loc2_ < _loc3_.keyList.length)
  903.             {
  904.                this.removeSortInfo(this.getField(_loc3_.keyList[_loc2_]),name);
  905.                _loc2_ = _loc2_ + 1;
  906.             }
  907.             delete this._iterators[name];
  908.          }
  909.          throw new mx.data.components.datasetclasses.DataSetError("The default index can not be removed.  Error on DataSet \'" + this._name + "\'.");
  910.       }
  911.       throw new mx.data.components.datasetclasses.DataSetError("Sort \'" + name + "\' specified does not exist.  Error on DataSet \'" + this._name + "\'.");
  912.    }
  913.    function skip(offset)
  914.    {
  915.       var _loc2_ = this._iterator.skip(offset);
  916.       if(_loc2_ == null)
  917.       {
  918.          if(offset > 0)
  919.          {
  920.             _loc2_ = this._iterator.previous();
  921.          }
  922.          else
  923.          {
  924.             _loc2_ = this._iterator.next();
  925.          }
  926.       }
  927.       if(this.__curItem != _loc2_)
  928.       {
  929.          this.__curItem = _loc2_;
  930.          this.internalDispatchEvent("iteratorScrolled");
  931.       }
  932.       return this;
  933.    }
  934.    function saveToSharedObj(objName, localPath)
  935.    {
  936.       var _loc2_ = SharedObject.getLocal(objName,localPath);
  937.       if(_loc2_ == null)
  938.       {
  939.          throw new mx.data.components.datasetclasses.DataSetError("Couldn\'t access specified shared object. Error for DataSet \'" + this._name + "\'.");
  940.       }
  941.       _loc2_.data.items = this.__items;
  942.       _loc2_.data.optDelta = this._optDeltaItems;
  943.       _loc2_.data.delta = this._deltaItems;
  944.       _loc2_.data.dpIndex = this._dpIndexByTransId;
  945.       _loc2_.data.lastTransId = this._lastTransId;
  946.       _loc2_.data.transIdCount = this._dpTransIdCount;
  947.       _loc2_.data.hasDelta = this._hasDelta;
  948.       if(_loc2_.flush() == false)
  949.       {
  950.          throw new mx.data.components.datasetclasses.DataSetError("Couldn\'t save shared object not sufficient space or rights. Error for DataSet \'" + this._name + "\'.");
  951.       }
  952.    }
  953.    function setIterator(newIterator)
  954.    {
  955.       if(this._iterators[newIterator.getId()] == undefined)
  956.       {
  957.          throw new mx.data.components.datasetclasses.DataSetError("Can\'t assign foreign iterator \'" + newIterator.getId() + "\' to DataSet \'" + this._name + "\'.");
  958.       }
  959.       this._iterator = newIterator;
  960.       this.__curItem = this.getCurrentItem();
  961.       this.internalDispatchEvent("modelChanged",{eventName:"filterModel"});
  962.    }
  963.    function setRange(startValues, endValues)
  964.    {
  965.       this._iterator.setRange(this.convertToRaw(startValues,mx.data.components.DataSet.KeysOnly),this.convertToRaw(endValues,mx.data.components.DataSet.KeysOnly));
  966.       this.__curItem = this.internalFirst();
  967.       this.internalDispatchEvent("modelChanged",{eventName:"filterModel"});
  968.    }
  969.    function useSort(sortName, options)
  970.    {
  971.       if(!this.hasSort(sortName))
  972.       {
  973.          throw new mx.data.components.datasetclasses.DataSetError("Sort specified \'" + sortName + "\' does\'nt exist for DataSet \'" + this._name + "\'.");
  974.       }
  975.       var _loc2_ = this._iterators[sortName];
  976.       if(options != undefined)
  977.       {
  978.          _loc2_.setSortOptions(options);
  979.       }
  980.       _loc2_.setFiltered(this._filtered);
  981.       _loc2_.setFilterFunc(this._filterFunc);
  982.       this._iterator = _loc2_;
  983.       this.first();
  984.       this.internalDispatchEvent("modelChanged",{eventName:"sort"});
  985.    }
  986.    function addProxy()
  987.    {
  988.       var _loc2_ = undefined;
  989.       for(var _loc3_ in this.__toProperties)
  990.       {
  991.          _loc2_ = String(_loc3_);
  992.          this.addProperty(_loc2_,this["get_" + _loc2_],this["set_" + _loc2_]);
  993.       }
  994.    }
  995.    function addSortInfo(fld, name, index)
  996.    {
  997.       if(fld.sortInfo == null)
  998.       {
  999.          fld.sortInfo = new Array();
  1000.       }
  1001.       fld.sortInfo[name] = index;
  1002.    }
  1003.    function applyResolvePacket(d, resPckt, dpItems)
  1004.    {
  1005.       var _loc9_ = resPckt.length;
  1006.       if(d.getMessage().length > 0)
  1007.       {
  1008.          resPckt.push(Object(d));
  1009.       }
  1010.       else
  1011.       {
  1012.          var _loc3_ = d.getChangeList();
  1013.          var _loc4_ = true;
  1014.          var _loc2_ = 0;
  1015.          while(_loc2_ < _loc3_.length && _loc4_)
  1016.          {
  1017.             _loc4_ = _loc3_[_loc2_].message.length == 0;
  1018.             _loc2_ = _loc2_ + 1;
  1019.          }
  1020.          if(_loc2_ < _loc3_.length)
  1021.          {
  1022.             resPckt.push(Object(d));
  1023.          }
  1024.       }
  1025.       var _loc6_ = _loc9_ != resPckt.length;
  1026.       switch(d.getOperation())
  1027.       {
  1028.          case mx.data.components.datasetclasses.DeltaPacketConsts.Added:
  1029.             if(_loc6_)
  1030.             {
  1031.                this.logAddItem(d.getSource(),true,d.getId());
  1032.             }
  1033.             else
  1034.             {
  1035.                this.updateItem(d);
  1036.             }
  1037.             break;
  1038.          case mx.data.components.datasetclasses.DeltaPacketConsts.Removed:
  1039.             if(_loc6_)
  1040.             {
  1041.                this.logRemoveItem(d.getSource(),true,d.getId());
  1042.             }
  1043.             break;
  1044.          case mx.data.components.datasetclasses.DeltaPacketConsts.Modified:
  1045.             if(!_loc6_)
  1046.             {
  1047.                this.updateItem(d);
  1048.             }
  1049.             else
  1050.             {
  1051.                var _loc7_ = dpItems[d.getId()];
  1052.                this._optDeltaItems[d.getId()] = _loc7_;
  1053.                this._deltaItems.push(Object(_loc7_));
  1054.                this._hasDelta = this._hasDelta + 1;
  1055.             }
  1056.       }
  1057.    }
  1058.    function buildSchema()
  1059.    {
  1060.       if(this.hasInvalidSchema())
  1061.       {
  1062.          this.__schemaXML = new XML("<properties/>");
  1063.       }
  1064.       else
  1065.       {
  1066.          var _loc4_ = this.__schema.elements;
  1067.          var _loc2_ = undefined;
  1068.          var _loc6_ = "<properties>";
  1069.          var _loc3_ = 0;
  1070.          while(_loc3_ < _loc4_.length)
  1071.          {
  1072.             _loc2_ = _loc4_[_loc3_];
  1073.             if(this.isValidElement(_loc2_))
  1074.             {
  1075.                if(_loc2_.type.name == "Date" && _loc2_.type.encoder == undefined)
  1076.                {
  1077.                   _loc2_.type.encoder = {className:"mx.data.encoders.DateToNumber"};
  1078.                }
  1079.                _loc6_ += "<property name=\"" + _loc2_.name + "\">" + this.getSchemaXML("type",_loc2_.type) + "</property>";
  1080.             }
  1081.             _loc3_ = _loc3_ + 1;
  1082.          }
  1083.          _loc6_ += "</properties>";
  1084.          this.__schemaXML = new XML(_loc6_);
  1085.       }
  1086.    }
  1087.    function createDelta(td)
  1088.    {
  1089.       var _loc10_ = undefined;
  1090.       var _loc1_ = undefined;
  1091.       var _loc3_ = undefined;
  1092.       _loc10_ = new mx.data.components.datasetclasses.DeltaImpl(td._id,td._source,td._op,td._message,td._accessCl);
  1093.       var _loc2_ = 0;
  1094.       while(_loc2_ < td._deltaItems.length)
  1095.       {
  1096.          _loc1_ = td._deltaItems[_loc2_];
  1097.          if(_loc1_.__kind == mx.data.components.datasetclasses.DeltaItem.Property)
  1098.          {
  1099.             _loc3_ = {newValue:_loc1_.__newValue,oldValue:_loc1_.__oldValue,curValue:_loc1_.__curValue,message:_loc1_.__message};
  1100.          }
  1101.          else
  1102.          {
  1103.             _loc3_ = {argList:_loc1_.__argList};
  1104.          }
  1105.          new mx.data.components.datasetclasses.DeltaItem(_loc1_.__kind,_loc1_.__name,_loc3_,Object(_loc10_));
  1106.          _loc2_ = _loc2_ + 1;
  1107.       }
  1108.       return _loc10_;
  1109.    }
  1110.    function checkReadOnly()
  1111.    {
  1112.       if(this.__readOnly)
  1113.       {
  1114.          throw new mx.data.components.datasetclasses.DataSetError("Can\'t modify a read only DataSet.  Error for \'" + Object(this)._name + "\'.");
  1115.       }
  1116.    }
  1117.    function checkSchema()
  1118.    {
  1119.       if(this.hasInvalidSchema())
  1120.       {
  1121.          throw new mx.data.components.datasetclasses.DataSetError("Schema has not been specified. Can\'t construct item. Error for DataSet \'" + this._name + "\'.");
  1122.       }
  1123.    }
  1124.    function createProperties()
  1125.    {
  1126.       this.removeProxy();
  1127.       this._allowReslv = true;
  1128.       this._calcFields.__length__ = 0;
  1129.       this.__toProperties = new Object();
  1130.       var _loc2_ = undefined;
  1131.       var _loc3_ = 0;
  1132.       while(_loc3_ < this.__schema.elements.length)
  1133.       {
  1134.          _loc2_ = this.__schema.elements[_loc3_];
  1135.          if(this.isValidElement(_loc2_))
  1136.          {
  1137.             this.__toProperties[_loc2_.name] = _loc2_;
  1138.             if(_loc2_.type.value != null)
  1139.             {
  1140.                this._defValues[_loc2_.name] = _loc2_.type.value;
  1141.                _loc2_.type.value = null;
  1142.             }
  1143.             if(this.getField(_loc2_.name).kind.isCalculated)
  1144.             {
  1145.                this._calcFields[_loc2_.name] = _loc2_;
  1146.                this._calcFields.__length__ = this._calcFields.__length__ + 1;
  1147.             }
  1148.          }
  1149.          _loc3_ = _loc3_ + 1;
  1150.       }
  1151.       this.addProxy();
  1152.       this._allowReslv = this.__items.length > 0;
  1153.    }
  1154.    function convertToRaw(values, option)
  1155.    {
  1156.       if(values instanceof Array)
  1157.       {
  1158.          return this.convertArrayToRaw(values);
  1159.       }
  1160.       return this.convertObjectToRaw(values,option);
  1161.    }
  1162.    function convertArrayToRaw(values)
  1163.    {
  1164.       this._trapProperties = true;
  1165.       this._propCage = new Object();
  1166.       try
  1167.       {
  1168.          var _loc5_ = this._iterator.getSortInfo();
  1169.          var _loc4_ = undefined;
  1170.          var _loc6_ = undefined;
  1171.          var _loc3_ = undefined;
  1172.          var _loc2_ = 0;
  1173.          while(_loc2_ < _loc5_.keyList.length)
  1174.          {
  1175.             if(_loc2_ < values.length)
  1176.             {
  1177.                _loc4_ = this.getField(_loc5_.keyList[_loc2_]);
  1178.                _loc6_ = this.__toProperties[_loc5_.keyList[_loc2_]].type;
  1179.                _loc3_ = values[_loc2_];
  1180.                switch(typeof _loc3_)
  1181.                {
  1182.                   case "string":
  1183.                      _loc4_.setAsString(_loc3_);
  1184.                      break;
  1185.                   case "boolean":
  1186.                      _loc4_.setAsBoolean(_loc3_);
  1187.                      break;
  1188.                   case "number":
  1189.                      _loc4_.setAsNumber(_loc3_);
  1190.                      break;
  1191.                   case "object":
  1192.                      _loc4_.setTypedValue(new mx.data.binding.TypedValue(_loc3_,_loc6_.name,_loc6_));
  1193.                }
  1194.             }
  1195.             _loc2_ = _loc2_ + 1;
  1196.          }
  1197.       }
  1198.       finally
  1199.       {
  1200.          this._trapProperties = false;
  1201.       }
  1202.       return this._propCage;
  1203.    }
  1204.    function convertObjectToRaw(values, option)
  1205.    {
  1206.       this._trapProperties = true;
  1207.       this._propCage = new Object();
  1208.       try
  1209.       {
  1210.          var _loc2_ = this._iterator.getSortInfo();
  1211.          var _loc3_ = undefined;
  1212.          if(option == mx.data.components.DataSet.KeysOnly)
  1213.          {
  1214.             var _loc5_ = 0;
  1215.             while(_loc5_ < _loc2_.keyList.length)
  1216.             {
  1217.                _loc3_ = _loc2_.keyList[_loc5_];
  1218.                this.setFieldValue(this.getField(_loc3_),values[_loc3_],this.__toProperties[_loc2_.keyList[_loc5_]].type);
  1219.                _loc5_ = _loc5_ + 1;
  1220.             }
  1221.          }
  1222.          else
  1223.          {
  1224.             for(_loc5_ in this.__toProperties)
  1225.             {
  1226.                this.setFieldValue(this.getField(_loc5_),values[_loc5_],this.__toProperties[_loc5_].type);
  1227.             }
  1228.          }
  1229.       }
  1230.       finally
  1231.       {
  1232.          this._trapProperties = false;
  1233.       }
  1234.       return this._propCage;
  1235.    }
  1236.    function decodeItem(item)
  1237.    {
  1238.       var _loc3_ = new Object();
  1239.       var _loc6_ = this.__curItem;
  1240.       this.__curItem = item;
  1241.       try
  1242.       {
  1243.          for(var _loc5_ in this.__toProperties)
  1244.          {
  1245.             var _loc2_ = this.getField(_loc5_).getTypedValue().value;
  1246.             if(_loc2_)
  1247.             {
  1248.                _loc3_[_loc5_] = _loc2_;
  1249.             }
  1250.             else
  1251.             {
  1252.                _loc3_[_loc5_] = item[_loc5_];
  1253.             }
  1254.          }
  1255.       }
  1256.       finally
  1257.       {
  1258.          this.__curItem = _loc6_;
  1259.       }
  1260.       return _loc3_;
  1261.    }
  1262.    function defaultSchema(obj)
  1263.    {
  1264.       var _loc2_ = undefined;
  1265.       var _loc3_ = undefined;
  1266.       var _loc4_ = "";
  1267.       for(var _loc6_ in obj)
  1268.       {
  1269.          _loc2_ = typeof obj[_loc6_];
  1270.          if(_loc2_ != "function")
  1271.          {
  1272.             _loc2_ = String(_loc2_.charAt(0)).toUpperCase() + _loc2_.substring(1,_loc2_.length);
  1273.             if(_loc2_ == "Boolean")
  1274.             {
  1275.                _loc3_ = "Bool";
  1276.             }
  1277.             else
  1278.             {
  1279.                _loc3_ = _loc2_.substring(0,3);
  1280.             }
  1281.             _loc4_ = "<property name=\"" + _loc6_ + "\"><type name=\"" + _loc2_ + "\" original=\"false\"><validation className=\"mx.data.types." + _loc3_ + "\"/></type></property>" + _loc4_;
  1282.          }
  1283.       }
  1284.       this.schema = new XML("<properties>" + _loc4_ + "</properties>");
  1285.    }
  1286.    function decodeValue(fieldName, value)
  1287.    {
  1288.       if(!this.__toProperties || !this.__toProperties[fieldName])
  1289.       {
  1290.          return null;
  1291.       }
  1292.       var _loc3_ = this.__toProperties[fieldName].type;
  1293.       var _loc2_ = new mx.data.binding.TypedValue(value,_loc3_.name,_loc3_);
  1294.       if(_loc2_ != null)
  1295.       {
  1296.          return _loc2_.value;
  1297.       }
  1298.       return _loc2_;
  1299.    }
  1300.    function encodeValue(fieldName, value)
  1301.    {
  1302.       if(!this.__toProperties || !this.__toProperties[fieldName])
  1303.       {
  1304.          return null;
  1305.       }
  1306.       var _loc3_ = this.__toProperties[fieldName].type;
  1307.       var _loc2_ = new mx.data.binding.TypedValue(value,_loc3_.name,_loc3_);
  1308.       if(_loc2_)
  1309.       {
  1310.          return _loc2_.value;
  1311.       }
  1312.       return null;
  1313.    }
  1314.    function findDelta(id)
  1315.    {
  1316.       var _loc2_ = 0;
  1317.       while(_loc2_ < this._deltaItems.length)
  1318.       {
  1319.          if(this._deltaItems[_loc2_]._id == id)
  1320.          {
  1321.             return this._deltaItems[_loc2_];
  1322.          }
  1323.          _loc2_ = _loc2_ + 1;
  1324.       }
  1325.       return null;
  1326.    }
  1327.    function internalDispatchEvent(type, params)
  1328.    {
  1329.       var _loc3_ = null;
  1330.       if(this._enableEvents >= 0)
  1331.       {
  1332.          _loc3_ = {type:type,target:this};
  1333.          if(params != undefined)
  1334.          {
  1335.             for(var _loc4_ in params)
  1336.             {
  1337.                _loc3_[_loc4_] = params[_loc4_];
  1338.             }
  1339.          }
  1340.          this._eventDispatcher.dispatchEvent(_loc3_);
  1341.       }
  1342.       else if(this._event != null && this._event.type == "modelChanged")
  1343.       {
  1344.          if(type == "modelChanged")
  1345.          {
  1346.             if(this._event.data.eventName != "sort" && this._event.data.eventName != "filter")
  1347.             {
  1348.                this._event.data = params;
  1349.             }
  1350.          }
  1351.       }
  1352.       else
  1353.       {
  1354.          this._event = {data:params,type:type};
  1355.       }
  1356.       return _loc3_;
  1357.    }
  1358.    function getDataProviderItem(item, desiredTypes)
  1359.    {
  1360.       var _loc5_ = new Object();
  1361.       var _loc4_ = undefined;
  1362.       var _loc9_ = this.__curItem;
  1363.       var _loc3_ = undefined;
  1364.       var _loc2_ = undefined;
  1365.       try
  1366.       {
  1367.          this.__curItem = item;
  1368.          for(var _loc8_ in this.__toProperties)
  1369.          {
  1370.             _loc3_ = desiredTypes[_loc8_];
  1371.             if(_loc3_ == null)
  1372.             {
  1373.                _loc3_ = "String";
  1374.             }
  1375.             _loc4_ = this.getField(_loc8_);
  1376.             if(_loc4_)
  1377.             {
  1378.                _loc2_ = _loc4_.getTypedValue(_loc3_);
  1379.                if(_loc2_ == null)
  1380.                {
  1381.                   _loc2_ = _loc4_.getTypedValue();
  1382.                }
  1383.                _loc5_[_loc8_] = _loc2_.value;
  1384.             }
  1385.             else
  1386.             {
  1387.                _loc5_[_loc8_] = item[_loc8_];
  1388.             }
  1389.          }
  1390.       }
  1391.       finally
  1392.       {
  1393.          this.__curItem = _loc9_;
  1394.       }
  1395.       return _loc5_;
  1396.    }
  1397.    function getEditingData(fieldName, item, desiredTypes)
  1398.    {
  1399.       var _loc4_ = undefined;
  1400.       var _loc5_ = this.__curItem;
  1401.       var _loc2_ = undefined;
  1402.       try
  1403.       {
  1404.          this.__curItem = item;
  1405.          _loc2_ = desiredTypes[fieldName];
  1406.          if(_loc2_ == null)
  1407.          {
  1408.             _loc2_ = "String";
  1409.          }
  1410.          var _loc3_ = this.getField(fieldName);
  1411.          val = _loc3_.getTypedValue(_loc2_);
  1412.          if(val == null)
  1413.          {
  1414.             val = _loc3_.getTypedValue();
  1415.          }
  1416.          _loc4_ = val.value;
  1417.       }
  1418.       finally
  1419.       {
  1420.          this.__curItem = _loc5_;
  1421.       }
  1422.       return _loc4_;
  1423.    }
  1424.    function getDisplayValue(propName, index)
  1425.    {
  1426.       var _loc3_ = this.__curItem;
  1427.       var _loc2_ = "";
  1428.       try
  1429.       {
  1430.          this.__curItem = this.__items[index];
  1431.          _loc2_ = this.getField(propName).getAsString();
  1432.       }
  1433.       finally
  1434.       {
  1435.          this.__curItem = _loc3_;
  1436.       }
  1437.       return _loc2_;
  1438.    }
  1439.    function getCurrentItem()
  1440.    {
  1441.       var _loc2_ = this._iterator.getCurrentItem();
  1442.       if(_loc2_ == null)
  1443.       {
  1444.          if(this._iterator.hasNext())
  1445.          {
  1446.             _loc2_ = this._iterator.next();
  1447.             this._iterator.previous();
  1448.          }
  1449.          else
  1450.          {
  1451.             _loc2_ = this._iterator.previous();
  1452.             this._iterator.next();
  1453.          }
  1454.       }
  1455.       return _loc2_;
  1456.    }
  1457.    function getInternalIndex(index)
  1458.    {
  1459.       var _loc2_ = this._iterator.getItemAt(index);
  1460.       if(_loc2_ == null)
  1461.       {
  1462.          return -1;
  1463.       }
  1464.       return this._itemIndexById[_loc2_[mx.data.components.DataSet.ItemId]];
  1465.    }
  1466.    function getKeyInfo()
  1467.    {
  1468.       var _loc3_ = undefined;
  1469.       var _loc2_ = undefined;
  1470.       for(var _loc5_ in this._iterators)
  1471.       {
  1472.          _loc3_ = this._iterators[_loc5_];
  1473.          _loc2_ = _loc3_.getSortInfo();
  1474.          if(_loc5_ != mx.data.components.DataSet.DefaultIterator && (_loc2_.options & mx.data.components.datasetclasses.DataSetIterator.Unique) == mx.data.components.datasetclasses.DataSetIterator.Unique)
  1475.          {
  1476.             return {options:_loc2_.options,keyList:_loc2_.keyList.slice(0)};
  1477.          }
  1478.       }
  1479.       var _loc4_ = new Array();
  1480.       for(_loc5_ in this.__toProperties)
  1481.       {
  1482.          _loc4_.push(_loc5_);
  1483.       }
  1484.       return {options:mx.data.components.datasetclasses.DataSetIterator.Unique,keyList:_loc4_};
  1485.    }
  1486.    function getModDeltaInfo(id)
  1487.    {
  1488.       var _loc3_ = null;
  1489.       var _loc5_ = null;
  1490.       var _loc6_ = this._optDeltaItems[id];
  1491.       if(_loc6_ == undefined)
  1492.       {
  1493.          _loc3_ = this.__curItem;
  1494.          if(_loc3_.clone == undefined)
  1495.          {
  1496.             var _loc8_ = _loc3_.getPropertyData();
  1497.             if(_loc8_ != null)
  1498.             {
  1499.                _loc5_ = this.createItem(_loc8_);
  1500.             }
  1501.             else
  1502.             {
  1503.                _loc5_ = new Object();
  1504.             }
  1505.          }
  1506.          else
  1507.          {
  1508.             _loc5_ = _loc3_.clone();
  1509.          }
  1510.          var _loc2_ = undefined;
  1511.          var _loc4_ = undefined;
  1512.          for(var _loc7_ in _loc3_)
  1513.          {
  1514.             _loc2_ = _loc3_[_loc7_];
  1515.             if(typeof _loc2_ != "function")
  1516.             {
  1517.                _loc4_ = this.__toProperties[_loc7_];
  1518.                _loc5_[_loc7_] = _loc4_ != undefined ? this.getField(_loc7_).getTypedValue().value : _loc2_;
  1519.             }
  1520.          }
  1521.          _loc6_ = new mx.data.components.datasetclasses.DeltaImpl(id,_loc5_,mx.data.components.datasetclasses.DeltaPacketConsts.Modified);
  1522.          this._optDeltaItems[id] = _loc6_;
  1523.          this._hasDelta = this._hasDelta + 1;
  1524.          this._deltaItems.push(_loc6_);
  1525.       }
  1526.       return _loc6_;
  1527.    }
  1528.    function getPropertyValue(name)
  1529.    {
  1530.       return this.__curItem[name];
  1531.    }
  1532.    function getResolverFieldList()
  1533.    {
  1534.       var _loc2_ = new Object();
  1535.       for(var _loc3_ in this.__toProperties)
  1536.       {
  1537.          if(this._calcFields[_loc3_] == null && this.__toProperties[_loc3_].type.path == null)
  1538.          {
  1539.             _loc2_[_loc3_] = this.__toProperties[_loc3_];
  1540.          }
  1541.       }
  1542.       return _loc2_;
  1543.    }
  1544.    function getDPTransId()
  1545.    {
  1546.       return this.internalGetId() + ":" + new Date().toString();
  1547.    }
  1548.    function getSchemaObject(xmlInfo)
  1549.    {
  1550.       var _loc3_ = new Object();
  1551.       var _loc5_ = undefined;
  1552.       for(var _loc2_ in xmlInfo.attributes)
  1553.       {
  1554.          _loc5_ = xmlInfo.attributes[_loc2_];
  1555.          if(_loc2_ == "original")
  1556.          {
  1557.             _loc3_[_loc2_] = _loc5_ != "false" ? true : false;
  1558.          }
  1559.          else
  1560.          {
  1561.             _loc3_[_loc2_] = _loc5_;
  1562.          }
  1563.       }
  1564.       var _loc4_ = xmlInfo.childNodes;
  1565.       var _loc7_ = undefined;
  1566.       var _loc2_ = 0;
  1567.       while(_loc2_ < _loc4_.length)
  1568.       {
  1569.          _loc3_[_loc4_[_loc2_].nodeName] = this.getSchemaObject(_loc4_[_loc2_]);
  1570.          _loc2_ = _loc2_ + 1;
  1571.       }
  1572.       return _loc3_;
  1573.    }
  1574.    function getSchemaXML(nodeName, info)
  1575.    {
  1576.       var _loc5_ = "";
  1577.       var _loc2_ = undefined;
  1578.       for(var _loc6_ in info)
  1579.       {
  1580.          _loc2_ = info[_loc6_];
  1581.          if(typeof _loc2_ != "object" && _loc6_ != "cls")
  1582.          {
  1583.             _loc5_ += " " + _loc6_ + "=\"" + _loc2_ + "\"";
  1584.          }
  1585.       }
  1586.       var _loc4_ = "<" + nodeName + _loc5_ + ">";
  1587.       for(_loc6_ in info)
  1588.       {
  1589.          _loc2_ = info[_loc6_];
  1590.          if(typeof _loc2_ == "object")
  1591.          {
  1592.             _loc4_ += this.getSchemaXML(_loc6_,_loc2_);
  1593.          }
  1594.       }
  1595.       _loc4_ += "</" + nodeName + ">";
  1596.       return _loc4_;
  1597.    }
  1598.    function hasInvalidSchema()
  1599.    {
  1600.       if(this._invalidSchema == undefined)
  1601.       {
  1602.          this._invalidSchema = true;
  1603.          if(this.__schema.elements != null)
  1604.          {
  1605.             var _loc2_ = this.__schema.elements;
  1606.             for(var _loc3_ in _loc2_)
  1607.             {
  1608.                if(_loc2_[_loc3_].type.original == false)
  1609.                {
  1610.                   this._invalidSchema = false;
  1611.                   return this._invalidSchema;
  1612.                }
  1613.             }
  1614.          }
  1615.       }
  1616.       return this._invalidSchema;
  1617.    }
  1618.    function initCollection()
  1619.    {
  1620.       this.__items = new Array();
  1621.       this._itemIndexById = new Array();
  1622.       this.internalClearDeltaPacket();
  1623.    }
  1624.    function internalAddItem(item, index, rebuildIndx, pipeData)
  1625.    {
  1626.       var _loc7_ = undefined;
  1627.       if(item[mx.data.components.DataSet.ItemId] == null)
  1628.       {
  1629.          _loc7_ = this.internalGetId();
  1630.          item[mx.data.components.DataSet.ItemId] = _loc7_;
  1631.       }
  1632.       else
  1633.       {
  1634.          _loc7_ = item[mx.data.components.DataSet.ItemId];
  1635.       }
  1636.       if(index >= this.__items.length)
  1637.       {
  1638.          this.__items.push(item);
  1639.       }
  1640.       else
  1641.       {
  1642.          this.__items.splice(index,0,item);
  1643.       }
  1644.       this._enableEvents = this._enableEvents - 1;
  1645.       var _loc8_ = this._event;
  1646.       this._trapProperties = true;
  1647.       try
  1648.       {
  1649.          this._propCage = item;
  1650.          var _loc3_ = undefined;
  1651.          for(var _loc6_ in this.__toProperties)
  1652.          {
  1653.             _loc3_ = this.__toProperties[_loc6_];
  1654.             if(rebuildIndx && (item[_loc6_] == null && this._calcFields[_loc6_] == null))
  1655.             {
  1656.                this.getField(_loc6_).setAsString(this.__toProperties[_loc6_].type.value);
  1657.             }
  1658.             else if(item[_loc6_] != null && pipeData)
  1659.             {
  1660.                this.getField(_loc6_).setTypedValue(new mx.data.binding.TypedValue(item[_loc6_],_loc3_.type.name,_loc3_.type));
  1661.             }
  1662.          }
  1663.       }
  1664.       finally
  1665.       {
  1666.          this._enableEvents = this._enableEvents + 1;
  1667.          this._event = _loc8_;
  1668.          this._trapProperties = false;
  1669.       }
  1670.       if(this._calcFields.__length__ > 0)
  1671.       {
  1672.          this.__curItem = item;
  1673.          this._loading = true;
  1674.          try
  1675.          {
  1676.             this.internalDispatchEvent("calcFields");
  1677.          }
  1678.          finally
  1679.          {
  1680.             this._loading = false;
  1681.          }
  1682.       }
  1683.       this._allowReslv = true;
  1684.       if(rebuildIndx)
  1685.       {
  1686.          this.rebuildItemIndexById();
  1687.       }
  1688.       return _loc7_;
  1689.    }
  1690.    function internalClearDeltaPacket(transId)
  1691.    {
  1692.       if(transId == undefined || transId.length == 0)
  1693.       {
  1694.          this._optDeltaItems = new Array();
  1695.          this._deltaItems = new Array();
  1696.          this._dpIndexByTransId = new Array();
  1697.          this._lastTransId = "";
  1698.          this._dpTransIdCount = 0;
  1699.          this._hasDelta = 0;
  1700.       }
  1701.       else
  1702.       {
  1703.          var _loc2_ = this._dpIndexByTransId[transId];
  1704.          if(_loc2_ != undefined)
  1705.          {
  1706.             var _loc6_ = this._dpIndexByTransId[_loc2_.prevId].index;
  1707.             _loc6_ = _loc6_ != _loc2_.index ? _loc6_ : 0;
  1708.             var _loc5_ = _loc2_.index - _loc6_;
  1709.             this._deltaItems.splice(_loc6_,_loc5_);
  1710.             var _loc3_ = this._lastTransId;
  1711.             while(_loc3_ != transId)
  1712.             {
  1713.                _loc2_ = this._dpIndexByTransId[_loc3_];
  1714.                _loc3_ = _loc2_.prevId;
  1715.                _loc2_.index -= _loc5_;
  1716.             }
  1717.             delete this._dpIndexByTransId[transId];
  1718.             this._dpTransIdCount = this._dpTransIdCount - 1;
  1719.             if(this._dpTransIdCount == 0)
  1720.             {
  1721.                this._lastTransId = "";
  1722.             }
  1723.          }
  1724.       }
  1725.    }
  1726.    function internalGetId()
  1727.    {
  1728.       return "IID" + String(Math.round(Math.random() * 100000000000));
  1729.    }
  1730.    function internalFirst()
  1731.    {
  1732.       this._iterator.first();
  1733.       var _loc2_ = this._iterator.next();
  1734.       this._iterator.previous();
  1735.       return _loc2_;
  1736.    }
  1737.    function internalRemoveItem(item)
  1738.    {
  1739.       this.checkReadOnly();
  1740.       var _loc2_ = this._itemIndexById[item[mx.data.components.DataSet.ItemId]];
  1741.       var _loc3_ = _loc2_ != undefined;
  1742.       var _loc4_ = this.internalDispatchEvent("removeItem",{result:true,item:item});
  1743.       _loc3_ = _loc4_ == null || _loc4_.result;
  1744.       if(_loc3_)
  1745.       {
  1746.          this.__items.splice(_loc2_,1);
  1747.          this.rebuildItemIndexById();
  1748.          if(this.__logChanges)
  1749.          {
  1750.             this.logRemoveItem(item,false);
  1751.          }
  1752.          _loc4_ = {eventName:"removeItems",firstItem:_loc2_,lastItem:_loc2_,removedIDs:new Array(item[mx.data.components.DataSet.ItemId])};
  1753.          this.resyncIterators(_loc4_);
  1754.          this._allowReslv = this.__items.length > 0;
  1755.          this.__curItem = this.getCurrentItem();
  1756.          this.internalDispatchEvent("modelChanged",_loc4_);
  1757.          if(this._enableEvents < 0 && this._event != null)
  1758.          {
  1759.             this._event.data.lastItem = _loc2_;
  1760.          }
  1761.       }
  1762.       return _loc3_;
  1763.    }
  1764.    function initIterators()
  1765.    {
  1766.       var _loc2_ = null;
  1767.       if(this._iterators != undefined)
  1768.       {
  1769.          _loc2_ = this._iterators[mx.data.components.DataSet.DefaultIterator].getFilterFunc();
  1770.       }
  1771.       this._iterators = new Array();
  1772.       this._iterator = new mx.data.components.datasetclasses.DataSetIterator(mx.data.components.DataSet.DefaultIterator,this);
  1773.       this._iterator.setFilterFunc(_loc2_);
  1774.       this._iterators[mx.data.components.DataSet.DefaultIterator] = this._iterator;
  1775.       this._iterator.first();
  1776.       this.__curItem = this._iterator.next();
  1777.    }
  1778.    function isValidElement(el)
  1779.    {
  1780.       return el.type.original == false;
  1781.    }
  1782.    function logAddItem(item, piped, id)
  1783.    {
  1784.       if(id == undefined)
  1785.       {
  1786.          id = item[mx.data.components.DataSet.ItemId];
  1787.       }
  1788.       var _loc2_ = new mx.data.components.datasetclasses.DeltaImpl(id,!piped ? this.decodeItem(item) : item,mx.data.components.datasetclasses.DeltaPacketConsts.Added);
  1789.       this._optDeltaItems[id] = _loc2_;
  1790.       this._deltaItems.push(Object(_loc2_));
  1791.       this._hasDelta = this._hasDelta + 1;
  1792.    }
  1793.    function logRemoveItem(item, piped, id)
  1794.    {
  1795.       if(id == undefined)
  1796.       {
  1797.          id = item[mx.data.components.DataSet.ItemId];
  1798.       }
  1799.       var _loc3_ = this._optDeltaItems[id];
  1800.       item = !piped ? this.decodeItem(item) : item;
  1801.       var _loc6_ = _loc3_ != undefined ? _loc3_.getSource() : item;
  1802.       var _loc5_ = new mx.data.components.datasetclasses.DeltaImpl(id,_loc6_,mx.data.components.datasetclasses.DeltaPacketConsts.Removed);
  1803.       this._deltaItems.push(Object(_loc5_));
  1804.       if(_loc3_ != undefined && _loc3_.getOperation() == mx.data.components.datasetclasses.DeltaPacketConsts.Added)
  1805.       {
  1806.          delete this._optDeltaItems[id];
  1807.          this._hasDelta = this._hasDelta - 1;
  1808.       }
  1809.       else
  1810.       {
  1811.          delete this._optDeltaItems[id];
  1812.          this._optDeltaItems[id] = _loc5_;
  1813.          this._hasDelta = this._hasDelta + 1;
  1814.       }
  1815.    }
  1816.    function rebuildItemIndexById()
  1817.    {
  1818.       this._itemIndexById = new Array();
  1819.       var _loc3_ = undefined;
  1820.       var _loc2_ = 0;
  1821.       while(_loc2_ < this.__items.length)
  1822.       {
  1823.          _loc3_ = this.__items[_loc2_];
  1824.          this._itemIndexById[_loc3_[mx.data.components.DataSet.ItemId]] = _loc2_;
  1825.          _loc2_ = _loc2_ + 1;
  1826.       }
  1827.    }
  1828.    function removeProxy()
  1829.    {
  1830.       var _loc2_ = undefined;
  1831.       for(var _loc3_ in this.__toProperties)
  1832.       {
  1833.          _loc2_ = this.__toProperties[_loc3_];
  1834.          delete this[_loc2_];
  1835.          delete this["get_" + _loc2_];
  1836.          delete this["set_" + _loc2_];
  1837.       }
  1838.    }
  1839.    function resyncIterators(info)
  1840.    {
  1841.       for(var _loc3_ in this._iterators)
  1842.       {
  1843.          this._iterators[_loc3_].modelChanged(info);
  1844.       }
  1845.    }
  1846.    function setFieldValue(fld, value, typeInf)
  1847.    {
  1848.       switch(typeof value)
  1849.       {
  1850.          case "string":
  1851.             fld.setAsString(value);
  1852.             break;
  1853.          case "boolean":
  1854.             fld.setAsBoolean(value);
  1855.             break;
  1856.          case "number":
  1857.             fld.setAsNumber(value);
  1858.             break;
  1859.          case "object":
  1860.             fld.setTypedValue(new mx.data.binding.TypedValue(value,typeInf.name,typeInf));
  1861.       }
  1862.    }
  1863.    function setPropertyValue(name, value)
  1864.    {
  1865.       if(this._trapProperties)
  1866.       {
  1867.          this._propCage[name] = value;
  1868.       }
  1869.       else
  1870.       {
  1871.          if(this._calcFields[name] != undefined)
  1872.          {
  1873.             this.__curItem[name] = value;
  1874.          }
  1875.          else
  1876.          {
  1877.             this.checkReadOnly();
  1878.             var _loc11_ = this.__curItem[name];
  1879.             if(_loc11_ != value)
  1880.             {
  1881.                if(this.__logChanges)
  1882.                {
  1883.                   var _loc8_ = this.getModDeltaInfo(this.__curItem[mx.data.components.DataSet.ItemId]);
  1884.                   this.__curItem[name] = value;
  1885.                   if(_loc8_.getOperation() == mx.data.components.datasetclasses.DeltaPacketConsts.Modified)
  1886.                   {
  1887.                      var _loc13_ = _loc8_.getItemByName(name);
  1888.                      if(_loc13_ != null)
  1889.                      {
  1890.                         _loc11_ = this.encodeValue(name,_loc13_.oldValue);
  1891.                      }
  1892.                      if(_loc11_ != value)
  1893.                      {
  1894.                         new mx.data.components.datasetclasses.DeltaItem(mx.data.components.datasetclasses.DeltaItem.Property,name,{oldValue:this.decodeValue(name,_loc11_),newValue:this.decodeValue(name,value),message:""},Object(_loc8_));
  1895.                      }
  1896.                      else if(_loc8_.getChangeList().length == 1)
  1897.                      {
  1898.                         this.removeDelta(_loc8_);
  1899.                      }
  1900.                      else
  1901.                      {
  1902.                         var _loc4_ = _loc8_.getChangeList();
  1903.                         if(_loc4_)
  1904.                         {
  1905.                            var _loc2_ = 0;
  1906.                            var _loc6_ = undefined;
  1907.                            var _loc9_ = false;
  1908.                            while(_loc2_ < _loc4_.length)
  1909.                            {
  1910.                               _loc6_ = _loc4_[_loc2_];
  1911.                               if(_loc6_.name == name)
  1912.                               {
  1913.                                  _loc9_ = true;
  1914.                                  break;
  1915.                               }
  1916.                               _loc2_ = _loc2_ + 1;
  1917.                            }
  1918.                            if(_loc9_)
  1919.                            {
  1920.                               _loc4_.splice(_loc2_,1);
  1921.                            }
  1922.                         }
  1923.                      }
  1924.                   }
  1925.                   else
  1926.                   {
  1927.                      _loc8_.getSource()[name] = this.decodeValue(name,value);
  1928.                   }
  1929.                }
  1930.                this.__curItem[name] = value;
  1931.             }
  1932.             if(this._calcFields.__length__ > 0)
  1933.             {
  1934.                this.internalDispatchEvent("calcFields");
  1935.             }
  1936.          }
  1937.          if(!this._loading)
  1938.          {
  1939.             var _loc14_ = this._itemIndexById[this.__curItem[mx.data.components.DataSet.ItemId]];
  1940.             var _loc7_ = {eventName:"updateField",fieldName:name,firstItem:_loc14_,lastItem:_loc14_};
  1941.             var _loc5_ = false;
  1942.             for(var _loc12_ in this._iterators)
  1943.             {
  1944.                _loc5_ = this._iterators[_loc12_].modelChanged(_loc7_) || _loc5_;
  1945.             }
  1946.             if(_loc5_)
  1947.             {
  1948.                this.internalDispatchEvent("modelChanged",{eventName:"sort"});
  1949.             }
  1950.             else
  1951.             {
  1952.                this.internalDispatchEvent("modelChanged",_loc7_);
  1953.             }
  1954.          }
  1955.       }
  1956.    }
  1957.    function removeSortInfo(fld, name)
  1958.    {
  1959.       if(fld.sortInfo != null)
  1960.       {
  1961.          delete fld.sortInfo[name];
  1962.       }
  1963.    }
  1964.    function removeDelta(d)
  1965.    {
  1966.       var _loc3_ = false;
  1967.       var _loc2_ = 0;
  1968.       while(!_loc3_ && _loc2_ < this._deltaItems.length)
  1969.       {
  1970.          _loc3_ = this._deltaItems[_loc2_] == d;
  1971.          _loc2_ = _loc2_ + 1;
  1972.       }
  1973.       if(_loc3_)
  1974.       {
  1975.          this._deltaItems.splice(_loc2_ = _loc2_ - 1,1);
  1976.          delete this._optDeltaItems[d.getId()];
  1977.          this._hasDelta = this._hasDelta - 1;
  1978.       }
  1979.       return _loc3_;
  1980.    }
  1981.    function __resolve(methodName)
  1982.    {
  1983.       var _loc3_ = null;
  1984.       if(this._allowReslv)
  1985.       {
  1986.          var propName = methodName.substring(4);
  1987.          if(methodName.substr(0,4) == "get_")
  1988.          {
  1989.             _loc3_ = function()
  1990.             {
  1991.                return this.getPropertyValue(propName);
  1992.             };
  1993.          }
  1994.          else if(methodName.substr(0,4) == "set_")
  1995.          {
  1996.             _loc3_ = function()
  1997.             {
  1998.                this.setPropertyValue(propName,arguments[0]);
  1999.             };
  2000.          }
  2001.          else
  2002.          {
  2003.             arguments.shift();
  2004.             _loc3_ = function()
  2005.             {
  2006.                this.__curItem[methodName].apply(this.__curItem,arguments);
  2007.                var _loc3_ = this.__curItem[mx.data.components.DataSet.ItemId];
  2008.                if(this.__logChanges)
  2009.                {
  2010.                   var _loc5_ = this.getModDeltaInfo(_loc3_);
  2011.                   new mx.data.components.datasetclasses.DeltaItem(mx.data.components.datasetclasses.DeltaItem.Method,methodName,{argList:arguments,message:""},Object(_loc5_));
  2012.                }
  2013.                var _loc4_ = this._itemIndexById[_loc3_];
  2014.                this.internalDispatchEvent("modelChanged",{eventName:"updateItems",firstItem:_loc4_,lastItem:_loc4_});
  2015.             };
  2016.          }
  2017.       }
  2018.       return _loc3_;
  2019.    }
  2020.    function updateItem(d)
  2021.    {
  2022.       var _loc8_ = d.getId();
  2023.       var _loc10_ = undefined;
  2024.       var _loc6_ = null;
  2025.       var _loc12_ = this.__logChanges;
  2026.       this.__logChanges = false;
  2027.       try
  2028.       {
  2029.          if(_loc8_ == null)
  2030.          {
  2031.             _loc10_ = d.getSource();
  2032.          }
  2033.          else
  2034.          {
  2035.             _loc10_ = {__ID__:_loc8_};
  2036.          }
  2037.          _loc6_ = this._iterator.find(_loc10_);
  2038.          if(_loc6_ != null)
  2039.          {
  2040.             var _loc9_ = this._itemIndexById[_loc6_[mx.data.components.DataSet.ItemId]];
  2041.             var _loc5_ = d.getChangeList();
  2042.             var _loc3_ = undefined;
  2043.             var _loc11_ = this.__curItem;
  2044.             try
  2045.             {
  2046.                this.__curItem = _loc6_;
  2047.                var _loc4_ = 0;
  2048.                while(_loc4_ < _loc5_.length)
  2049.                {
  2050.                   _loc3_ = mx.data.components.datasetclasses.DeltaItem(_loc5_[_loc4_]);
  2051.                   this.getField(_loc3_.name).setTypedValue(new mx.data.binding.TypedValue(_loc3_.curValue,this.__toProperties[_loc3_.name].type.name,this.__toProperties[_loc3_.name].type));
  2052.                   _loc4_ = _loc4_ + 1;
  2053.                }
  2054.             }
  2055.             finally
  2056.             {
  2057.                this.__curItem = _loc11_;
  2058.             }
  2059.             this.internalDispatchEvent("modelChanged",{eventName:"updateItems",firstIndex:_loc9_,lastIndex:_loc9_});
  2060.          }
  2061.          else
  2062.          {
  2063.             _global.__dataLogger.logData(null,"Couldn\'t find the following item:",d.getSource());
  2064.          }
  2065.       }
  2066.       finally
  2067.       {
  2068.          this.__logChanges = _loc12_;
  2069.       }
  2070.    }
  2071. }
  2072.