// Generated by github.com/steida/coffee2closure 0.1.12 goog.provide('spark.components.Textarea'); goog.require('spark.components.Field'); goog.require('goog.ui.Textarea'); /** Texarea component of the framework. Extended from Field component to be consistent with rest of the framework. However it uses `goog.ui.Textarea` in the background. This is because goog handles resizing the textarea to fit its content pretty good. This might be a disadvantage for the filesize. I need to consider it in the future. @constructor @export @param {Object=} options Class options. @param {*=} data Class data @extends {spark.components.Field} */ spark.components.Textarea = function(options, data) { if (options == null) { options = {}; } options.tagName = options['tagName'] = 'textarea'; this.getCssClass(options, 'textarea'); spark.components.Textarea.superClass_.constructor.call(this, options, data); this.decorate_(); this.resize(); } goog.inherits(spark.components.Textarea, spark.components.Field); /** Decore our textarea from `goog.ui.Textarea`. This is the painless way to resize the textarea to fit its content. @protected */ spark.components.Textarea.prototype.decorate_ = function() { this.textarea_ = new goog.ui.Textarea(this.getOptions().value); return this.textarea_.decorate(this.getElement()); }; /** Sets the value and calls the resize method to adjust height of the textarea. @export @override */ spark.components.Textarea.prototype.setValue = function(value) { spark.components.Textarea.superClass_.setValue.apply(this, arguments); return this.resize(); }; /** Helper method to resize textarea to fit height for the value inside. @export */ spark.components.Textarea.prototype.resize = function() { if (!this.textarea_) { return; } return this.textarea_.resize(); }; /** Disposes the goog.ui.Textarea instance and calls the super to continue. @export @override */ spark.components.Textarea.prototype.destroy = function() { if (!this.isDestroyed()) { this.textarea_.disposeInternal(); this.textarea_ = null; } return spark.components.Textarea.superClass_.destroy.apply(this, arguments); };