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 | import theTranslator from '../../core/uiLib/Translator.js'; |
26 | import ModalBaseDialog from '../baseDialog/ModalBaseDialog.js'; |
27 | import CheckboxInputControl from '../../controls/checkboxInputControl/CheckboxInputControl.js'; |
28 | import SaveAsDialogData from './SaveAsDialogData.js'; |
29 | |
30 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
31 | /** |
32 | A saveAsDialog object completed for making a partial save of the edited travel |
33 | Create an instance of the dialog, then execute the show ( ) method. The selected values are returned as parameter of the |
34 | succes handler of the Promise returned by the show ( ) method. |
35 | */ |
36 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
37 | |
38 | class SaveAsDialog extends ModalBaseDialog { |
39 | |
40 | /** |
41 | The remove travel notes control |
42 | @type {CheckboxInputControl} |
43 | */ |
44 | |
45 | #removeTravelNotesControl; |
46 | |
47 | /** |
48 | The remove route notes control |
49 | @type {CheckboxInputControl} |
50 | */ |
51 | |
52 | #removeRouteNotesControl; |
53 | |
54 | /** |
55 | The remove maneuvers control |
56 | @type {CheckboxInputControl} |
57 | */ |
58 | |
59 | #removeManeuversControl; |
60 | |
61 | /** |
62 | The constructor |
63 | @param {BaseDialogOptions|Object} options An Object with the needed options. See DialogOptions class. |
64 | */ |
65 | |
66 | constructor ( options ) { |
67 | super ( options ); |
68 | } |
69 | |
70 | /** |
71 | Create all the controls needed for the dialog. |
72 | Overload of the base class createContentHTML |
73 | */ |
74 | |
75 | createContentHTML ( ) { |
76 | this.#removeTravelNotesControl = new CheckboxInputControl ( |
77 | { |
78 | afterText : theTranslator.getText ( 'SaveAsDialog - Remove Travel Notes' ), |
79 | checked : false |
80 | } |
81 | ); |
82 | this.#removeRouteNotesControl = new CheckboxInputControl ( |
83 | { |
84 | afterText : theTranslator.getText ( 'SaveAsDialog - Remove Routes Notes' ), |
85 | checked : false |
86 | } |
87 | ); |
88 | this.#removeManeuversControl = new CheckboxInputControl ( |
89 | { |
90 | afterText : theTranslator.getText ( 'SaveAsDialog - Remove Maneuvers' ), |
91 | checked : false |
92 | } |
93 | ); |
94 | |
95 | } |
96 | |
97 | /** |
98 | Ok button handler. |
99 | */ |
100 | |
101 | onOk ( ) { |
102 | super.onOk ( |
103 | new SaveAsDialogData ( |
104 | this.#removeTravelNotesControl.checked, |
105 | this.#removeRouteNotesControl.checked, |
106 | this.#removeManeuversControl.checked |
107 | ) |
108 | ); |
109 | } |
110 | |
111 | /** |
112 | Get an array with the HTMLElements that have to be added in the content of the dialog. |
113 | @type {Array.<HTMLElement>} |
114 | */ |
115 | |
116 | get contentHTMLElements ( ) { |
117 | return [ |
118 | this.#removeTravelNotesControl.controlHTMLElement, |
119 | this.#removeRouteNotesControl.controlHTMLElement, |
120 | this.#removeManeuversControl.controlHTMLElement |
121 | ]; |
122 | } |
123 | |
124 | /** |
125 | Get the title of the dialog |
126 | @type {String} |
127 | */ |
128 | |
129 | get title ( ) { return theTranslator.getText ( 'SaveAsDialog - SaveAs' ); } |
130 | |
131 | } |
132 | |
133 | export default SaveAsDialog; |
134 | |
135 | /* --- End of file --------------------------------------------------------------------------------------------------------- */ |
136 |