// Generated by github.com/steida/coffee2closure 0.1.12 goog.provide('spark.components.Checkbox'); goog.require('spark.components.Field'); /** Checkbox component of Spark Framework. @constructor @export @param {Object=} options Class options. @param {*=} data Class data @extends {spark.components.Field} */ spark.components.Checkbox = function(options, data) { var _ref; if (options == null) { options = {}; } options.type || (options.type = options['type'] || 'checkbox'); if (options.checked == null) { options.checked = (_ref = options['checked']) != null ? _ref : false; } spark.components.Checkbox.superClass_.constructor.call(this, options, data); if (options.checked === true) { this.check(); } } goog.inherits(spark.components.Checkbox, spark.components.Field); /** Check the element. @export */ spark.components.Checkbox.prototype.check = function() { this.getElement().checked = true; return this.emit('StateChanged', true); }; /** Uncheck the element. @export */ spark.components.Checkbox.prototype.uncheck = function() { this.getElement().checked = false; return this.emit('StateChanged', false); }; /** Returns element's checked state. @export @return {boolean} Checked state. */ spark.components.Checkbox.prototype.isChecked = function() { return this.getElement().checked; }; /** Returns element value. It's actually checked state. @export @return {boolean} Checked state. */ spark.components.Checkbox.prototype.getValue = function() { return this.isChecked(); };