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

moosetechnology / MooseIDE / 18218947233

03 Oct 2025 09:48AM UTC coverage: 66.756% (-0.02%) from 66.772%
18218947233

push

github

ClotildeToullec
Merge d2ac1f883

240 of 353 new or added lines in 16 files covered. (67.99%)

352 existing lines in 33 files now uncovered.

20573 of 30818 relevant lines covered (66.76%)

1.34 hits per line

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

0.0
/src/MooseIDE-LayerVisualization/MiLayerVisualizationBuilder.class.st
1
Class {
2
        #name : 'MiLayerVisualizationBuilder',
3
        #superclass : 'HSimpleVisualizationBuilder',
4
        #instVars : [
5
                'visitHNodeCache',
6
                'description',
7
                'highlightShapes',
8
                'colorScale'
9
        ],
10
        #category : 'MooseIDE-LayerVisualization-Roassal-builder',
11
        #package : 'MooseIDE-LayerVisualization',
12
        #tag : 'Roassal-builder'
13
}
14

15
{ #category : 'building' }
UNCOV
16
MiLayerVisualizationBuilder >> addNextLevelButton [
×
UNCOV
17

×
18
        | next |
×
19
        next := RSComposite new.
×
20
        next
×
21
                add: (RSLabel new
×
22
                                 fontSize: 13;
×
23
                                 text: 'ADD LEVEL';
×
24
                                 color: Color black;
×
25
                                 yourself);
×
26
                border: (RSBorder new
×
27
                                 color: (Color fromHexString: '88888899');
×
28
                                 yourself);
×
29
                color: (Color fromHexString: 'AAAAAA33').
×
30
        next @ (RSHighlightable new
×
31
                 highlightColor: (Color fromHexString: 'AAAAAA99');
×
32
                 yourself).
×
33
        next
×
34
                adjustToChildren;
×
35
                padding: 5.
×
36
        next translateBy: next width / 2 + 10 @ (next height / 2 + 10).
×
37
        self container add: next.
×
38

×
39
        next setAsFixed.
×
40

×
41
        next
×
42
                when: RSMouseClick
×
43
                do: [ 
×
44
                        mapModel addLayer.
×
45
                        self updateBuild ]
×
46
                for: self
×
47
]
×
48

49
{ #category : 'building' }
UNCOV
50
MiLayerVisualizationBuilder >> build [
×
UNCOV
51

×
52
        mapModel initializePartitioning.
×
53

×
54
        self visit: mapModel buildDescription.
×
55

×
56
        mapModel createLinksIn: visitHNodeCache.
×
57

×
58
        self addNextLevelButton.
×
59

×
60
        self renderIn: self container.
×
61
        ^ self container
×
62
]
×
63

64
{ #category : 'visiting' }
UNCOV
65
MiLayerVisualizationBuilder >> changeColorFor: class [
×
UNCOV
66

×
67

×
68
        ^ nil
×
69
]
×
70

71
{ #category : 'visiting' }
UNCOV
72
MiLayerVisualizationBuilder >> createAndStoreHNodeFor: anLVElement [
×
UNCOV
73

×
74
        | hn |
×
75
        hn := self createHNodeFor: anLVElement.
×
76
        visitHNodeCache at: anLVElement model put: hn.
×
77
        ^ hn
×
78
]
×
79

80
{ #category : 'visiting' }
UNCOV
81
MiLayerVisualizationBuilder >> createHNodeFor: anLVElement [
×
UNCOV
82

×
83
        | color class |
×
84
        class := anLVElement model.
×
85
        color := self changeColorFor: class.
×
86

×
87
        ^ HNode new
×
88
                  name: anLVElement name;
×
89
                  rawModel: class;
×
90
                  color: (Color fromHexString: '80B1D3');
×
91
                  collapse;
×
92
                  yourself
×
93
]
×
94

95
{ #category : 'visiting' }
UNCOV
96
MiLayerVisualizationBuilder >> createHNodeForPackage: aPackageElement [
×
UNCOV
97

×
98
        ^ (self createHNodeFor: aPackageElement)
×
99
                  addAll: (aPackageElement children collect: [ :c | 
×
100
                                           self createAndStoreHNodeFor: c ]);
×
101
                  yourself
×
102
]
×
103

104
{ #category : 'accessing' }
UNCOV
105
MiLayerVisualizationBuilder >> highlightable [
×
UNCOV
106

×
107
        ^ highlightable ifNil: [ 
×
108
                  highlightable := RSHighlightable new
×
109
                                           highlightShapes: [ :shape | 
×
110
                                                   | list |
×
111
                                                   list := shape connectedLines copy.
×
112
                                                   list add: (shape propertyAt: #background).
×
113
                                                   list ];
×
114
                                           when: RSHighlightEvent do: [ :evt | 
×
115
                                                   evt shape isNode
×
116
                                                           ifTrue: [ 
×
117
                                                                   highlightable
×
118
                                                                           record: evt shape
×
119
                                                                           selector: #border
×
120
                                                                           value: (RSBorder new
×
121
                                                                                            color: (Color fromHexString: 'FF7F00');
×
122
                                                                                            width: 3;
×
123
                                                                                            yourself) ]
×
124
                                                           ifFalse: [ 
×
125
                                                           highlightable
×
126
                                                                   record: evt shape
×
127
                                                                   selector: #color
×
128
                                                                   value: Color red ] ]
×
129
                                           for: self;
×
130
                                           when: RSUnHighlightEvent do: [ :evt | 
×
131
                                                   evt shape isNode
×
132
                                                           ifTrue: [ 
×
133
                                                           highlightable
×
134
                                                                   restore: evt shape
×
135
                                                                   selector: #border ]
×
136
                                                           ifFalse: [ 
×
137
                                                           highlightable
×
138
                                                                   restore: evt shape
×
139
                                                                   selector: #color ] ]
×
140
                                           for: self;
×
141
                                           yourself ]
×
142
]
×
143

144
{ #category : 'visiting' }
UNCOV
145
MiLayerVisualizationBuilder >> highlightableLinkedShapes [
×
UNCOV
146

×
147
        ^ highlightShapes ifNil: [ 
×
148
                  highlightShapes := RSHighlightable new
×
149
                                             highlightShapes: [ :shape | 
×
150
                                                     | list |
×
151
                                                     list := Set new.
×
152
                                                     shape connectedLines do: [ :line | 
×
153
                                                                     shape = line from
×
154
                                                                             ifTrue: [ 
×
155
                                                                                     list add:
×
156
                                                                                                     (line to propertyAt: #background) ]
×
157
                                                                             ifFalse: [ 
×
158
                                                                                     list add:
×
159
                                                                                                     (line from propertyAt: #background) ] ].
×
160
                                                     list asOrderedCollection ];
×
161
                                             when: RSHighlightEvent do: [ :evt | 
×
162
                                                     | color |
×
163
                                                     color := Color fromHexString: '9DD0B3'.
×
164
                                                     highlightable
×
165
                                                             record: evt shape
×
166
                                                             selector: #color
×
167
                                                             value: color ]
×
168
                                             for: self;
×
169
                                             when: RSUnHighlightEvent
×
170
                                             do: [ :evt | 
×
171
                                                     highlightable
×
172
                                                             restore: evt shape
×
173
                                                             selector: #color ]
×
174
                                             for: self;
×
175
                                             yourself ]
×
176
]
×
177

178
{ #category : 'initialization' }
UNCOV
179
MiLayerVisualizationBuilder >> initialize [
×
UNCOV
180

×
181
        super initialize.
×
182
        colorScale := NSScale linear
×
183
                              domain: #( 1 5 );
×
184
                              range: { 
×
185
                                              (Color fromHexString: 'E8E8E8').
×
186
                                              (Color fromHexString: '7C7C7C') };
×
187
                              yourself
×
188
]
×
189

190
{ #category : 'visiting' }
UNCOV
191
MiLayerVisualizationBuilder >> layoutHStyle [
×
UNCOV
192

×
193
        ^ HBoxNodeStyle new
×
194
                  borderDashArray: #( 4 6 );
×
195
                  yourself
×
196
]
×
197

198
{ #category : 'building' }
UNCOV
199
MiLayerVisualizationBuilder >> layoutOn: aGroupOfShapes parent: shape [
×
UNCOV
200

×
201
        aGroupOfShapes ifEmpty: [ ^ self ].
×
202

×
203
        self relayout: (aGroupOfShapes reject: #isFixed) parent: shape
×
204
]
×
205

206
{ #category : 'building' }
UNCOV
207
MiLayerVisualizationBuilder >> nodeAnnouncer [
×
UNCOV
208

×
209
        "plug new events here"
×
210

×
211
        baseNode ifNotNil: [ ^ baseNode announcer ].
×
212
        baseNode := RSComposite new
×
213
                            @ self popup;
×
214
                            @ self menuInteraction;
×
215
                            @ self highlightable;
×
216
                            @ RSNodeOnTopWhenPositionChanged new;
×
217
                            @ self highlightableLinkedShapes;
×
218
                            yourself.
×
219
        ^ baseNode announcer
×
220
]
×
221

222
{ #category : 'accessing' }
UNCOV
223
MiLayerVisualizationBuilder >> rebuildShape: aShape [
×
UNCOV
224

×
225
        super rebuildShape: aShape.
×
226
        rootNode children do: [ :child | child position: nil ].
×
227
        self layoutOn: self container nodes parent: rootNode.
×
228
        self container zoomToFit.
×
229
        self container signalUpdate
×
230
]
×
231

232
{ #category : 'rendering' }
UNCOV
233
MiLayerVisualizationBuilder >> renderLinesIn: aCanvas [
×
UNCOV
234

×
235
        self lineBuilder
×
236
                canvas: aCanvas;
×
237
                color: (Color red alpha: 0.7);
×
238
                shapes: shapes;
×
239
                connectFromAll: #dependentsFromLinks
×
240
]
×
241

242
{ #category : 'building' }
UNCOV
243
MiLayerVisualizationBuilder >> updateBuild [
×
UNCOV
244

×
245
        self container shapes do: #remove.
×
246
        description := mapModel buildDescription.
×
247
        self visit: description.
×
248
        mapModel createLinksIn: visitHNodeCache.
×
249
        self renderIn: self container.
×
250
        self container signalUpdate.
×
251
        ^ self container
×
252
]
×
253

254
{ #category : 'visiting' }
UNCOV
255
MiLayerVisualizationBuilder >> visit: aVisualizationModel [
×
UNCOV
256

×
257
        visitHNodeCache := Dictionary new.
×
258
        rootNode := aVisualizationModel acceptVisitor: self
×
259
]
×
260

261
{ #category : 'visiting' }
UNCOV
262
MiLayerVisualizationBuilder >> visitBox: aMiNVBoxNode withRSLayout: aRoassalLayout [
×
UNCOV
263

×
264
        | hNode |
×
265
        hNode := HNode new
×
266
                         name: aMiNVBoxNode name;
×
267
                         layout: aRoassalLayout;
×
268
                         style: self layoutHStyle;
×
269
                         color: ((colorScale scale: aMiNVBoxNode depth) alpha: 0.5);
×
270
                         addAll:
×
271
                                 (aMiNVBoxNode children collect: [ :c | 
×
272
                                                  c acceptVisitor: self ]);
×
273
                         yourself.
×
274
        aMiNVBoxNode expanded
×
275
                ifTrue: [ hNode expand ]
×
276
                ifFalse: [ hNode collapse ].
×
277
        ^ hNode
×
278
]
×
279

280
{ #category : 'visiting' }
UNCOV
281
MiLayerVisualizationBuilder >> visitFlowBox: aMiNVBoxNode [
×
UNCOV
282

×
283
        ^ self visitBox: aMiNVBoxNode withRSLayout: RSFlowLayout
×
284
]
×
285

286
{ #category : 'visiting' }
UNCOV
287
MiLayerVisualizationBuilder >> visitHorizontalBox: aMiNVBoxNode [
×
UNCOV
288

×
289
        ^ self
×
290
                  visitBox: aMiNVBoxNode
×
291
                  withRSLayout: (RSHorizontalLineLayout new
×
292
                                   gapSize: aMiNVBoxNode gapSize;
×
293
                                   alignMiddle;
×
294
                                   yourself)
×
295
]
×
296

297
{ #category : 'visiting' }
UNCOV
298
MiLayerVisualizationBuilder >> visitPackageElement: aPackageElement [
×
UNCOV
299

×
300
        ^ self createHNodeForPackage: aPackageElement
×
301
]
×
302

303
{ #category : 'visiting' }
UNCOV
304
MiLayerVisualizationBuilder >> visitTypeElement: aMiLVTypeElement [
×
UNCOV
305

×
306
        ^ self createAndStoreHNodeFor: aMiLVTypeElement
×
307
]
×
308

309
{ #category : 'visiting' }
UNCOV
310
MiLayerVisualizationBuilder >> visitVerticalBox: aMiNVBoxNode [
×
UNCOV
311

×
312
        ^ self
×
313
                  visitBox: aMiNVBoxNode
×
314
                  withRSLayout: (RSVerticalLineLayout new
×
315
                                   gapSize: aMiNVBoxNode gapSize;
×
316
                                   alignCenter;
×
317
                                   yourself)
×
318
]
×
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

© 2026 Coveralls, Inc