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

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

goog.require('org.apache.royale.core.BeadViewBase');
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.Event');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.html.beads.controllers.SpinnerMouseController');
goog.require('org.apache.royale.html.supportClasses.SpinnerButton');
goog.require('org.apache.royale.core.IBeadView');
goog.require('org.apache.royale.html.beads.ISpinnerView');
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.html.beads.ISpinnerView}
 * @implements {org.apache.royale.core.IBeadView}
 */
org.apache.royale.html.beads.SpinnerView = function() {
  org.apache.royale.html.beads.SpinnerView.base(this, 'constructor');
};
goog.inherits(org.apache.royale.html.beads.SpinnerView, org.apache.royale.core.BeadViewBase);


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


/**
 * @private
 * @type {org.apache.royale.core.IRangeModel}
 */
org.apache.royale.html.beads.SpinnerView.prototype.org_apache_royale_html_beads_SpinnerView_rangeModel;


/**
 * @asprivate
 * @royaleignorecoercion org.apache.royale.core.UIBase
 * @private
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.beads.SpinnerView.prototype.org_apache_royale_html_beads_SpinnerView_sizeChangeHandler = function(event) {
  var /** @type {number} */ w = this._strand.width;
  var /** @type {number} */ h = this._strand.height / 2;
  this._increment.width = w;
  this._increment.height = h;
  
  this._decrement.width = w;
  this._decrement.height = h;
  
};


org.apache.royale.html.beads.SpinnerView.prototype.set__strand = function(value) {
  org.apache.royale.html.beads.SpinnerView.superClass_.set__strand.apply(this, [ value] );
  
  value.addEventListener("widthChanged", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_SpinnerView_sizeChangeHandler, this, 'sizeChangeHandler'));
  value.addEventListener("heightChanged", org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_SpinnerView_sizeChangeHandler, this, 'sizeChangeHandler'));
  var /** @type {Object} */ host = value;
  host.element.style.position = "absolute";
  this._increment = new org.apache.royale.html.supportClasses.SpinnerButton();
  this._increment.text = '▲';
  this._increment.positioner.style.display = 'block';
  this._decrement = new org.apache.royale.html.supportClasses.SpinnerButton();
  this._decrement.text = '▼';
  this._decrement.positioner.style.display = 'block';
  host.addElement(this._increment);
  host.addElement(this._decrement);
  this.org_apache_royale_html_beads_SpinnerView_controller = new org.apache.royale.html.beads.controllers.SpinnerMouseController();
  host.addBead(this.org_apache_royale_html_beads_SpinnerView_controller);
  
  this.org_apache_royale_html_beads_SpinnerView_sizeChangeHandler(null);
};


org.apache.royale.html.beads.SpinnerView.prototype.get__decrement = function() {
  return this._decrement;
};


org.apache.royale.html.beads.SpinnerView.prototype.get__increment = function() {
  return this._increment;
};


Object.defineProperties(org.apache.royale.html.beads.SpinnerView.prototype, /** @lends {org.apache.royale.html.beads.SpinnerView.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.html.beads.SpinnerView.prototype.set__strand},
/**
  * @export
  * @type {org.apache.royale.html.supportClasses.SpinnerButton} */
decrement: {
get: org.apache.royale.html.beads.SpinnerView.prototype.get__decrement},
/**
  * @export
  * @type {org.apache.royale.html.supportClasses.SpinnerButton} */
increment: {
get: org.apache.royale.html.beads.SpinnerView.prototype.get__increment}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.beads.SpinnerView.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.SpinnerView'},
        'decrement': { type: 'org.apache.royale.html.supportClasses.SpinnerButton', access: 'readonly', declaredBy: 'org.apache.royale.html.beads.SpinnerView'},
        'increment': { type: 'org.apache.royale.html.supportClasses.SpinnerButton', access: 'readonly', declaredBy: 'org.apache.royale.html.beads.SpinnerView'}
      };
    },
    methods: function () {
      return {
        'SpinnerView': { type: '', declaredBy: 'org.apache.royale.html.beads.SpinnerView'}
      };
    }
  };
};