1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | import theHTMLElementsFactory from '../../../core/uiLib/HTMLElementsFactory.js'; |
26 | import theTranslator from '../../../core/uiLib/Translator.js'; |
27 | import ClearButtonClickEL from './ClearButtonClickEL.js'; |
28 | import CollapseButtonClickEL from './CollapseButtonClickEL.js'; |
29 | import ExpandTreeButtonClickEL from './ExpandTreeButtonClickEL.js'; |
30 | import SearchButtonClickEL from './SearchButtonClickEL.js'; |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | class OsmSearchToolbarButtons { |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | #toolbarButtonsHTMLElement; |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | constructor ( osmSearchTree, osmSearchWait ) { |
54 | |
55 | Object.freeze ( this ); |
56 | |
57 | |
58 | this.#toolbarButtonsHTMLElement = theHTMLElementsFactory.create ( |
59 | 'div' |
60 | ); |
61 | |
62 | |
63 | theHTMLElementsFactory.create ( |
64 | 'div', |
65 | { |
66 | className : 'TravelNotes-BaseDialog-Button', |
67 | title : theTranslator.getText ( 'OsmSearchToolbarButtons - Start the search' ), |
68 | textContent : '🔎' |
69 | }, |
70 | this.#toolbarButtonsHTMLElement |
71 | ) |
72 | .addEventListener ( 'click', new SearchButtonClickEL ( osmSearchTree, osmSearchWait ), false ); |
73 | |
74 | |
75 | theHTMLElementsFactory.create ( |
76 | 'div', |
77 | { |
78 | className : 'TravelNotes-BaseDialog-Button', |
79 | title : theTranslator.getText ( 'OsmSearchToolbarButtons - Expand the tree' ), |
80 | textContent : '▼' |
81 | }, |
82 | this.#toolbarButtonsHTMLElement |
83 | ) |
84 | .addEventListener ( 'click', new ExpandTreeButtonClickEL ( osmSearchTree ), false ); |
85 | |
86 | |
87 | theHTMLElementsFactory.create ( |
88 | 'div', |
89 | { |
90 | className : 'TravelNotes-BaseDialog-Button', |
91 | title : theTranslator.getText ( 'OsmSearchToolbarButtons - Collapse the tree' ), |
92 | textContent : '▶' |
93 | }, |
94 | this.#toolbarButtonsHTMLElement |
95 | ) |
96 | .addEventListener ( 'click', new CollapseButtonClickEL ( osmSearchTree ), false ); |
97 | |
98 | |
99 | theHTMLElementsFactory.create ( |
100 | 'div', |
101 | { |
102 | className : 'TravelNotes-BaseDialog-Button', |
103 | title : theTranslator.getText ( 'OsmSearchToolbarButtons - Clear the tree' ), |
104 | textContent : '❌' |
105 | }, |
106 | this.#toolbarButtonsHTMLElement |
107 | ) |
108 | .addEventListener ( 'click', new ClearButtonClickEL ( osmSearchTree ), false ); |
109 | |
110 | } |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | get toolbarButtonsHTMLElement ( ) { return this.#toolbarButtonsHTMLElement; } |
118 | |
119 | } |
120 | |
121 | export default OsmSearchToolbarButtons; |
122 | |
123 | |
124 | |