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

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

goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('org.apache.royale.core.IRangeModel');
goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.core.UIBase');
goog.require('org.apache.royale.events.BrowserEvent');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.events.ValueChangeEvent');
goog.require('org.apache.royale.jewel.Slider');
goog.require('org.apache.royale.jewel.beads.controls.slider.ISliderView');
goog.require('org.apache.royale.jewel.beads.views.SliderView');
goog.require('org.apache.royale.core.IBead');
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.IBead}
 * @implements {org.apache.royale.core.IBeadController}
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController = function() {
};


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


/**
 * @private
 * @type {org.apache.royale.core.IRangeModel}
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel;


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


/**
 * @private
 * @type {number}
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.org_apache_royale_jewel_beads_controllers_SliderMouseController_oldValue;


/**
 * @private
 * @type {org.apache.royale.jewel.beads.controls.slider.ISliderView}
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.org_apache_royale_jewel_beads_controllers_SliderMouseController__sliderView;


/**
 * @asprivate
 * @royaleignorecoercion org.apache.royale.core.UIBase
 * @royaleignorecoercion org.apache.royale.core.IRangeModel
 * @private
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.org_apache_royale_jewel_beads_controllers_SliderMouseController_modelChangeHandler = function(event) {
  org.apache.royale.utils.Language.as(this.sliderView, org.apache.royale.jewel.beads.views.SliderView, true).redraw();
  if (org.apache.royale.utils.Language.is(event, org.apache.royale.events.ValueChangeEvent)) {
    org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand, org.apache.royale.events.IEventDispatcher, true).dispatchEvent(event.cloneEvent());
  }
};


/**
 *  Manages the change event to update the range model value
 *   
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9.4
 * @private
 * @param {org.apache.royale.events.BrowserEvent} event
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.org_apache_royale_jewel_beads_controllers_SliderMouseController_handleChange = function(event) {
  var /** @type {org.apache.royale.jewel.Slider} */ host = org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand, org.apache.royale.jewel.Slider);
  this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel.value = Number(org.apache.royale.utils.Language.as(org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand, org.apache.royale.core.UIBase, true).element, HTMLInputElement).value);
  org.apache.royale.utils.Language.as(this.sliderView, org.apache.royale.jewel.beads.views.SliderView, true).redraw();
};


/**
 *  Manages the input event to update the range model value and dispatch a input Royale event 
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9.4
 * @private
 * @param {org.apache.royale.events.BrowserEvent} event
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.org_apache_royale_jewel_beads_controllers_SliderMouseController_handleInput = function(event) {
  var /** @type {org.apache.royale.jewel.Slider} */ host = org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand, org.apache.royale.jewel.Slider);
  this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel.value = Number(org.apache.royale.utils.Language.as(org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand, org.apache.royale.core.UIBase, true).element, HTMLInputElement).value);
  host.dispatchEvent(new org.apache.royale.events.Event('input'));
  org.apache.royale.utils.Language.as(this.sliderView, org.apache.royale.jewel.beads.views.SliderView, true).redraw();
};


org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.get__sliderView = function() {
  return this.org_apache_royale_jewel_beads_controllers_SliderMouseController__sliderView;
};


org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.set__sliderView = function(value) {
  this.org_apache_royale_jewel_beads_controllers_SliderMouseController__sliderView = value;
};


org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.set__strand = function(value) {
  this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand = value;
  this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel = org.apache.royale.utils.Language.as(org.apache.royale.utils.Language.as(value, org.apache.royale.core.UIBase, true).model, org.apache.royale.core.IRangeModel);
  this.sliderView = org.apache.royale.utils.Language.as(value.getBeadByType(org.apache.royale.jewel.beads.controls.slider.ISliderView), org.apache.royale.jewel.beads.controls.slider.ISliderView);
  
  goog.events.listen(org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand, org.apache.royale.core.UIBase, true).element, goog.events.EventType.CHANGE, org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_handleChange, this, 'handleChange'), false, this);
  goog.events.listen(org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController__strand, org.apache.royale.core.UIBase, true).element, goog.events.EventType.INPUT, org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_handleInput, this, 'handleInput'), false, this);
  org.apache.royale.utils.Language.as(this.sliderView, org.apache.royale.jewel.beads.views.SliderView, true).redraw();
  org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel, org.apache.royale.events.IEventDispatcher, true).addEventListener("valueChange", org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_modelChangeHandler, this, 'modelChangeHandler'));
  org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel, org.apache.royale.events.IEventDispatcher, true).addEventListener("stepSizeChange", org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_modelChangeHandler, this, 'modelChangeHandler'));
  org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel, org.apache.royale.events.IEventDispatcher, true).addEventListener("minimumChange", org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_modelChangeHandler, this, 'modelChangeHandler'));
  org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel, org.apache.royale.events.IEventDispatcher, true).addEventListener("maximumChange", org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_modelChangeHandler, this, 'modelChangeHandler'));
  org.apache.royale.utils.Language.as(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_rangeModel, org.apache.royale.events.IEventDispatcher, true).addEventListener("valueChange", org.apache.royale.utils.Language.closure(this.org_apache_royale_jewel_beads_controllers_SliderMouseController_modelChangeHandler, this, 'modelChangeHandler'));
};


Object.defineProperties(org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype, /** @lends {org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.jewel.beads.controls.slider.ISliderView} */
sliderView: {
get: org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.get__sliderView,
set: org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.set__sliderView},
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.set__strand}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.jewel.beads.controllers.SliderMouseController.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'sliderView': { type: 'org.apache.royale.jewel.beads.controls.slider.ISliderView', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.beads.controllers.SliderMouseController'},
        'strand': { type: 'org.apache.royale.core.IStrand', access: 'writeonly', declaredBy: 'org.apache.royale.jewel.beads.controllers.SliderMouseController'}
      };
    },
    methods: function () {
      return {
        'SliderMouseController': { type: '', declaredBy: 'org.apache.royale.jewel.beads.controllers.SliderMouseController'}
      };
    }
  };
};