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

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

goog.require('org.apache.royale.core.IDataProviderModel');
goog.require('org.apache.royale.core.IItemRendererParent');
goog.require('org.apache.royale.core.ISelectionModel');
goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.core.IStrandWithModelView');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.html.beads.IListView');
goog.require('org.apache.royale.core.IBead');
goog.require('org.apache.royale.utils.Language');



/**
 * Constructor
 *
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9.0
 * @constructor
 * @implements {org.apache.royale.core.IBead}
 */
org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData = function() {
};


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


/**
 * @private
 * @type {org.apache.royale.core.IStrand}
 */
org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__strand;


/**
 *  finish setup
 *
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.8
 * @protected
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.initComplete = function(event) {
  org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__strand, org.apache.royale.events.IEventDispatcher, true).removeEventListener("initComplete", org.apache.royale.utils.Language.closure(this.initComplete, this, 'initComplete'));
  this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__dataProviderModel = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__strand.getBeadByType(org.apache.royale.core.ISelectionModel), org.apache.royale.core.ISelectionModel);
  this.dataProviderModel.addEventListener("dataProviderChanged", org.apache.royale.utils.Language.closure(this.dataProviderChangeHandler, this, 'dataProviderChangeHandler'));
  this.dataProviderChangeHandler(null);
};


/**
 * @asprivate
 * @protected
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.dataProviderChangeHandler = function(event) {
  var /** @type {org.apache.royale.events.IEventDispatcher} */ dp = org.apache.royale.utils.Language.as(this.dataProviderModel.dataProvider, org.apache.royale.events.IEventDispatcher);
  if (!dp) {
    if (org.apache.royale.utils.Language.is(this.dataProviderModel, org.apache.royale.core.ISelectionModel)) {
      var /** @type {org.apache.royale.core.ISelectionModel} */ model = org.apache.royale.utils.Language.as(this.dataProviderModel, org.apache.royale.core.ISelectionModel);
      model.selectedIndex = -1;
      model.selectedItem = null;
    }
    this.itemRendererParent.removeAllItemRenderers();
    org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__strand, org.apache.royale.events.IEventDispatcher).dispatchEvent(new org.apache.royale.events.Event("layoutNeeded"));
  }
};


/**
 * @private
 * @type {org.apache.royale.core.IDataProviderModel}
 */
org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__dataProviderModel;


/**
 * @private
 * @type {org.apache.royale.core.IItemRendererParent}
 */
org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__itemRendererParent;


org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.set__strand = function(value) {
  this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__strand = value;
  org.apache.royale.utils.Language.as(value, org.apache.royale.events.IEventDispatcher, true).addEventListener("initComplete", org.apache.royale.utils.Language.closure(this.initComplete, this, 'initComplete'));
};


org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.get__dataProviderModel = function() {
  if (this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__dataProviderModel == null) {
    this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__dataProviderModel = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__strand.getBeadByType(org.apache.royale.core.IDataProviderModel), org.apache.royale.core.IDataProviderModel);
  }
  return this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__dataProviderModel;
};


org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.get__itemRendererParent = function() {
  if (this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__itemRendererParent == null) {
    var /** @type {org.apache.royale.html.beads.IListView} */ view = this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__strand.view;
    this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__itemRendererParent = view.dataGroup;
  }
  return this.org_apache_royale_html_beads_DynamicRemoveAllByNullItemRendererForArrayListData__itemRendererParent;
};


Object.defineProperties(org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype, /** @lends {org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.set__strand},
/**
  * @export
  * @type {org.apache.royale.core.IDataProviderModel} */
dataProviderModel: {
get: org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.get__dataProviderModel},
/**
  * @export
  * @type {org.apache.royale.core.IItemRendererParent} */
itemRendererParent: {
get: org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.prototype.get__itemRendererParent}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData.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.DynamicRemoveAllByNullItemRendererForArrayListData'},
        'dataProviderModel': { type: 'org.apache.royale.core.IDataProviderModel', access: 'readonly', declaredBy: 'org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData'},
        'itemRendererParent': { type: 'org.apache.royale.core.IItemRendererParent', access: 'readonly', declaredBy: 'org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData'}
      };
    },
    methods: function () {
      return {
        'DynamicRemoveAllByNullItemRendererForArrayListData': { type: '', declaredBy: 'org.apache.royale.html.beads.DynamicRemoveAllByNullItemRendererForArrayListData'}
      };
    }
  };
};