• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / MooseIDE / 18165837346

01 Oct 2025 02:39PM UTC coverage: 66.941% (+0.08%) from 66.86%
18165837346

push

github

web-flow
Merge pull request #1439 from moosetechnology/1421-tag-browser-tag-creation-should-open-a-popup

1421 tag browser tag creation should open a popup

fix #1421

237 of 263 new or added lines in 10 files covered. (90.11%)

33 existing lines in 4 files now uncovered.

20585 of 30751 relevant lines covered (66.94%)

1.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.39
/src/MooseIDE-Tagging/MiTagCreationForm.class.st
1
"
2
the page that allows to enter information about the tag (like its name and category)
3
This is the right part of the tag browser
4
"
5
Class {
6
        #name : 'MiTagCreationForm',
7
        #superclass : 'SpPresenter',
8
        #instVars : [
9
                'colorPicker',
10
                'cancelButton',
11
                'submitButton',
12
                'nameField',
13
                'descriptionField',
14
                'categorySelection',
15
                'intentButton',
16
                'extentButton',
17
                'isIntent',
18
                'queryList',
19
                'queryListLabeled',
20
                'tagBrowser'
21
        ],
22
        #category : 'MooseIDE-Tagging-Browser',
23
        #package : 'MooseIDE-Tagging',
24
        #tag : 'Browser'
25
}
26

