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

goog.provide('org.apache.royale.jewel.beads.controllers.DropDownListController');

goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.events.ItemAddedEvent');
goog.require('org.apache.royale.events.ItemClickedEvent');
goog.require('org.apache.royale.events.ItemRemovedEvent');
goog.require('org.apache.royale.jewel.beads.models.DropDownListModel');
goog.require('org.apache.royale.jewel.beads.views.DropDownListView');
goog.require('org.apache.royale.core.IBeadController');
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
 * @implements {org.apache.royale.core.IBeadController}
 */
org.apache.royale.jewel.beads.controllers.DropDownListController = function() {
};


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


/**
 * @protected
 * @type {org.apache.royale.jewel.beads.models.DropDownListModel}
 */
org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.model;


/**
 * @protected
 * @type {org.apache.royale.jewel.beads.views.DropDownListView}
 */
org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.view;


/**
 * @private
 * @type {org.apache.royale.core.IStrand}
 */
org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.org_apache_royale_jewel_beads_controllers_DropDownListController__strand;


/**
 * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
 * @protected
 * @param {org.apache.royale.events.ItemAddedEvent} event
 */
org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.handleItemAdded = function(event) {
  event.item.addEventListener("itemClicked", org.apache.royale.utils.Language.closure(this.selectedHandler, this, 'selectedHandler'));
};


/**
 * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
 * @protected
 * @param {org.apache.royale.events.ItemRemovedEvent} event
 */
org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.handleItemRemoved = function(event) {
  event.item.removeEventListener("itemClicked", org.apache.royale.utils.Language.closure(this.selectedHandler, this, 'selectedHandler'));
};


/**
 * @protected
 * @param {org.apache.royale.events.ItemClickedEvent} event
 */
org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.selectedHandler = function(event) {
  this.model.selectedIndex = event.index;
  this.model.selectedItem = event.data;
  this.view.host.dispatchEvent(new org.apache.royale.events.Event(org.apache.royale.events.Event.CHANGE));
  org.apache.royale.utils.Language.trace(this.model, this.model.selectedIndex, this.model.selectedItem, this.view.host);
};


org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.set__strand = function(value) {
  this.org_apache_royale_jewel_beads_controllers_DropDownListController__strand = value;
  this.model = org.apache.royale.utils.Language.as(value.getBeadByType(org.apache.royale.jewel.beads.models.DropDownListModel), org.apache.royale.jewel.beads.models.DropDownListModel);
  org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_DropDownListController__strand, org.apache.royale.events.IEventDispatcher, true).addEventListener("itemAdded", org.apache.royale.utils.Language.closure(this.handleItemAdded, this, 'handleItemAdded'));
  org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_DropDownListController__strand, org.apache.royale.events.IEventDispatcher, true).addEventListener("itemRemoved", org.apache.royale.utils.Language.closure(this.handleItemRemoved, this, 'handleItemRemoved'));
};


Object.defineProperties(org.apache.royale.jewel.beads.controllers.DropDownListController.prototype, /** @lends {org.apache.royale.jewel.beads.controllers.DropDownListController.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.jewel.beads.controllers.DropDownListController.prototype.set__strand}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.jewel.beads.controllers.DropDownListController.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.jewel.beads.controllers.DropDownListController'}
      };
    },
    methods: function () {
      return {
        'DropDownListController': { type: '', declaredBy: 'org.apache.royale.jewel.beads.controllers.DropDownListController'}
      };
    }
  };
};