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

goog.provide('org.apache.royale.jewel.ComboBox');

goog.require('org.apache.royale.core.IDataProviderModel');
goog.require('org.apache.royale.core.IListPresentationModel');
goog.require('org.apache.royale.core.ISelectionModel');
goog.require('org.apache.royale.core.StyledUIBase');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.jewel.beads.models.IJewelSelectionModel');
goog.require('org.apache.royale.jewel.beads.models.ListPresentationModel');
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.core.StyledUIBase}
 */
org.apache.royale.jewel.ComboBox = function() {
  org.apache.royale.jewel.ComboBox.base(this, 'constructor');
  this.typeNames = "jewel combobox";
  this.addEventListener('beadsAdded', org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_ComboBox_setupModelChangeListener, this, 'setupModelChangeListener'));
};
goog.inherits(org.apache.royale.jewel.ComboBox, org.apache.royale.core.StyledUIBase);


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


/**
 * @royaleignorecoercion org.apache.royale.events.IEventDispatcher;
 * @royaleignorecoercion org.apache.royale.jewel.beads.models.IJewelSelectionModel;
 * @private
 */
org.apache.royale.jewel.ComboBox.prototype.org_apache_royale_jewel_ComboBox_setupModelChangeListener = function() {
  this.removeEventListener('beadsAdded', org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_ComboBox_setupModelChangeListener, this, 'setupModelChangeListener'));
  org.apache.royale.utils.Language.as(this.model, org.apache.royale.events.IEventDispatcher, true).addEventListener('change', org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_ComboBox_modelChangeDispatcher, this, 'modelChangeDispatcher'));
  org.apache.royale.utils.Language.as(this.model, org.apache.royale.jewel.beads.models.IJewelSelectionModel, true).dispatchChangeOnDataProviderChange = true;
};


/**
 * @private
 * @type {boolean}
 */
org.apache.royale.jewel.ComboBox.prototype.org_apache_royale_jewel_ComboBox_respondingToProgrammaticChange;


/**
 * @private
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.jewel.ComboBox.prototype.org_apache_royale_jewel_ComboBox_modelChangeDispatcher = function(event) {
  this.org_apache_royale_jewel_ComboBox_respondingToProgrammaticChange = true;
  this.dispatchEvent(new org.apache.royale.events.Event("change"));
  this.org_apache_royale_jewel_ComboBox_respondingToProgrammaticChange = false;
};


org.apache.royale.jewel.ComboBox.prototype.get__labelField = function() {
  return this.model.labelField;
};


org.apache.royale.jewel.ComboBox.prototype.set__labelField = function(value) {
  this.model.labelField = value;
};


org.apache.royale.jewel.ComboBox.prototype.get__dataProvider = function() {
  return this.model.dataProvider;
};


org.apache.royale.jewel.ComboBox.prototype.set__dataProvider = function(value) {
  this.model.dataProvider = value;
};


org.apache.royale.jewel.ComboBox.prototype.get__selectedIndex = function() {
  return this.model.selectedIndex;
};


org.apache.royale.jewel.ComboBox.prototype.set__selectedIndex = function(value) {
  this.model.selectedIndex = value;
};


org.apache.royale.jewel.ComboBox.prototype.get__selectedItem = function() {
  return this.model.selectedItem;
};


org.apache.royale.jewel.ComboBox.prototype.set__selectedItem = function(value) {
  org.apache.royale.utils.Language.as(this.model, org.apache.royale.core.ISelectionModel, true).selectedItem = value;
};


org.apache.royale.jewel.ComboBox.prototype.get__presentationModel = function() {
  var /** @type {org.apache.royale.core.IListPresentationModel} */ presModel = this.getBeadByType(org.apache.royale.core.IListPresentationModel);
  if (presModel == null) {
    presModel = new org.apache.royale.jewel.beads.models.ListPresentationModel();
    this.addBead(presModel);
  }
  return presModel;
};


Object.defineProperties(org.apache.royale.jewel.ComboBox.prototype, /** @lends {org.apache.royale.jewel.ComboBox.prototype} */ {
/**
  * @export
  * @type {string} */
labelField: {
get: org.apache.royale.jewel.ComboBox.prototype.get__labelField,
set: org.apache.royale.jewel.ComboBox.prototype.set__labelField},
/**
  * @export
  * @type {Object} */
dataProvider: {
get: org.apache.royale.jewel.ComboBox.prototype.get__dataProvider,
set: org.apache.royale.jewel.ComboBox.prototype.set__dataProvider},
/**
  * @export
  * @type {number} */
selectedIndex: {
get: org.apache.royale.jewel.ComboBox.prototype.get__selectedIndex,
set: org.apache.royale.jewel.ComboBox.prototype.set__selectedIndex},
/**
  * @export
  * @type {Object} */
selectedItem: {
get: org.apache.royale.jewel.ComboBox.prototype.get__selectedItem,
set: org.apache.royale.jewel.ComboBox.prototype.set__selectedItem},
/**
  * @export
  * @type {org.apache.royale.core.IListPresentationModel} */
presentationModel: {
get: org.apache.royale.jewel.ComboBox.prototype.get__presentationModel}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.jewel.ComboBox.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'labelField': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.ComboBox'},
        'dataProvider': { type: 'Object', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.ComboBox'},
        'selectedIndex': { type: 'int', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.ComboBox', metadata: function () { return [ { name: 'Bindable', args: [ { key: '', value: 'change' } ] } ]; }},
        'selectedItem': { type: 'Object', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.ComboBox', metadata: function () { return [ { name: 'Bindable', args: [ { key: '', value: 'change' } ] } ]; }},
        'presentationModel': { type: 'org.apache.royale.core.IListPresentationModel', access: 'readonly', declaredBy: 'org.apache.royale.jewel.ComboBox'}
      };
    },
    methods: function () {
      return {
        'ComboBox': { type: '', declaredBy: 'org.apache.royale.jewel.ComboBox'}
      };
    },
    metadata: function () { return [  ]; }
  };
};