generation/border-parameters.js

const _MwWrapper = require("../_mwbridge/_mw-wrapper.js");
const  Unit = require("./unit");

/**
 * Barcode image border parameters
 */
class BorderParameters extends _MwWrapper
{
    width;

    constructor(mwObject)
    {
        super(mwObject);
        this._initializeWrapperMembers();
    }

    _initializeWrapperMembers()
    {
        this.width = new Unit(this.getJavaClass().getWidthSync());
    }

    /**
     * Border visibility. If false than parameter Width is always ignored (0).<br>
     * Default value: false.
     */
    getVisible()
    {
        return this.getJavaClass().getVisibleSync();
    }

    /**
     * Border visibility. If false than parameter Width is always ignored (0).<br>
     * Default value: false.
     */
    setVisible(value)
    {
        this.getJavaClass().setVisibleSync(value);
    }

    /**
     * Border width.<br>
     * Default value: 0.<br>
     * Ignored if Visible is set to false.
     */
    getWidth()
    {
        return this.width;
    }

    /**
     * Border width.<br>
     * Default value: 0.<br>
     * Ignored if Visible is set to false.
     */
    setWidth(value)
    {
        this.getJavaClass().setWidthSync(value.getJavaClass());
        this.width = value;
    }

    /**
     * Returns a human-readable string representation of this BorderParameters.<br>
     * @return A string that represents this BorderParameters.
     */
    toString()
    {
        return this.getJavaClass().toStringSync();
    }

    /**
     * Border dash style.<br>
     * Default value: BorderDashStyle.SOLID.
     */
    getDashStyle()
    {
        return this.getJavaClass().getDashStyleSync();
    }

    /**
     * Border dash style.<br>
     * Default value: BorderDashStyle.SOLID.
     */
    setDashStyle(value)
    {
        this.getJavaClass().setDashStyleSync(value);
    }

    /**
     * Border color.<br>
     * Default value: #000000
     */
    getColor()
    {
        let intColor = this.getJavaClass().getColorSync();
        let hexColor = ((intColor) >>> 0).toString(16).slice(-6).toUpperCase()
        while (hexColor.length < 6) {
            hexColor = "0" + hexColor;
        }
        hexColor = "#" + hexColor;
        return hexColor;
    }

    /**
     * Border color.<br>
     * Default value: #000000
     */
    setColor(hexValue)
    {
        this.getJavaClass().setColorSync((parseInt(hexValue.substr(1), 16) << 8) / 256);
    }
}

module.exports = BorderParameters;