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

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

goog.require('org.apache.royale.collections.ArrayList');
goog.require('org.apache.royale.core.ISelectionModel');
goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.core.UIBase');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.html.beads.DataProviderChangeNotifier');
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.beads.DataProviderChangeNotifier}
 */
org.apache.royale.html.beads.EasyDataProviderChangeNotifier = function() {
  org.apache.royale.html.beads.EasyDataProviderChangeNotifier.base(this, 'constructor');
  this.changeEventName = "dataProviderChanged";
};
goog.inherits(org.apache.royale.html.beads.EasyDataProviderChangeNotifier, org.apache.royale.html.beads.DataProviderChangeNotifier);


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


/**
 * @protected
 * @override
 */
org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype.destinationChangedHandler = function(event) {
  if (!this.dataProvider) {
    this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_setDataProvider();
    if (!this.dataProvider && !this.changeEventName)
      this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel.addEventListener("dataProviderChanged", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_setFirstDataProvider, this, 'setFirstDataProvider'));
  } else {
    if (this.dataProvider == this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel.dataProvider)
      return;
    this.detachEventListeners();
    this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_setDataProvider();
    this.attachEventListeners();
  }
};


/**
 * @private
 * @param {org.apache.royale.events.Event} e
 */
org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_setFirstDataProvider = function(e) {
  this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_setDataProvider();
  this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel.removeEventListener("dataProviderChanged", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_setFirstDataProvider, this, 'setFirstDataProvider'));
};


/**
 * @royaleignorecoercion org.apache.royale.collections.ArrayList
 * @private
 */
org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_setDataProvider = function() {
  this.dataProvider = this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel.dataProvider;
  if (this.dataProvider)
    this.attachEventListeners();
};


org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype.set__strand = function(value) {
  this._strand = value;
  if (this.changeEventName)
    this.org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel.addEventListener(this.changeEventName, org.apache.royale.utils.Language.closure(this.destinationChangedHandler, this, 'destinationChangedHandler'));
  this.destinationChangedHandler(null);
};


org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype.get__org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel = function() {
  return this._strand.model;
};


Object.defineProperties(org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype, /** @lends {org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype.set__strand},
/**
  * @export
  * @type {org.apache.royale.core.ISelectionModel} */
org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel: {
get: org.apache.royale.html.beads.EasyDataProviderChangeNotifier.prototype.get__org_apache_royale_html_beads_EasyDataProviderChangeNotifier_selectionModel}}
);


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



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