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

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

goog.require('org.apache.royale.core.IItemRendererClassFactory');
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.EventDispatcher');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.events.ItemRendererEvent');
goog.require('org.apache.royale.html.beads.IListView');
goog.require('org.apache.royale.html.beads.ITextItemRenderer');
goog.require('org.apache.royale.utils.loadBeadFromValuesManager');
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.0
 * @constructor
 * @extends {org.apache.royale.events.EventDispatcher}
 * @implements {org.apache.royale.core.IBead}
 * @param {Object=} target
 */
org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData = function(target) {
  target = typeof target !== 'undefined' ? target : null;
  org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.base(this, 'constructor', target);
};
goog.inherits(org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData, org.apache.royale.events.EventDispatcher);


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


/**
 * @private
 * @type {org.apache.royale.core.ISelectionModel}
 */
org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_selectionModel;


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


/**
 * @private
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_finishSetup = function(event) {
  this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_selectionModel = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__strand.getBeadByType(org.apache.royale.core.ISelectionModel), org.apache.royale.core.ISelectionModel);
  this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_selectionModel.addEventListener("dataProviderChanged", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_dataProviderChangeHandler, this, 'dataProviderChangeHandler'));
  if (!this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__itemRendererFactory) {
    this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__itemRendererFactory = org.apache.royale.utils.Language.as(org.apache.royale.utils.loadBeadFromValuesManager(org.apache.royale.core.IItemRendererClassFactory, "iItemRendererClassFactory", this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__strand), org.apache.royale.core.IItemRendererClassFactory);
  }
  this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_dataProviderChangeHandler(null);
};


/**
 * @private
 * @type {org.apache.royale.core.IItemRendererClassFactory}
 */
org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__itemRendererFactory;


/**
 * @protected
 * @type {org.apache.royale.core.IItemRendererParent}
 */
org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.dataGroup;


/**
 *  @royaleignorecoercion org.apache.royale.core.IStrandWithModelView
 *  @royaleignorecoercion org.apache.royale.core.IListView
 * @private
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_dataProviderChangeHandler = function(event) {
  var /** @type {Array} */ dp = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData_selectionModel.dataProvider, Array);
  var /** @type {org.apache.royale.html.beads.IListView} */ view = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__strand.view, org.apache.royale.html.beads.IListView);
  var /** @type {org.apache.royale.core.IItemRendererParent} */ dataGroup = view.dataGroup;
  dataGroup.removeAllItemRenderers();
  var /** @type {number} */ n = dp.length;
  for (var /** @type {number} */ i = 0; i < n; i++) {
    var /** @type {org.apache.royale.html.beads.ITextItemRenderer} */ tf = org.apache.royale.utils.Language.as(this.itemRendererFactory.createItemRenderer(dataGroup), org.apache.royale.html.beads.ITextItemRenderer);
    tf.index = i;
    dataGroup.addItemRenderer(tf, true);
    tf.text = org.apache.royale.utils.Language.string(dp[i]);
    var /** @type {org.apache.royale.events.ItemRendererEvent} */ newEvent = new org.apache.royale.events.ItemRendererEvent(org.apache.royale.events.ItemRendererEvent.CREATED);
    newEvent.itemRenderer = tf;
    this.dispatchEvent(newEvent);
  }
};


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


org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.get__itemRendererFactory = function() {
  if (!this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__itemRendererFactory)
    this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__itemRendererFactory = org.apache.royale.utils.Language.as(org.apache.royale.utils.loadBeadFromValuesManager(org.apache.royale.core.IItemRendererClassFactory, "iItemRendererClassFactory", this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__strand), org.apache.royale.core.IItemRendererClassFactory);
  return this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__itemRendererFactory;
};


org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.set__itemRendererFactory = function(value) {
  this.org_apache_royale_html_beads_TextItemRendererFactoryForStringVectorData__itemRendererFactory = value;
};


Object.defineProperties(org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype, /** @lends {org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.set__strand},
/**
  * @export
  * @type {org.apache.royale.core.IItemRendererClassFactory} */
itemRendererFactory: {
get: org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.get__itemRendererFactory,
set: org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.prototype.set__itemRendererFactory}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData.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.TextItemRendererFactoryForStringVectorData'},
        'itemRendererFactory': { type: 'org.apache.royale.core.IItemRendererClassFactory', access: 'readwrite', declaredBy: 'org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData'}
      };
    },
    methods: function () {
      return {
        'TextItemRendererFactoryForStringVectorData': { type: '', declaredBy: 'org.apache.royale.html.beads.TextItemRendererFactoryForStringVectorData', parameters: function () { return [  { index: 1, type: 'Object', optional: true } ]; }}
      };
    },
    metadata: function () { return [  ]; }
  };
};