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

goog.provide('org.apache.royale.jewel.itemRenderers.ListItemRenderer');

goog.require('org.apache.royale.core.StyledMXMLItemRenderer');
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.jewel.beads.controls.TextAlign');
goog.require('org.apache.royale.jewel.supportClasses.util.getLabelFromData');
goog.require('org.apache.royale.jewel.beads.itemRenderers.ITextItemRenderer');



/**
 *  constructor.
 *
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9.4
 * @constructor
 * @extends {org.apache.royale.core.StyledMXMLItemRenderer}
 * @implements {org.apache.royale.jewel.beads.itemRenderers.ITextItemRenderer}
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer = function() {
  org.apache.royale.jewel.itemRenderers.ListItemRenderer.base(this, 'constructor');
  this.typeNames = "jewel item";
  this.addClass("selectable");
  this.org_apache_royale_jewel_itemRenderers_ListItemRenderer_textAlign = new org.apache.royale.jewel.beads.controls.TextAlign();
  this.addBead(this.org_apache_royale_jewel_itemRenderers_ListItemRenderer_textAlign);
};
goog.inherits(org.apache.royale.jewel.itemRenderers.ListItemRenderer, org.apache.royale.core.StyledMXMLItemRenderer);


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


/**
 * @private
 * @type {string}
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.org_apache_royale_jewel_itemRenderers_ListItemRenderer__text = "";


/**
 * @protected
 * @type {Text}
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.textNode;


/**
 * @private
 * @type {org.apache.royale.jewel.beads.controls.TextAlign}
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.org_apache_royale_jewel_itemRenderers_ListItemRenderer_textAlign;


/**
 * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
 * @royaleignorecoercion Text
 * @protected
 * @override
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.createElement = function() {
  org.apache.royale.html.util.addElementToWrapper(this, 'li');
  if (this.MXMLDescriptor == null) {
    this.textNode = document.createTextNode('');
    this.element.appendChild(this.textNode);
  }
  return this.element;
};


/**
 * @private
 * @type {boolean}
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.org_apache_royale_jewel_itemRenderers_ListItemRenderer__selectable = true;


/**
 * @asprivate
 * @export
 * @override
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.updateRenderer = function() {
  if (this.hoverable)
    this.toggleClass("hovered", this.hovered);
  if (this.selectable)
    this.toggleClass("selected", this.selected);
};


org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.get__text = function() {
  return this.org_apache_royale_jewel_itemRenderers_ListItemRenderer__text;
};


org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__text = function(value) {
  this.org_apache_royale_jewel_itemRenderers_ListItemRenderer__text = value;
  if (this.textNode != null) {
    this.textNode.nodeValue = this.org_apache_royale_jewel_itemRenderers_ListItemRenderer__text;
  }
};


org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.get__align = function() {
  return this.org_apache_royale_jewel_itemRenderers_ListItemRenderer_textAlign.align;
};


org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__align = function(value) {
  this.org_apache_royale_jewel_itemRenderers_ListItemRenderer_textAlign.align = value;
};


org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__data = function(value) {
  org.apache.royale.jewel.itemRenderers.ListItemRenderer.superClass_.set__data.apply(this, [ value] );
  this.text = org.apache.royale.jewel.supportClasses.util.getLabelFromData(this, value);
  this.dispatchEvent(new org.apache.royale.events.Event("dataChange"));
};


org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.get__selectable = function() {
  return this.org_apache_royale_jewel_itemRenderers_ListItemRenderer__selectable;
};


org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__selectable = function(value) {
  this.org_apache_royale_jewel_itemRenderers_ListItemRenderer__selectable = value;
  this.toggleClass("selectable", this.org_apache_royale_jewel_itemRenderers_ListItemRenderer__selectable);
};


Object.defineProperties(org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype, /** @lends {org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype} */ {
/**
  * @export
  * @type {string} */
text: {
get: org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.get__text,
set: org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__text},
/**
  * @export
  * @type {string} */
align: {
get: org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.get__align,
set: org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__align},
/**
  * @export
  * @type {Object} */
data: {
get: org.apache.royale.html.supportClasses.UIItemRendererBase.prototype.get__data,
set: org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__data},
/**
  * @export
  * @type {boolean} */
selectable: {
get: org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.get__selectable,
set: org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.set__selectable}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.jewel.itemRenderers.ListItemRenderer.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {
      return {
        'text': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.itemRenderers.ListItemRenderer'},
        'align': { type: 'String', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.itemRenderers.ListItemRenderer'},
        'data': { type: 'Object', access: 'writeonly', declaredBy: 'org.apache.royale.jewel.itemRenderers.ListItemRenderer'},
        'selectable': { type: 'Boolean', access: 'readwrite', declaredBy: 'org.apache.royale.jewel.itemRenderers.ListItemRenderer'}
      };
    },
    methods: function () {
      return {
        'ListItemRenderer': { type: '', declaredBy: 'org.apache.royale.jewel.itemRenderers.ListItemRenderer'},
        'updateRenderer': { type: 'void', declaredBy: 'org.apache.royale.jewel.itemRenderers.ListItemRenderer'}
      };
    }
  };
};