public void setMaskVisible(boolean isMaskVisible) {
        this.isMaskVisible = isMaskVisible;
        if (isMaskVisible) {
            if (maskFormatter == null) {
                try {
                    maskFormatter = new MaskFormatter(createMaskFromDatePattern(datePattern));
                    maskFormatter.setPlaceholderCharacter(this.placeholder);
                    maskFormatter.install(this);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }
        }
    }