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

goog.provide('org.apache.royale.jewel.beads.validators.SelectedItemNullValidator');

goog.require('org.apache.royale.core.IStrand');
goog.require('org.apache.royale.events.Event');
goog.require('org.apache.royale.jewel.beads.validators.Validator');
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.jewel.beads.validators.Validator}
 */
org.apache.royale.jewel.beads.validators.SelectedItemNullValidator = function() {
  org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.base(this, 'constructor');
};
goog.inherits(org.apache.royale.jewel.beads.validators.SelectedItemNullValidator, org.apache.royale.jewel.beads.validators.Validator);


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


/**
 *  Override of the base class validate() method to validate if selected.
 * 
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9.4
 * @export
 * @override
 */
org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.prototype.validate = function(event) {
  event = typeof event !== 'undefined' ? event : null;
  if (org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.superClass_.validate.apply(this, [ event] )) {
    if (this.hostComponent["selectedItem"] == null) {
      this.createErrorTip(this.requiredFieldError);
    } else {
      this.destroyErrorTip();
    }
  }
  return !this.isError;
};


org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.prototype.set__strand = function(value) {
  org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.superClass_.set__strand.apply(this, [ value] );
  this.hostComponent.addEventListener(org.apache.royale.events.Event.CHANGE, org.apache.royale.utils.Language.closure(this.validate, this, 'validate'), false);
};


Object.defineProperties(org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.prototype, /** @lends {org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.prototype} */ {
/**
  * @export
  * @type {org.apache.royale.core.IStrand} */
strand: {
set: org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.prototype.set__strand}}
);


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



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
org.apache.royale.jewel.beads.validators.SelectedItemNullValidator.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.jewel.beads.validators.SelectedItemNullValidator'}
      };
    },
    methods: function () {
      return {
        'SelectedItemNullValidator': { type: '', declaredBy: 'org.apache.royale.jewel.beads.validators.SelectedItemNullValidator'},
        'validate': { type: 'Boolean', declaredBy: 'org.apache.royale.jewel.beads.validators.SelectedItemNullValidator', parameters: function () { return [  { index: 1, type: 'org.apache.royale.events.Event', optional: true } ]; }}
      };
    }
  };
};