27
{ #category : 'accessing' }
28
MiTagCreationForm >> cancelButton [
2✔
29

2✔
30
        ^ cancelButton
2✔
31
]
2✔
32

33
{ #category : 'accessing' }
34
MiTagCreationForm >> categorySelection [
2✔
35

2✔
36
        ^ categorySelection
2✔
37
]
2✔
38

39
{ #category : 'initialization' }
40
MiTagCreationForm >> checkFormInputs [
2✔
41

2✔
42
        nameField text ifEmpty: [ ^ false ].
2✔
43
        ^ true
2✔
44
]
2✔
45

46
{ #category : 'initialization' }
47
MiTagCreationForm >> close [
2✔
48

2✔
49
        owner close
2✔
50
]
2✔
51

52
{ #category : 'private' }
53
MiTagCreationForm >> connectPresenters [
2✔
54
        
2✔
55
        extentButton action: [ self setExtentForm ].
2✔
56
        intentButton action: [ self setIntentForm ].
2✔
57
]
2✔
58

59
{ #category : 'brokerage' }
60
MiTagCreationForm >> consume: aQuery [
×
61

×
62
        self updateQueryList
×
63
]
×
64

65
{ #category : 'accessing' }
66
MiTagCreationForm >> extentButton [
2✔
67

2✔
68
        ^ extentButton
2✔
69
]
2✔
70

71
{ #category : 'initialization' }
72
MiTagCreationForm >> fetchQueries [
2✔
73

2✔
74
        ^ (tagBrowser application itemsFor: FQAbstractQuery) asOrderedCollection
2✔
75
]
2✔
76

77
{ #category : 'initialization' }
78
MiTagCreationForm >> initialize [
2✔
79

2✔
80
        super initialize.
2✔
81
        isIntent := false.
2✔
82

2✔
83
]
2✔
84

85
{ #category : 'initialization' }
86
MiTagCreationForm >> initializeDialogButtonsLayout [
2✔
87

2✔
88
        ^SpBoxLayout newLeftToRight
2✔
89
                hAlignEnd ;
2✔
90
                add: cancelButton expand: false ;
2✔
91
                add: submitButton expand: false ;
2✔
92
                yourself
2✔
93
]
2✔
94

95
{ #category : 'initialization' }
96
MiTagCreationForm >> initializeFormLayout [
2✔
97

2✔
98
        ^SpBoxLayout newTopToBottom
2✔
99
                spacing: 5;
2✔
100

2✔
101
                add: (SpBoxLayout newLeftToRight
2✔
102
                        add: extentButton;
2✔
103
                        add: intentButton;
2✔
104
                        yourself)
2✔
105
                expand: false;
2✔
106

2✔
107
                add: (SpBoxLayout newLeftToRight
2✔
108
                        spacing: 5;
2✔
109

2✔
110
                        add: (SpBoxLayout newTopToBottom
2✔
111
                                add: 'Name' asPresenter expand: false;
2✔
112
                                add: nameField expand: false;
2✔
113
                                yourself);
2✔
114

2✔
115
                        add: (SpBoxLayout newTopToBottom
2✔
116
                                add: 'Category (optional)';
2✔
117
                                add: categorySelection;
2✔
118
                                yourself)
2✔
119
                        width: 200;
2✔
120

2✔
121
                        yourself)
2✔
122
                expand: false;
2✔
123

2✔
124
                add: (SpBoxLayout newTopToBottom
2✔
125
                        add: 'Description (optional)' asPresenter
2✔
126
                        expand: false;
2✔
127
                        add: descriptionField;
2✔
128
                        yourself)
2✔
129
                 expand: true;
2✔
130
                 add: queryListLabeled expand: false;
2✔
131
                 yourself.
2✔
132
]
2✔
133

134
{ #category : 'initialization' }
135
MiTagCreationForm >> initializeLayout [
2✔
136

2✔
137
        | sep colorPickerWidth colorPickerLayout |
2✔
138
        self layout: (SpBoxLayout newTopToBottom spacing: 5).
2✔
139

2✔
140
        colorPickerWidth := 240.
2✔
141
        
2✔
142
        (sep := SpRoassalPresenter new) canvas color: (Color
2✔
143
                         r: 40
2✔
144
                         g: 40
2✔
145
                         b: 40
2✔
146
                         range: 255) translucent.
2✔
147

2✔
148
        colorPickerLayout := SpBoxLayout newTopToBottom
2✔
149
                add: (SpBoxLayout newLeftToRight
2✔
150
                        add: 'Tag Color' asPresenter;
2✔
151
                        hAlignCenter;
2✔
152
                        yourself)
2✔
153
                width: colorPickerWidth;
2✔
154
                add: colorPicker  ;
2✔
155
                yourself.
2✔
156
        
2✔
157
        self initializeFormLayout.
2✔
158

2✔
159
        self layout
2✔
160
                add:  (SpBoxLayout newLeftToRight
2✔
161
                        spacing: 10;
2✔
162
                        add: colorPickerLayout width: colorPickerWidth ;
2✔
163
                        add: sep width: 2;
2✔
164
                        add: (SpBoxLayout newTopToBottom
2✔
165
                        spacing: 5;
2✔
166
                                add: (self initializeFormLayout) expand: true fill: true;
2✔
167
                                add: self initializeDialogButtonsLayout expand: false ;
2✔
168
                                yourself);
2✔
169
                yourself)
2✔
170

2✔
171
]
2✔
172

173
{ #category : 'initialization' }
174
MiTagCreationForm >> initializePresenters [
2✔
175

2✔
176
        submitButton := self newButton 
2✔
177
                label: 'Add' ;
2✔
178
                action: [ self submit ].
2✔
179
        cancelButton := self newButton 
2✔
180
                label: 'Cancel' ;
2✔
181
                action: [ self close ].
2✔
182

2✔
183
        colorPicker := self newColorPicker
2✔
184
                setColor: Color random.
2✔
185
        extentButton := self newToggleButton
2✔
186
                state: true;
2✔
187
                label: 'Static'.
2✔
188
        intentButton := self newToggleButton
2✔
189
                state: false;
2✔
190
                label: 'Dynamic'.
2✔
191

2✔
192
        self initializeTagDescriptionPresenters.
2✔
193

2✔
194
        self initializeLayout
2✔
195
]
2✔
196

197
{ #category : 'initialization' }
198
MiTagCreationForm >> initializeTagDescriptionPresenters [
2✔
199

2✔
200
        nameField := self newTextInput.
2✔
201
        descriptionField := self newText.
2✔
202
        categorySelection := self newDropList
2✔
203
                sortingBlock: [ :item |
2✔
204
                        item model
2✔
205
                                ifNil: [ '' ]
2✔
206
                                ifNotNil: [ :category | category name ] ]
2✔
207
                ascending;
2✔
208
                display: [ :cat | cat ifNil: [ '' ] ifNotNil: [ cat name ] ].
2✔
209
        queryList := self newDropList
2✔
210
                startWithoutSelection;
2✔
211
                display: [ :query | self stringForQuery: query ].
2✔
212
        queryListLabeled := MiPresenter new
2✔
213
                layout: (SpBoxLayout newTopToBottom
2✔
214
                        add: 'Query' asPresenter expand: false;
2✔
215
                        add: queryList expand: false;
2✔
216
                        yourself);
2✔
217
                 hide.
2✔
218

2✔
219
]
2✔
220

221
{ #category : 'accessing' }
222
MiTagCreationForm >> intentButton [
2✔
223

2✔
224
        ^ intentButton
2✔
225
]
2✔
226

227
{ #category : 'accessing' }
228
MiTagCreationForm >> nameField [
2✔
229

2✔
230
        ^ nameField
2✔
231
]
2✔
232

233
{ #category : 'accessing' }
234
MiTagCreationForm >> queryList [
2✔
235

2✔
236
        ^ queryList
2✔
237
]
2✔
238

239
{ #category : 'accessing' }
240
MiTagCreationForm >> queryListLabeled [
2✔
241

2✔
242
        ^ queryListLabeled
2✔
243
]
2✔
244

245
{ #category : 'brokerage' }
246
MiTagCreationForm >> remove: aQuery [
×
247

×
248
        self updateQueryList
×
249
]
×
250

251
{ #category : 'initialization' }
UNCOV
252
MiTagCreationForm >> reset [
×
UNCOV
253

×
UNCOV
254
        colorPicker setColor: Color random.
×
UNCOV
255
        nameField text: ''.
×
UNCOV
256
        descriptionField text: ''.
×
UNCOV
257
        categorySelection resetSelection.
×
UNCOV
258
        queryList resetSelection.
×
UNCOV
259
        self updateQueryList
×
UNCOV
260
]
×
261

262
{ #category : 'private' }
263
MiTagCreationForm >> setExtentForm [
×
264

×
265
        isIntent ifFalse: [ 
×
266
                extentButton state: true.
×
267
                ^ self ].
×
268
        isIntent := false.
×
269
        intentButton state: false.
×
270
        queryListLabeled hide.
×
271
        self update
×
272
]
×
273

274
{ #category : 'private' }
275
MiTagCreationForm >> setIntentForm [
2✔
276

2✔
277
        isIntent ifTrue: [ 
2✔
278
                intentButton state: true.
2✔
279
                ^ self ].
2✔
280
        isIntent := true.
2✔
281
        extentButton state: false.
2✔
282
        queryListLabeled show.
2✔
283
        self update
2✔
284
]
2✔
285

286
{ #category : 'accessing' }
287
MiTagCreationForm >> specModel [
2✔
288

2✔
289
        ^tagBrowser specModel
2✔
290
]
2✔
291

292
{ #category : 'initialization' }
293
MiTagCreationForm >> stringForQuery: aQuery [
2✔
294

2✔
295
        | queryText contractor |
2✔
296
        queryText := aQuery ifNil: [ '' ] ifNotNil: [ 
2✔
297
                             String streamContents: [ :aStream | 
2✔
298
                                     aQuery storeWithParentsOn: aStream ] ].
2✔
299
        contractor := LbCContractor new addStrategy:
2✔
300
                              (LbCEllipsisStrategy new
2✔
301
                                       separator: '...';
2✔
302
                                       upTo: 50;
2✔
303
                                       yourself).
2✔
304
        ^ contractor reduce: queryText
2✔
305
]
2✔
306

307
{ #category : 'initialization' }
308
MiTagCreationForm >> submit [
2✔
309

2✔
310
        | tag |
2✔
311
        self checkFormInputs ifFalse: [ ^ self ].
2✔
312

2✔
313
        tag := isIntent
2✔
314
                ifTrue: [
2✔
315
                        self specModel
2✔
316
                                createDynamicTag: nameField text
2✔
317
                                description: descriptionField text
2✔
318
                                color: colorPicker color
2✔
319
                                category: categorySelection selectedItem
2✔
320
                                query: queryList selectedItem ]
2✔
321
                ifFalse: [
2✔
322
                        self specModel
2✔
323
                                createTag: nameField text
2✔
324
                                description: descriptionField text
2✔
325
                                color: colorPicker color
2✔
326
                                category: categorySelection selectedItem ].
2✔
327

2✔
328
        tag
2✔
329
                ifNil: [ self alert: 'This tag name is already in use. Please choose a different one.' ].
2✔
330

2✔
331
        tagBrowser refreshTagList.
2✔
332
        self close
2✔
333
]
2✔
334

335
{ #category : 'accessing' }
336
MiTagCreationForm >> submitButton [
2✔
337

2✔
338
        ^ submitButton
2✔
339
]
2✔
340

341
{ #category : 'accessing' }
342
MiTagCreationForm >> tagBrowser: aTagBrowser [
2✔
343

2✔
344
        tagBrowser := aTagBrowser.
2✔
345
        self updateQueryList.
2✔
346
        self updateCategories
2✔
347
]
2✔
348

349
{ #category : 'private' }
350
MiTagCreationForm >> updateCategories [
2✔
351
        "allow to have no category, hence the first nil element"
2✔
352

2✔
353
        categorySelection items: { nil }, (self specModel allCategories)
2✔
354
]
2✔
355

356
{ #category : 'accessing' }
357
MiTagCreationForm >> updateQueryList [
2✔
358

2✔
359
        queryList items: self fetchQueries
2✔
360
]
2✔
361

362
{ #category : 'accessing - deprecated' }
363
MiTagCreationForm >> windowTitle [ 
2✔
364

2✔
365
        ^'Create tag'
2✔
366
]
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc