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

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

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.supportClasses.INavigationRenderer');
goog.require('org.apache.royale.utils.Language');



/**
 *  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.supportClasses.INavigationRenderer}
 */
org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer = function() {
  org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.base(this, 'constructor');
  this.typeNames = "jewel navigationlink";
};
goog.inherits(org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer, org.apache.royale.core.StyledMXMLItemRenderer);


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


/**
 * @private
 * @type {string}
 */
org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer__href = "#";


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


/**
 * @private
 * @type {Text}
 */
org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer_textNode;


/**
 * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
 * @royaleignorecoercion Text
 * @protected
 * @override
 */
org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.createElement = function() {
  var /** @type {Object} */ a = org.apache.royale.html.util.addElementToWrapper(this, 'a');
  a.setAttribute('href', this.href);
  if (this.MXMLDescriptor == null) {
    this.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer_textNode = document.createTextNode('');
    a.appendChild(this.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer_textNode);
  }
  return this.element;
};


/**
 * @asprivate
 * 
 * Styles are handled in CSS and usualy This renderer does not uses "selected" state
 * at least if the drawer is closed after selection.
 * @export
 * @override
 */
org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.updateRenderer = function() {
  if (this.hoverable)
    this.toggleClass("hovered", this.hovered);
};


org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.get__href = function() {
  return this.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer__href;
};


org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.set__href = function(value) {
  this.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer__href = value;
};


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


org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.set__text = function(value) {
  this.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer__text = value;
};


org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.set__data = function(value) {
  org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.superClass_.set__data.apply(this, [ value] );
  if (value == null)
    return;
  if (this.labelField) {
    this.text = String(value[this.labelField]);
  } else if (value.label !== undefined) {
    this.text = String(value.label);
  } else {
    this.text = String(value);
  }
  if (value.href !== undefined) {
    this.href = String(value.href);
  }
  if (this.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer_textNode != null) {
    this.org_apache_royale_jewel_itemRenderers_NavigationLinkItemRenderer_textNode.nodeValue = this.text;
    org.apache.royale.utils.Language.as(this.element, HTMLElement).setAttribute('href', this.href);
  }
  this.dispatchEvent(new org.apache.royale.events.Event("dataChange"));
};


Object.defineProperties(org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype, /** @lends {org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype} */ {
/**
  * @export
  * @type {string} */
href: {
get: org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.get__href,
set: org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.set__href},
/**
  * @export
  * @type {string} */
text: {
get: org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.get__text,
set: org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.set__text},
/**
  * @export
  * @type {Object} */
data: {
get: org.apache.royale.html.supportClasses.UIItemRendererBase.prototype.get__data,
set: org.apache.royale.jewel.itemRenderers.NavigationLinkItemRenderer.prototype.set__data}}
);


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



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