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

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

goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.core.UIBase');
goog.require('org.apache.royale.events.MouseEvent');
goog.require('org.apache.royale.html.ImageButton');
goog.require('org.apache.royale.html.beads.RangeStepperView');
goog.require('org.apache.royale.html.beads.models.RangeModel');
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.0
 * @constructor
 * @implements {org.apache.royale.core.IBeadController}
 */
org.apache.royale.html.beads.controllers.RangeStepperMouseController = function() {
};


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


/**
 * @private
 * @type {org.apache.royale.core.IStrand}
 */
org.apache.royale.html.beads.controllers.RangeStepperMouseController.prototype.org_apache_royale_html_beads_controllers_RangeStepperMouseController__strand;


/**
 * @private
 * @type {org.apache.royale.html.ImageButton}
 */
org.apache.royale.html.beads.controllers.RangeStepperMouseController.prototype.org_apache_royale_html_beads_controllers_RangeStepperMouseController__incrButton;


/**
 * @private
 * @type {org.apache.royale.html.ImageButton}
 */
org.apache.royale.html.beads.controllers.RangeStepperMouseController.prototype.org_apache_royale_html_beads_controllers_RangeStepperMouseController__decrButton;


/**
 * @private
 * @param {org.apache.royale.events.MouseEvent} event
 */
org.apache.royale.html.beads.controllers.RangeStepperMouseController.prototype.org_apache_royale_html_beads_controllers_RangeStepperMouseController_handleIncrClick = function(event) {
  var /** @type {org.apache.royale.html.beads.models.RangeModel} */ model = org.apache.royale.utils.Language.as(org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__strand, org.apache.royale.core.UIBase).model, org.apache.royale.html.beads.models.RangeModel);
  var /** @type {number} */ nextValue = model.value + 1;
  if (nextValue >= model.maximum)
    nextValue = model.maximum;
  model.value = nextValue;
};


/**
 * @private
 * @param {org.apache.royale.events.MouseEvent} event
 */
org.apache.royale.html.beads.controllers.RangeStepperMouseController.prototype.org_apache_royale_html_beads_controllers_RangeStepperMouseController_handleDecrClick = function(event) {
  var /** @type {org.apache.royale.html.beads.models.RangeModel} */ model = org.apache.royale.utils.Language.as(org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__strand, org.apache.royale.core.UIBase).model, org.apache.royale.html.beads.models.RangeModel);
  var /** @type {number} */ nextValue = model.value - 1;
  if (nextValue < model.minimum)
    nextValue = model.minimum;
  model.value = nextValue;
};


org.apache.royale.html.beads.controllers.RangeStepperMouseController.prototype.set__strand = function(value) {
  this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__strand = value;
  var /** @type {org.apache.royale.html.beads.RangeStepperView} */ stepperView = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__strand.getBeadByType(org.apache.royale.html.beads.RangeStepperView), org.apache.royale.html.beads.RangeStepperView);
  this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__incrButton = stepperView.incrementButton;
  this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__incrButton.addEventListener(org.apache.royale.events.MouseEvent.CLICK, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_controllers_RangeStepperMouseController_handleIncrClick, this, 'handleIncrClick'));
  this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__decrButton = stepperView.decrementButton;
  this.org_apache_royale_html_beads_controllers_RangeStepperMouseController__decrButton.addEventListener(org.apache.royale.events.MouseEvent.CLICK, org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_controllers_RangeStepperMouseController_handleDecrClick, this, 'handleDecrClick'));
};


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


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



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