// Generated by github.com/steida/coffee2closure 0.1.12 goog.provide('spark.components.Field'); goog.require('spark.core.View'); /** Base field class for input element types in Spark Framework. */ /** @constructor @export @param {Object=} options Class options. @param {*=} data Class data @extends {spark.core.View} */ spark.components.Field = function(options, data) { if (options == null) { options = {}; } options.tagName || (options.tagName = options['tagName'] || 'input'); options.type || (options.type = options['type'] || 'text'); options.name || (options.name = options['name'] || null); options.value || (options.value = options['value'] || ""); this.getCssClass(options, "input " + options.type); spark.components.Field.superClass_.constructor.call(this, options, data); this.setAttribute('type', options.type); if (options.value) { this.setValue(options.value); } if (options.name) { this.setName(options.name); } } goog.inherits(spark.components.Field, spark.core.View); /** Sets field value. @export @param {!string} value Input value. */ spark.components.Field.prototype.setValue = function(value) { return this.getElement().value = value; }; /** Return field value. @export */ spark.components.Field.prototype.getValue = function() { return this.getElement().value; }; /** Sets field name. @export @param {!string} name field name. */ spark.components.Field.prototype.setName = function(name) { return this.setAttribute('name', name); }; /** @export Return field name. */ spark.components.Field.prototype.getName = function() { return this.getElement().name; };