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

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

goog.require('org.apache.royale.core.IChild');
goog.require('org.apache.royale.core.ILayoutChild');
goog.require('org.apache.royale.core.ILayoutParent');
goog.require('org.apache.royale.core.IParent');
goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.events.IEventDispatcher');
goog.require('org.apache.royale.core.IBead');
goog.require('org.apache.royale.utils.Language');



/**
 * @constructor
 * @implements {org.apache.royale.core.IBead}
 */
org.apache.royale.html.beads.CenterElement = function() {
};


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


/**
 * @private
 * @type {org.apache.royale.core.IStrand}
 */
org.apache.royale.html.beads.CenterElement.prototype.org_apache_royale_html_beads_CenterElement__strand;


/**
 * @private
 * @param {org.apache.royale.events.Event} e
 */
org.apache.royale.html.beads.CenterElement.prototype.org_apache_royale_html_beads_CenterElement_layoutCompleteHandler = function(e) {
  var /** @type {number} */ childWidth = this.org_apache_royale_html_beads_CenterElement_host.width;
  var /** @type {number} */ parentWidth = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_CenterElement_host.parent, org.apache.royale.core.ILayoutChild).width;
  var /** @type {number} */ childHeight = this.org_apache_royale_html_beads_CenterElement_host.height;
  var /** @type {number} */ parentHeight = org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_CenterElement_host.parent, org.apache.royale.core.ILayoutChild).height;
  this.org_apache_royale_html_beads_CenterElement_host.x = (parentWidth - childWidth) / 2;
  this.org_apache_royale_html_beads_CenterElement_host.y = (parentHeight - childHeight) / 2;
};


/**
 * @private
 * @param {org.apache.royale.core.IParent} value
 * @return {org.apache.royale.core.ILayoutParent}
 */
org.apache.royale.html.beads.CenterElement.prototype.org_apache_royale_html_beads_CenterElement_getLayoutParent = function(value) {
  while (value) {
    if (org.apache.royale.utils.Language.is(value, org.apache.royale.core.ILayoutParent)) {
      return org.apache.royale.utils.Language.as(value, org.apache.royale.core.ILayoutParent);
    }
    value = org.apache.royale.utils.Language.as(value, org.apache.royale.core.IChild, true).parent;
  }
  return null;
};


org.apache.royale.html.beads.CenterElement.prototype.set__strand = function(value) {
  this.org_apache_royale_html_beads_CenterElement__strand = value;
  var /** @type {org.apache.royale.core.ILayoutParent} */ layoutParent = this.org_apache_royale_html_beads_CenterElement_getLayoutParent(org.apache.royale.utils.Language.as(value, org.apache.royale.core.IChild).parent);
  org.apache.royale.utils.Language.as(layoutParent, org.apache.royale.events.IEventDispatcher, true).addEventListener('layoutComplete', org.apache.royale.utils.Language.closure(this.org_apache_royale_html_beads_CenterElement_layoutCompleteHandler, this, 'layoutCompleteHandler'));
};


org.apache.royale.html.beads.CenterElement.prototype.get__org_apache_royale_html_beads_CenterElement_host = function() {
  return org.apache.royale.utils.Language.as(this.org_apache_royale_html_beads_CenterElement__strand, org.apache.royale.core.ILayoutChild);
};


Object.defineProperties(org.apache.royale.html.beads.CenterElement.prototype, /** @lends {org.apache.royale.html.beads.CenterElement.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.html.beads.CenterElement.prototype.set__strand},
/**
  * @export
  * @type {org.apache.royale.core.ILayoutChild} */
org_apache_royale_html_beads_CenterElement_host: {
get: org.apache.royale.html.beads.CenterElement.prototype.get__org_apache_royale_html_beads_CenterElement_host}}
);


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



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