Source: components/inputs/LabeledInput.js

// Generated by github.com/steida/coffee2closure 0.1.12
goog.provide('spark.components.LabeledInput');
goog.require('spark.components.Input');
goog.require('spark.components.Label');

/**
  Input with label component of Spark Framework.

  @constructor
  @export
  @param   {Object=} options Class options.
  @param   {*=} data Class data
  @extends {spark.core.View}
 */
spark.components.LabeledInput = function(options, data) {
  var inputDomId, inputOptions, labelOptions, uniqueId, _ref;
  if (options == null) {
    options = {};
  }
  if (options.inputFirst == null) {
    options.inputFirst = (_ref = options['inputFirst']) != null ? _ref : false;
  }
  this.getCssClass(options, options.cssClass || options['cssClass'] || 'labeled-input');
  spark.components.LabeledInput.superClass_.constructor.call(this, options, data);
  labelOptions = options.labelOptions || options['labelOptions'] || {};
  inputOptions = options.inputOptions || options['inputOptions'] || {};
  inputDomId = inputOptions.domId || inputOptions['domId'];
  uniqueId = this.getUid();
  labelOptions.attributes || (labelOptions.attributes = {});
  inputOptions.attributes || (inputOptions.attributes = {});
  labelOptions.attributes["for"] = inputDomId || uniqueId;
  inputOptions.attributes.name = inputDomId || uniqueId;
  inputOptions.attributes.id = inputDomId || uniqueId;
  this.label = new spark.components.Label(labelOptions, data);
  this.input = spark.components.FieldFactory(inputOptions, data);
  if (options.inputFirst) {
    this.appendView(this.input);
    this.appendView(this.label);
  } else {
    this.appendView(this.label);
    this.appendView(this.input);
  }
}
goog.inherits(spark.components.LabeledInput, spark.core.View);

/**
  Returns input component.

  @export
  @return {spark.components.Input}
 */
spark.components.LabeledInput.prototype.getInput = function() {
  return this.input;
};

/**
  Returns label component.

  @export
  @return {spark.components.Label}
 */
spark.components.LabeledInput.prototype.getLabel = function() {
  return this.label;
};

/**
  Returns name of the input.

  @export
  @return {string} Input name.
 */
spark.components.LabeledInput.prototype.getName = function() {
  return this.input.getName();
};

/**
  Returns value of the input.

  @export
  @return {string} Input value.
 */
spark.components.LabeledInput.prototype.getValue = function() {
  return this.input.getValue();
};
Spark Framework by Fatih Acet
Copyright © 2014 - Fatih Acet
Documentation generated by JSDoc 3.2.2 on 2015-07-19T22:09:29+00:00 using the DocStrap template.