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

goog.provide('org.apache.royale.html.supportClasses.CascadingMenuItemRenderer');

goog.require('org.apache.royale.graphics.SolidColor');
goog.require('org.apache.royale.html.Label');
goog.require('org.apache.royale.html.supportClasses.DataItemRenderer');
goog.require('org.apache.royale.html.util.getLabelFromData');
goog.require('org.apache.royale.svg.Rect');
goog.require('org.apache.royale.html.beads.ITextItemRenderer');



/**
 * Constructor.
 *
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9
 * @constructor
 * @extends {org.apache.royale.html.supportClasses.DataItemRenderer}
 * @implements {org.apache.royale.html.beads.ITextItemRenderer}
 */
org.apache.royale.html.supportClasses.CascadingMenuItemRenderer = function() {
  org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.base(this, 'constructor');
  this.typeNames = "CascadingMenuItemRenderer";
};
goog.inherits(org.apache.royale.html.supportClasses.CascadingMenuItemRenderer, org.apache.royale.html.supportClasses.DataItemRenderer);


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


/**
 * @private
 * @type {org.apache.royale.html.Label}
 */
org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label;


/**
 * @private
 * @type {org.apache.royale.html.Label}
 */
org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator;


/**
 * @private
 * @type {boolean}
 */
org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_showingIndicator = false;


/**
 * @private
 * @type {org.apache.royale.svg.Rect}
 */
org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator;


/**
 * @asprivate
 * @export
 * @override
 */
org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.adjustSize = function() {
  var /** @type {number} */ cy = this.height / 2;
  if (this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label) {
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label.x = 0;
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label.y = cy - this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label.height / 2;
  }
  if (this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator) {
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator.x = this.width - this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator.width;
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator.y = cy - this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator.height / 2;
  }
  if (this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator) {
    this.setHeight(3, true);
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator.x = 0;
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator.y = 1;
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator.width = this.width;
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator.height = 1;
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator.draw();
  }
  this.updateRenderer();
};


org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.set__data = function(value) {
  org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.superClass_.set__data.apply(this, [ value] );
  var /** @type {boolean} */ isSeparator = false;
  if (this.data.hasOwnProperty("type")) {
    if (this.data["type"] == "separator")
      isSeparator = true;
  }
  if (isSeparator) {
    if (this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator == null) {
      this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator = new org.apache.royale.svg.Rect();
      this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator.fill = new org.apache.royale.graphics.SolidColor(0x000000);
      this.addElement(this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_separator);
    }
  } else {
    if (this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label == null) {
      this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label = new org.apache.royale.html.Label();
      this.addElement(this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label);
    }
    this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label.text = org.apache.royale.html.util.getLabelFromData(this, value);
    if (value.hasOwnProperty("menu")) {
      if (this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator == null) {
        this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator = new org.apache.royale.html.Label();
        this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator.text = "▶";
        this.addElement(this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_submenuIndicator);
      }
      
    }
  }
};


org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.get__text = function() {
  return this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label.text;
};


org.apache.royale.html.supportClasses.CascadingMenuItemRenderer.prototype.set__text = function(value) {
  this.org_apache_royale_html_supportClasses_CascadingMenuItemRenderer_label.text = this.text;
};


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


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



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