/**
 * Generated by Apache Royale Compiler from org\apache\royale\jewel\itemRenderers\DropDownListItemRenderer.as
 * org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer
 *
 * @fileoverview
 *
 * @suppress {checkTypes|accessControls}
 */

goog.provide('org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer');

goog.require('org.apache.royale.core.WrappedHTMLElement');
goog.require('org.apache.royale.html.elements.Option');
goog.require('org.apache.royale.html.supportClasses.MXMLItemRenderer');
goog.require('org.apache.royale.jewel.beads.views.DropDownListView');
goog.require('org.apache.royale.utils.Language');



/**
 *  Constructor.
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9.4
 * @constructor
 * @extends {org.apache.royale.html.supportClasses.MXMLItemRenderer}
 */
org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer = function() {
  org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.base(this, 'constructor');
  this.typeNames = "jewel item";
};
goog.inherits(org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer, org.apache.royale.html.supportClasses.MXMLItemRenderer);


/**
 * Prevent renaming of class. Needed for reflection.
 */
goog.exportSymbol('org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer', org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer);


/**
 * @export
 * @const
 * @type {string}
 */
org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.OPTION_DISABLED = "DropDownList.Select.Default.Prompt";


/**
 * @private
 * @type {org.apache.royale.html.elements.Option}
 */
org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.prototype.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item;


/**
 * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
 * @protected
 * @override
 */
org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.prototype.createElement = function() {
  this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item = new org.apache.royale.html.elements.Option();
  this.element = this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.element;
  return this.element;
};


org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.prototype.set__data = function(value) {
  org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.superClass_.set__data.apply(this, [ value] );
  if (value == org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.OPTION_DISABLED) {
    var /** @type {org.apache.royale.jewel.beads.views.DropDownListView} */ view = org.apache.royale.utils.Language.as(this.itemRendererParent, org.apache.royale.jewel.beads.views.DropDownListView, true);
    this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.element.setAttribute("selected", "");
    this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.element.setAttribute("hidden", "");
    this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.text = view.prompt;
  } else {
    if (this.labelField) {
      this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.text = String(value[this.labelField]);
    } else {
      this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.text = String(value);
    }
    if (this.dataField) {
      this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.element["value"] = String(value[this.dataField]);
    } else {
      this.org_apache_royale_jewel_itemRenderers_DropDownListItemRenderer_item.element["value"] = String(value);
    }
  }
};


Object.defineProperties(org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.prototype, /** @lends {org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.prototype} */ {
/**
  * @export
  * @type {Object} */
data: {
get: org.apache.royale.html.supportClasses.UIItemRendererBase.prototype.get__data,
set: org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.prototype.set__data}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'data': { type: 'Object', access: 'writeonly', declaredBy: 'org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer'}
      };
    },
    methods: function () {
      return {
        'DropDownListItemRenderer': { type: '', declaredBy: 'org.apache.royale.jewel.itemRenderers.DropDownListItemRenderer'}
      };
    }
  };
};