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

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

goog.require('org.apache.royale.core.BeadViewBase');
goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.core.UIBase');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.graphics.SolidColorStroke');
goog.require('org.apache.royale.html.ImageButton');
goog.require('org.apache.royale.html.Label');
goog.require('org.apache.royale.html.beads.models.RangeModelExtended');
goog.require('org.apache.royale.svg.Rect');
goog.require('org.apache.royale.core.IBeadView');
goog.require('org.apache.royale.utils.Language');



/**
 *  constructor.
 *
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.0
 * @constructor
 * @extends {org.apache.royale.core.BeadViewBase}
 * @implements {org.apache.royale.core.IBeadView}
 */
org.apache.royale.html.beads.RangeStepperView = function() {
  org.apache.royale.html.beads.RangeStepperView.base(this, 'constructor');
};
goog.inherits(org.apache.royale.html.beads.RangeStepperView, org.apache.royale.core.BeadViewBase);


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


/**
 * @private
 * @type {org.apache.royale.html.Label}
 */
org.apache.royale.html.beads.RangeStepperView.prototype.org_apache_royale_html_beads_RangeStepperView__label;


/**
 * @private
 * @type {org.apache.royale.html.ImageButton}
 */
org.apache.royale.html.beads.RangeStepperView.prototype.org_apache_royale_html_beads_RangeStepperView__incrementButton;


/**
 * @private
 * @type {org.apache.royale.html.ImageButton}
 */
org.apache.royale.html.beads.RangeStepperView.prototype.org_apache_royale_html_beads_RangeStepperView__decrementButton;


/**
 * @private
 * @type {org.apache.royale.svg.Rect}
 */
org.apache.royale.html.beads.RangeStepperView.prototype.org_apache_royale_html_beads_RangeStepperView__labelBox;


/**
 * @private
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.beads.RangeStepperView.prototype.org_apache_royale_html_beads_RangeStepperView_sizeChangeHandler = function(event) {
  var /** @type {org.apache.royale.core.UIBase} */ host = org.apache.royale.utils.Language.as(this._strand, org.apache.royale.core.UIBase);
  this.org_apache_royale_html_beads_RangeStepperView__incrementButton.x = 0;
  this.org_apache_royale_html_beads_RangeStepperView__incrementButton.y = 0;
  this.org_apache_royale_html_beads_RangeStepperView__incrementButton.setWidthAndHeight(host.width, 20);
  this.org_apache_royale_html_beads_RangeStepperView__label.x = 0;
  this.org_apache_royale_html_beads_RangeStepperView__label.y = this.org_apache_royale_html_beads_RangeStepperView__incrementButton.height + 2;
  this.org_apache_royale_html_beads_RangeStepperView__label.setWidthAndHeight(host.width, host.height - 40, true);
  this.org_apache_royale_html_beads_RangeStepperView__labelBox.x = this.org_apache_royale_html_beads_RangeStepperView__label.x;
  this.org_apache_royale_html_beads_RangeStepperView__labelBox.y = this.org_apache_royale_html_beads_RangeStepperView__label.y - 2;
  this.org_apache_royale_html_beads_RangeStepperView__labelBox.drawRect(0, 0, this.org_apache_royale_html_beads_RangeStepperView__label.width - 1, this.org_apache_royale_html_beads_RangeStepperView__label.height);
  this.org_apache_royale_html_beads_RangeStepperView__decrementButton.x = 0;
  this.org_apache_royale_html_beads_RangeStepperView__decrementButton.y = host.height - 20;
  this.org_apache_royale_html_beads_RangeStepperView__decrementButton.setWidthAndHeight(host.width, 20);
};


/**
 * @private
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.beads.RangeStepperView.prototype.org_apache_royale_html_beads_RangeStepperView_handleValueChange = function(event) {
  var /** @type {org.apache.royale.html.beads.models.RangeModelExtended} */ model = org.apache.royale.utils.Language.as(org.apache.royale.utils.Language.as(this._strand, org.apache.royale.core.UIBase).model, org.apache.royale.html.beads.models.RangeModelExtended);
  this.org_apache_royale_html_beads_RangeStepperView__label.text = model.getLabelForIndex(model.value);
};


