File : dialogs/baseDialog/BaseDialogOptions.js

1
/*
2
Copyright - 2017 2023 - wwwouaiebe - Contact: https://www.ouaie.be/
3
4
This  program is free software;
5
you can redistribute it and/or modify it under the terms of the
6
GNU General Public License as published by the Free Software Foundation;
7
either version 3 of the License, or any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
*/
18
/*
19
Changes:
20
    - v4.0.0:
21
        - created from v3.6.0
22
Doc reviewed 202208
23
 */
24
25
/* ------------------------------------------------------------------------------------------------------------------------- */
26
/**
27
An object to gives some options to a dialog, mainly for generic dialogs (SelectDialog, TwoButtonsDialog)
28
*/
29
/* ------------------------------------------------------------------------------------------------------------------------- */
30
31
class BaseDialogOptions {
32
33
    /**
34
    The text to be displayed on the first button on the bottom of the dialog. Default to 🆗
35
    @type {?String}
36
    */
37
38
    #firstButtonText = null;
39
40
    /**
41
    The text to be displayed on the first button on the bottom of the dialog
42
    @type {?String}
43
    */
44
45
    #secondButtonText = null;
46
47
    /**
48
    Options for the SelectDialog
49
    @type {Array.<SelectOptionData>}
50
    */
51
52
    #selectOptionsData = null;
53
54
    /**
55
    title of the dialog
56
    @type {?String}
57
    */
58
59
    #title = null;
60
61
    /**
62
    A text to be displayed in the dialog
63
    @type {?String}
64
    */
65
66
    #text = null;
67
68
    /**
69
    The constructor
70
    @param {Object} options An object litteral with the options to change
71
    */
72
73
    constructor ( options ) {
74
        for ( const property in options ) {
75
            switch ( property ) {
76
            case 'firstButtonText' :
77
                this.#firstButtonText = options.firstButtonText;
78
                break;
79
            case 'secondButtonText' :
80
                this.#secondButtonText = options.secondButtonText;
81
                break;
82
            case 'selectOptionsData' :
83
                this.#selectOptionsData = options.selectOptionsData;
84
                break;
85
            case 'title' :
86
                this.#title = options.title;
87
                break;
88
            case 'text' :
89
                this.#text = options.text;
90
                break;
91
            default :
92
                break;
93
            }
94
        }
95
    }
96
97
    /**
98
    The text to be displayed on the first button on the bottom of the dialog. Default to 🆗
99
    @type {?String}
100
    */
101
102
    get firstButtonText ( ) { return this.#firstButtonText; }
103
104
    /**
105
    The text to be displayed on the first button on the bottom of the dialog
106
    @type {?String}
107
    */
108
109
    get secondButtonText ( ) { return this.#secondButtonText; }
110
111
    /**
112
    Options for the SelectDialog
113
    @type {Array.<SelectOptionData>}
114
    */
115
116
    get selectOptionsData ( ) { return this.#selectOptionsData; }
117
118
    /**
119
    title of the dialog
120
    @type {?String}
121
    */
122
123
    get title ( ) { return this.#title; }
124
125
    /**
126
    A text to be displayed in the dialog
127
    @type {?String}
128
    */
129
130
    get text ( ) { return this.#text; }
131
}
132
133
export default BaseDialogOptions;
134
135
/* --- End of file --------------------------------------------------------------------------------------------------------- */
136