API Docs for:
Show:

File: /home/padewitte/projets/webcomponents/myscript-js/src/input/text/textInputUnit.js

'use strict';

(function (scope) {
    /**
     * Input unit used for text recognition
     *
     * @class TextInputUnit
     * @constructor
     */
    function TextInputUnit() {
        this.textInputType = 'MULTI_LINE_TEXT';
        this.components = [];
    }

    /**
     * Get the input type
     *
     * @method getInputType
     * @returns {String}
     */
    TextInputUnit.prototype.getInputType = function () {
        return this.textInputType;
    };

    /**
     * Set the input type
     *
     * @method setInputType
     * @returns {String} inputType
     */
    TextInputUnit.prototype.setInputType = function (inputType) {
        this.textInputType = inputType;
    };

    /**
     * Get components for this input unit
     *
     * @method getComponents
     * @param {TextInkRange} [inkRange]
     * @returns {AbstractComponent[]}
     */
    TextInputUnit.prototype.getComponents = function (inkRange) {
        if (inkRange && (inkRange instanceof scope.TextInkRange)) {
            return this.components.slice(inkRange.getStartComponent(), inkRange.getEndComponent() + 1);
        }
        return this.components;
    };

    /**
     * Set components for this input unit
     *
     * @method setComponents
     * @param {AbstractComponent[]} components
     */
    TextInputUnit.prototype.setComponents = function (components) {
        this.components = components;
    };

    // Export
    scope.TextInputUnit = TextInputUnit;
})(MyScript);