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

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

goog.require('org.apache.royale.core.IDataGridModel');
goog.require('org.apache.royale.core.UIBase');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.html.DataGridButtonBar');
goog.require('org.apache.royale.html.beads.DataGridView');
goog.require('org.apache.royale.html.beads.models.ButtonBarModel');
goog.require('org.apache.royale.html.supportClasses.IDataGridColumn');
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.html.beads.DataGridView}
 */
org.apache.royale.html.beads.DataGridPercentageView = function() {
  org.apache.royale.html.beads.DataGridPercentageView.base(this, 'constructor');
};
goog.inherits(org.apache.royale.html.beads.DataGridPercentageView, org.apache.royale.html.beads.DataGridView);


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


/**
 * @asprivate
 * @protected
 * @override
 */
org.apache.royale.html.beads.DataGridPercentageView.prototype.handleInitComplete = function(event) {
  org.apache.royale.html.beads.DataGridPercentageView.superClass_.handleInitComplete.apply(this, [ event] );
  if (this.columnLists) {
    var /** @type {org.apache.royale.core.UIBase} */ host = org.apache.royale.utils.Language.as(this._strand, org.apache.royale.core.UIBase);
    var /** @type {org.apache.royale.core.IDataGridModel} */ sharedModel = org.apache.royale.utils.Language.as(host.model, org.apache.royale.core.IDataGridModel);
    var /** @type {number} */ columnListCount = sharedModel.columns.length;
    var /** @type {Array} */ buttonWidths = [];
    for (var /** @type {number} */ i = 0; i < columnListCount; i++) {
      var /** @type {org.apache.royale.html.supportClasses.IDataGridColumn} */ dgc = org.apache.royale.utils.Language.as(sharedModel.columns[i], org.apache.royale.html.supportClasses.IDataGridColumn);
      var /** @type {number} */ colWidth = dgc.columnWidth;
      buttonWidths.push(colWidth);
      var /** @type {org.apache.royale.core.UIBase} */ list = org.apache.royale.utils.Language.as(this.columnLists[i], org.apache.royale.core.UIBase);
      if (!isNaN(dgc.columnWidth)) {
        list.width = NaN;
        list.percentWidth = Number(colWidth);
      }
    }
    var /** @type {org.apache.royale.html.DataGridButtonBar} */ dgButtonBar = org.apache.royale.utils.Language.as(this.header, org.apache.royale.html.DataGridButtonBar);
    dgButtonBar.buttonWidths = buttonWidths;
    dgButtonBar.widthType = org.apache.royale.html.beads.models.ButtonBarModel.PERCENT_WIDTHS;
    dgButtonBar.dispatchEvent(new org.apache.royale.events.Event("layoutNeeded"));
  }
};


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.html.beads.DataGridPercentageView.prototype.ROYALE_REFLECTION_INFO = function () {
  return {
    variables: function () {return {};},
    accessors: function () {return {};},
    methods: function () {
      return {
        'DataGridPercentageView': { type: '', declaredBy: 'org.apache.royale.html.beads.DataGridPercentageView'}
      };
    }
  };
};