/**
 * Generated by Apache Royale Compiler from org\apache\royale\html\beads\DataProviderItemsChangeNotifier.as
 * org.apache.royale.html.beads.DataProviderItemsChangeNotifier
 *
 * @fileoverview
 *
 * @suppress {checkTypes|accessControls}
 */

goog.provide('org.apache.royale.html.beads.DataProviderItemsChangeNotifier');

goog.require('org.apache.royale.collections.ArrayList');
goog.require('org.apache.royale.core.ISelectionModel');
goog.require('org.apache.royale.events.CollectionEvent');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.html.supportClasses.DataProviderNotifierBase');
goog.require('org.apache.royale.utils.Language');



/**
 *  constructor.
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.0
 * @constructor
 * @extends {org.apache.royale.html.supportClasses.DataProviderNotifierBase}
 */
org.apache.royale.html.beads.DataProviderItemsChangeNotifier = function() {
  org.apache.royale.html.beads.DataProviderItemsChangeNotifier.base(this, 'constructor');
};
goog.inherits(org.apache.royale.html.beads.DataProviderItemsChangeNotifier, org.apache.royale.html.supportClasses.DataProviderNotifierBase);


/**
 * Prevent renaming of class. Needed for reflection.
 */
goog.exportSymbol('org.apache.royale.html.beads.DataProviderItemsChangeNotifier', org.apache.royale.html.beads.DataProviderItemsChangeNotifier);


/**
 * @protected
 * @override
 */
org.apache.royale.html.beads.DataProviderItemsChangeNotifier.prototype.destinationChangedHandler = function(event) {
  var /** @type {Object} */ object = this.document[this.sourceID];
  if (this.dataProvider) {
    if (object[this.propertyName] == this.dataProvider)
      return;
    this.dataProvider.removeEventListener(org.apache.royale.events.CollectionEvent.ITEM_ADDED, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemAdded, this, 'handleItemAdded'));
    this.dataProvider.removeEventListener(org.apache.royale.events.CollectionEvent.ITEM_REMOVED, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemRemoved, this, 'handleItemRemoved'));
    this.dataProvider.removeEventListener(org.apache.royale.events.CollectionEvent.ITEM_UPDATED, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemUpdated, this, 'handleItemUpdated'));
  }
  this.dataProvider = org.apache.royale.utils.Language.as(object[this.propertyName], org.apache.royale.collections.ArrayList);
  this.dataProvider.addEventListener(org.apache.royale.events.CollectionEvent.ITEM_ADDED, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemAdded, this, 'handleItemAdded'));
  this.dataProvider.addEventListener(org.apache.royale.events.CollectionEvent.ITEM_REMOVED, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemRemoved, this, 'handleItemRemoved'));
  this.dataProvider.addEventListener(org.apache.royale.events.CollectionEvent.ITEM_UPDATED, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemUpdated, this, 'handleItemUpdated'));
};


/**
 * @asprivate
 * @private
 * @param {org.apache.royale.events.CollectionEvent} event
 */
org.apache.royale.html.beads.DataProviderItemsChangeNotifier.prototype.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemAdded = function(event) {
  var /** @type {org.apache.royale.core.ISelectionModel} */ selectionModel = org.apache.royale.utils.Language.as(this._strand.getBeadByType(org.apache.royale.core.ISelectionModel), org.apache.royale.core.ISelectionModel);
  selectionModel.dispatchEvent(org.apache.royale.utils.Language.as(event.cloneEvent(), org.apache.royale.events.CollectionEvent));
};


/**
 * @asprivate
 * @private
 * @param {org.apache.royale.events.CollectionEvent} event
 */
org.apache.royale.html.beads.DataProviderItemsChangeNotifier.prototype.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemRemoved = function(event) {
  var /** @type {org.apache.royale.core.ISelectionModel} */ selectionModel = org.apache.royale.utils.Language.as(this._strand.getBeadByType(org.apache.royale.core.ISelectionModel), org.apache.royale.core.ISelectionModel);
  selectionModel.dispatchEvent(org.apache.royale.utils.Language.as(event.cloneEvent(), org.apache.royale.events.CollectionEvent));
};


/**
 * @asprivate
 * @private
 * @param {org.apache.royale.events.CollectionEvent} event
 */
org.apache.royale.html.beads.DataProviderItemsChangeNotifier.prototype.org_apache_royale_html_beads_DataProviderItemsChangeNotifier_handleItemUpdated = function(event) {
  var /** @type {org.apache.royale.core.ISelectionModel} */ selectionModel = org.apache.royale.utils.Language.as(this._strand.getBeadByType(org.apache.royale.core.ISelectionModel), org.apache.royale.core.ISelectionModel);
  selectionModel.dispatchEvent(org.apache.royale.utils.Language.as(event.cloneEvent(), org.apache.royale.events.CollectionEvent));
};


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
org.apache.royale.html.beads.DataProviderItemsChangeNotifier.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'DataProviderItemsChangeNotifier', qName: 'org.apache.royale.html.beads.DataProviderItemsChangeNotifier', kind: 'class' }] };



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.beads.DataProviderItemsChangeNotifier.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {return {};},
    methods: function () {
      return {
        'DataProviderItemsChangeNotifier': { type: '', declaredBy: 'org.apache.royale.html.beads.DataProviderItemsChangeNotifier'}
      };
    }
  };
};