org.apache.royale.html.beads.RangeStepperView.prototype.get__incrementButton = function() {
  return this.org_apache_royale_html_beads_RangeStepperView__incrementButton;
};


org.apache.royale.html.beads.RangeStepperView.prototype.get__decrementButton = function() {
  return this.org_apache_royale_html_beads_RangeStepperView__decrementButton;
};


org.apache.royale.html.beads.RangeStepperView.prototype.set__strand = function(value) {
  org.apache.royale.html.beads.RangeStepperView.superClass_.set__strand.apply(this, [ value] );
  this._strand = value;
  var /** @type {org.apache.royale.core.UIBase} */ host = org.apache.royale.utils.Language.as(this._strand, org.apache.royale.core.UIBase);
  this.org_apache_royale_html_beads_RangeStepperView__labelBox = new org.apache.royale.svg.Rect();
  this.org_apache_royale_html_beads_RangeStepperView__labelBox.stroke = new org.apache.royale.graphics.SolidColorStroke();
  org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_RangeStepperView__labelBox.stroke, org.apache.royale.graphics.SolidColorStroke).color = 0x000000;
  org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_RangeStepperView__labelBox.stroke, org.apache.royale.graphics.SolidColorStroke).weight = 1.0;
  this.org_apache_royale_html_beads_RangeStepperView__incrementButton = new org.apache.royale.html.ImageButton();
  this.org_apache_royale_html_beads_RangeStepperView__incrementButton.src = "assets/up-arrow.png";
  this.org_apache_royale_html_beads_RangeStepperView__decrementButton = new org.apache.royale.html.ImageButton();
  this.org_apache_royale_html_beads_RangeStepperView__decrementButton.src = "assets/down-arrow.png";
  org.apache.royale.utils.Language.as(value, org.apache.royale.events.IEventDispatcher, true).addEventListener("widthChanged", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_RangeStepperView_sizeChangeHandler, this, 'sizeChangeHandler'));
  org.apache.royale.utils.Language.as(value, org.apache.royale.events.IEventDispatcher, true).addEventListener("heightChanged", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_RangeStepperView_sizeChangeHandler, this, 'sizeChangeHandler'));
  this.org_apache_royale_html_beads_RangeStepperView__label = new org.apache.royale.html.Label();
  host.addElement(this.org_apache_royale_html_beads_RangeStepperView__labelBox);
  host.addElement(this.org_apache_royale_html_beads_RangeStepperView__incrementButton);
  host.addElement(this.org_apache_royale_html_beads_RangeStepperView__decrementButton);
  host.addElement(this.org_apache_royale_html_beads_RangeStepperView__label);
  var /** @type {org.apache.royale.html.beads.models.RangeModelExtended} */ model = org.apache.royale.utils.Language.as(host.model, org.apache.royale.html.beads.models.RangeModelExtended);
  model.addEventListener("valueChange", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_RangeStepperView_handleValueChange, this, 'handleValueChange'));
  this.org_apache_royale_html_beads_RangeStepperView_sizeChangeHandler(null);
};


Object.defineProperties(org.apache.royale.html.beads.RangeStepperView.prototype, /** @lends {org.apache.royale.html.beads.RangeStepperView.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.html.ImageButton} */
incrementButton: {
get: org.apache.royale.html.beads.RangeStepperView.prototype.get__incrementButton},
/**
  * @export
  * @type {org.apache.royale.html.ImageButton} */
decrementButton: {
get: org.apache.royale.html.beads.RangeStepperView.prototype.get__decrementButton},
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.html.beads.RangeStepperView.prototype.set__strand}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.beads.RangeStepperView.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'incrementButton': { type: 'org.apache.royale.html.ImageButton', access: 'readonly', declaredBy: 'org.apache.royale.html.beads.RangeStepperView'},
        'decrementButton': { type: 'org.apache.royale.html.ImageButton', access: 'readonly', declaredBy: 'org.apache.royale.html.beads.RangeStepperView'},
        'strand': { type: 'org.apache.royale.core.IStrand', access: 'writeonly', declaredBy: 'org.apache.royale.html.beads.RangeStepperView'}
      };
    },
    methods: function () {
      return {
        'RangeStepperView': { type: '', declaredBy: 'org.apache.royale.html.beads.RangeStepperView'}
      };
    }
  };
};