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

moosetechnology / MooseIDE / 15922823259

27 Jun 2025 09:19AM UTC coverage: 66.79% (-0.2%) from 66.982%
15922823259

push

github

web-flow
Do not use fixed pharo versions

19810 of 29660 relevant lines covered (66.79%)

1.34 hits per line

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

92.2
/src/MooseIDE-QueriesBrowser/MiNavigationQueryPresenter.class.st
1
"
2
A query configuration presenter for the `FQNavigationQuery`
3
"
4
Class {
5
        #name : #MiNavigationQueryPresenter,
6
        #superclass : #MiQueryConfiguratorPresenter,
7
        #instVars : [
8
                'directionDropList',
9
                'associationsButton',
10
                'associationsList',
11
                'selectedAssociationsLabel'
12
        ],
13
        #category : #'MooseIDE-QueriesBrowser-Configuration presenters'
14
}
15

16
{ #category : #specs }
17
MiNavigationQueryPresenter class >> title [
×
18
        ^ 'Navigation Query'
×
19
]
×
20

21
{ #category : #'api - actions' }
22
MiNavigationQueryPresenter >> configureFor: aQuery [
2✔
23

2✔
24
        | queryAssociations |
2✔
25
        query := aQuery.
2✔
26
        queryAssociations := aQuery associations.
2✔
27

2✔
28
        directionDropList selectItem: aQuery directionStrategy.
2✔
29

2✔
30
        associationsButton := self newAssociationsButton.
2✔
31

2✔
32
        associationsList items: associationsList items | queryAssociations.
2✔
33

2✔
34
        queryAssociations do: [ :assoc | 
2✔
35
                associationsList activateItem: assoc ]
2✔
36
]
2✔
37

38
{ #category : #actions }
39
MiNavigationQueryPresenter >> configureQuery: association [
2✔
40

2✔
41
        self updateQueryWithSelectedAssociations:
2✔
42
                associationsList selectedItems
2✔
43
]
2✔
44

45
{ #category : #initialization }
46
MiNavigationQueryPresenter >> initializeAssociationsButton [
2✔
47

2✔
48
        associationsButton := self query availableAssociations
2✔
49
                                      ifEmpty: [ 
2✔
50
                                      self noParameterMessage: 'association' ]
2✔
51
                                      ifNotEmpty: [ self newAssociationsButton ]
2✔
52
]
2✔
53

54
{ #category : #initialization }
55
MiNavigationQueryPresenter >> initializeAssociationsList [
2✔
56

2✔
57
        associationsList := self instantiate: SpFilteringSelectableListPresenter.
2✔
58
        associationsList addStyle: 'smallList'.
2✔
59
        associationsList
2✔
60
                display: [ :item | item mooseDescription name asString ];
2✔
61
                items: self query availableAssociations;
2✔
62
                selectItems: self query associations;
2✔
63
                onActivation: [ :association | 
2✔
64
                        self selectAssociationAction: association ];
2✔
65
                onDeactivation: [ :association | 
2✔
66
                        self selectAssociationAction: association ].
2✔
67

2✔
68
        self query associations do: [ :assoc | 
2✔
69
                associationsList activateItem: assoc ]
2✔
70
]
2✔
71

72
{ #category : #initialization }
73
MiNavigationQueryPresenter >> initializeDirectionsDropList [
2✔
74

2✔
75
        directionDropList := self newDropList.
2✔
76
        directionDropList
2✔
77
                startWithoutSelection;
2✔
78
                items: self query class directionStrategies;
2✔
79
                display: [ :each | each label];
2✔
80
                whenSelectedItemChangedDo: [ :selectedDirection | 
2✔
81
                        self updateDirection: selectedDirection ]
2✔
82
]
2✔
83

84
{ #category : #initialization }
85
MiNavigationQueryPresenter >> initializeLabel [
2✔
86

2✔
87
        selectedAssociationsLabel := self newLabel.
2✔
88
        self updateLabel
2✔
89
]
2✔
90

91
{ #category : #initialization }
92
MiNavigationQueryPresenter >> initializePresenters [
2✔
93

2✔
94
        self initializeDirectionsDropList.
2✔
95
        self initializeAssociationsList.
2✔
96
        self initializeAssociationsButton.
2✔
97
        self initializeLabel.
2✔
98
        self initializeLayout
2✔
99
]
2✔
100

101
{ #category : #initialization }
102
MiNavigationQueryPresenter >> newAssociationsButton [
2✔
103

2✔
104
        ^ self newButton
2✔
105
                  label: 'Select Associations';
2✔
106
                  action: [ self showAssociationsPopover ];
2✔
107
                  yourself
2✔
108
]
2✔
109

110
{ #category : #layout }
111
MiNavigationQueryPresenter >> newLayout [
2✔
112

2✔
113
        | padding |
2✔
114
        padding := 5.
2✔
115
        ^ SpBoxLayout newLeftToRight
2✔
116
                add: directionDropList
2✔
117
                expand: false
2✔
118
                fill: true
2✔
119
                padding: padding;
2✔
120
                add: associationsButton withConstraints: [ :constraints | 
2✔
121
                        constraints
2✔
122
                                width: 125;
2✔
123
                                padding: padding ];
2✔
124
                add: selectedAssociationsLabel;
2✔
125
                yourself
2✔
126
]
2✔
127

128
{ #category : #actions }
129
MiNavigationQueryPresenter >> selectAssociationAction: association [
2✔
130

2✔
131
        self updateLabel.
2✔
132
        self computeQueryAction: association
2✔
133
]
2✔
134

135
{ #category : #initialization }
136
MiNavigationQueryPresenter >> showAssociationsPopover [
×
137

×
138
        self newPopover
×
139
                relativeTo: associationsButton;
×
140
                presenter: associationsList;
×
141
                bePositionRight;
×
142
                popup
×
143
]
×
144

145
{ #category : #actions }
146
MiNavigationQueryPresenter >> updateDirection: selectedDirection [
2✔
147

2✔
148
        self query resetAndChangeDirection: selectedDirection.
2✔
149

2✔
150
        self initializeAssociationsList.
2✔
151
        self initializeAssociationsButton.
2✔
152
        self initializeLayout.
2✔
153

2✔
154
        self notifyQueryChanged
2✔
155
]
2✔
156

157
{ #category : #actions }
158
MiNavigationQueryPresenter >> updateLabel [
2✔
159
        
2✔
160
        | selectedAssociationsString names reducedNames |
2✔
161
        names := associationsList selectedItems collect: [ :each |
2✔
162
                each mooseDescription name asString ].
2✔
163
        reducedNames := names size > 2
2✔
164
        ifTrue: [
2✔
165
                names collect: [ :each |
2✔
166
                        LbCContractor new
2✔
167
                                usingPriorities;
2✔
168
                                removeVowels;
2✔
169
                                ellipsisUpTo: 8;
2✔
170
                                reduce: each ] ]
2✔
171
        ifFalse: [ names ].
2✔
172
        selectedAssociationsString := reducedNames joinUsing: ', '.
2✔
173
        selectedAssociationsLabel label: selectedAssociationsString
2✔
174
]
2✔
175

176
{ #category : #actions }
177
MiNavigationQueryPresenter >> updateQueryWithSelectedAssociations: selectedAssociations [
2✔
178

2✔
179
        | nonSelectedAssociations |
2✔
180
        nonSelectedAssociations := self query associations difference:
2✔
181
                                           selectedAssociations.
2✔
182
        selectedAssociations do: [ :assoc | self query addAssociation: assoc ].
2✔
183
        nonSelectedAssociations do: [ :assoc | 
2✔
184
                self query removeAssociation: assoc ]
2✔
185
]
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

© 2026 Coveralls, Inc