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

goog.provide('org.apache.royale.html.TextInput');

goog.require('goog.events');
goog.require('org.apache.royale.core.UIBase');
goog.require('org.apache.royale.core.WrappedHTMLElement');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.html.util.addElementToWrapper');
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.UIBase}
 */
org.apache.royale.html.TextInput = function() {
  org.apache.royale.html.TextInput.base(this, 'constructor');
  
};
goog.inherits(org.apache.royale.html.TextInput, org.apache.royale.core.UIBase);


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


/**
 * @private
 * @type {boolean}
 */
org.apache.royale.html.TextInput.prototype.org_apache_royale_html_TextInput_inSetter;


/**
 *  dispatch change event in response to a textChange event
 *
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.0
 * @export
 * @param {org.apache.royale.events.Event} event
 */
org.apache.royale.html.TextInput.prototype.textChangeHandler = function(event) {
  if (!this.org_apache_royale_html_TextInput_inSetter)
    this.dispatchEvent(new org.apache.royale.events.Event(org.apache.royale.events.Event.CHANGE));
};


/**
 * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
 * @protected
 * @override
 */
org.apache.royale.html.TextInput.prototype.createElement = function() {
  org.apache.royale.html.util.addElementToWrapper(this, 'input');
  this.element.setAttribute('type', 'text');
  this.typeNames = 'TextInput';
  goog.events.listen(this.element, 'input', org.apache.royale.utils.Language.closure(this.textChangeHandler, this, 'textChangeHandler'));
  return this.element;
};


org.apache.royale.html.TextInput.prototype.get__text = function() {
  
  return this.element.value;
};


org.apache.royale.html.TextInput.prototype.set__text = function(value) {
  
  this.element.value = value;
  this.dispatchEvent(new org.apache.royale.events.Event('textChange'));
};


org.apache.royale.html.TextInput.prototype.get__html = function() {
  
  return this.element.value;
};


org.apache.royale.html.TextInput.prototype.set__html = function(value) {
  
  this.element.value = value;
  this.dispatchEvent(new org.apache.royale.events.Event('textChange'));
};


Object.defineProperties(org.apache.royale.html.TextInput.prototype, /** @lends {org.apache.royale.html.TextInput.prototype} */ {
/**
  * @export
  * @type {string} */
text: {
get: org.apache.royale.html.TextInput.prototype.get__text,
set: org.apache.royale.html.TextInput.prototype.set__text},
/**
  * @export
  * @type {string} */
html: {
get: org.apache.royale.html.TextInput.prototype.get__html,
set: org.apache.royale.html.TextInput.prototype.set__html}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.TextInput.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'text': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.html.TextInput', metadata: function () { return [ { name: 'Bindable', args: [ { key: '', value: 'change' } ] } ]; }},
        'html': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.html.TextInput', metadata: function () { return [ { name: 'Bindable', args: [ { key: '', value: 'change' } ] } ]; }}
      };
    },
    methods: function () {
      return {
        'TextInput': { type: '', declaredBy: 'org.apache.royale.html.TextInput'},
        'textChangeHandler': { type: 'void', declaredBy: 'org.apache.royale.html.TextInput', parameters: function () { return [  { index: 1, type: 'org.apache.royale.events.Event', optional: false } ]; }}
      };
    },
    metadata: function () { return [  ]; }
  };
};