• 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

96.7
/src/MooseIDE-QueriesBrowser/MiTypeQueryPresenter.class.st
1
"
2
A query configuration presenter for the `FQTypeQuery` 
3

4
"
5
Class {
6
        #name : #MiTypeQueryPresenter,
7
        #superclass : #MiQueryConfiguratorPresenter,
8
        #instVars : [
9
                'typesButton',
10
                'typesList',
11
                'selectedTypesLabel',
12
                'typesModal'
13
        ],
14
        #category : #'MooseIDE-QueriesBrowser-Configuration presenters'
15
}
16

17
{ #category : #specs }
18
MiTypeQueryPresenter class >> title [
×
19
        ^ 'Type Query'
×
20
]
×
21

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

2✔
25
        typesButton := self newTypesButton.
2✔
26
        typesList items: self query availableTypes | aQuery types.
2✔
27
        typesList selectItems: aQuery types.
2✔
28
        query types: aQuery types.
2✔
29
        query := aQuery
2✔
30
]
2✔
31

32
{ #category : #actions }
33
MiTypeQueryPresenter >> configureQuery: aType [
2✔
34

2✔
35
        self updateQueryWithSelectedTypes: typesList selectedItems
2✔
36
]
2✔
37

38
{ #category : #initialization }
39
MiTypeQueryPresenter >> initializeLabel [
2✔
40

2✔
41
        selectedTypesLabel := self newLabel
2✔
42
]
2✔
43

44
{ #category : #initialization }
45
MiTypeQueryPresenter >> initializePresenters [
2✔
46

2✔
47
        self initializeTypesList.
2✔
48
        self initializeTypesButton.
2✔
49
        self initializeLabel.
2✔
50
        self initializeLayout
2✔
51
]
2✔
52

53
{ #category : #initialization }
54
MiTypeQueryPresenter >> initializeTypesButton [
2✔
55

2✔
56
        typesButton := self query availableTypes
2✔
57
                               ifEmpty: [ self noParameterMessage: 'type' ]
2✔
58
                               ifNotEmpty: [ self newTypesButton ]
2✔
59
]
2✔
60

61
{ #category : #initialization }
62
MiTypeQueryPresenter >> initializeTypesList [
2✔
63

2✔
64
        typesList := self instantiate: MiTypeSelectionPresenter on: self
2✔
65
]
2✔
66

67
{ #category : #'widgets configuration' }
68
MiTypeQueryPresenter >> labelFor: type [
2✔
69

2✔
70
        ^ type mooseDescription name asEnglishPlural
2✔
71
]
2✔
72

73
{ #category : #layout }
74
MiTypeQueryPresenter >> newLayout [
2✔
75

2✔
76
        | padding |
2✔
77
        padding := 5.
2✔
78
        ^ SpBoxLayout newLeftToRight
2✔
79
                add: typesButton
2✔
80
                expand: false
2✔
81
                fill: true
2✔
82
                padding: padding;
2✔
83
                add: selectedTypesLabel;
2✔
84
                yourself
2✔
85
]
2✔
86

87
{ #category : #initialization }
88
MiTypeQueryPresenter >> newTypesButton [
2✔
89

2✔
90
        ^ self newButton
2✔
91
                  label: 'Select Types';
2✔
92
                  action: [
2✔
93
                          typesList selectItems: self query types.
2✔
94
                          typesModal := typesList openModal.
2✔
95
                          typesModal isCancelled ifFalse: [ self selectTypeAction: nil ] ];
2✔
96
                  yourself
2✔
97
]
2✔
98

99
{ #category : #actions }
100
MiTypeQueryPresenter >> selectTypeAction: aType [
2✔
101

2✔
102
        self updateTypesLabel.
2✔
103
        self computeQueryAction: aType
2✔
104
]
2✔
105

106
{ #category : #initialization }
107
MiTypeQueryPresenter >> updateQueryWithSelectedTypes: selectedTypes [
2✔
108

2✔
109
        | nonSelectedTypes |
2✔
110
        nonSelectedTypes := self query types difference: selectedTypes.
2✔
111
        selectedTypes do: [ :type | self query addType: type ].
2✔
112
        nonSelectedTypes do: [ :type | self query removeType: type ]
2✔
113
]
2✔
114

115
{ #category : #actions }
116
MiTypeQueryPresenter >> updateTypesLabel [ 
2✔
117

2✔
118
        | selectedTypesText names reducedNames |
2✔
119
        names := typesList selectedItems collect: [ :each | self labelFor: each].
2✔
120
        reducedNames := names size > 4
2✔
121
                ifTrue: [ 
2✔
122
                        names collect: [ :each |
2✔
123
                        LbCContractor new
2✔
124
                                usingPriorities;
2✔
125
                                abbreviateNamesUntil: 1;
2✔
126
                                removeVowels;
2✔
127
                                ellipsisUpTo: 8;
2✔
128
                                reduce: each ] ]
2✔
129
                ifFalse: [ names ].
2✔
130
        selectedTypesText := reducedNames joinUsing: ', '.
2✔
131
        selectedTypesLabel label: selectedTypesText
2✔
132
]
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