Skip to content

Commit a454160

Browse files
committed
Merge d27c3fd
2 parents 8c614ce + d27c3fd commit a454160

6 files changed

+147
-97
lines changed

src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ GtCoderMethodsGroupedListElement >> pushDownMethod: aSelector inElement: elem [
195195
^ self
196196
addPreviewButtonFor: refactoring
197197
to: elem
198-
cancelSelector: #updateProtocolList
198+
cancelSelector: #updateProtocolsList
199199
]
200200

201201
{ #category : #'private - actions' }
@@ -207,7 +207,7 @@ GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [
207207
^ self
208208
addPreviewButtonFor: refactoring
209209
to: elem
210-
cancelSelector: #updateProtocolList
210+
cancelSelector: #updateProtocolsList
211211
]
212212

213213
{ #category : #'private - actions' }
@@ -249,7 +249,7 @@ GtCoderMethodsGroupedListElement >> renameMethod: aSelector inElement: elem [
249249
self
250250
addPreviewButtonFor: refactoring
251251
to: elem
252-
cancelSelector: #updateProtocolList ];
252+
cancelSelector: #updateProtocolsList ];
253253
switchToEditor.
254254
edit requestFocus.
255255
elem removeChildren.

src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ Class {
99
#instVars : [
1010
'supressListChanges',
1111
'classesList',
12-
'navigationModel'
12+
'navigationModel',
13+
'methodsList',
14+
'protocolsList',
15+
'slotsList'
1316
],
1417
#category : #'GToolkit-Coder-UI-Navigation'
1518
}
@@ -35,18 +38,68 @@ GtCoderNavigationClassHierarchyElement >> hasNavigationModel [
3538
self navigationModel isNavigationModel ]
3639
]
3740

38-
{ #category : #'as yet unclassified' }
41+
{ #category : #initialization }
42+
GtCoderNavigationClassHierarchyElement >> headerLabel [
43+
| label |
44+
label := BrLabel new.
45+
label
46+
aptitude: (BrGlamorousLabelAptitude new
47+
fontSize: 12;
48+
foreground: Color gray).
49+
^ label
50+
]
51+
52+
{ #category : #initialization }
3953
GtCoderNavigationClassHierarchyElement >> initialize [
54+
| protocolsSlotsTabGroup pane1 pane2 pane3 |
4055
super initialize.
4156

42-
self layout: BlLinearLayout vertical.
57+
self layout: BlLinearLayout horizontal.
4358
self constraintsDo: [ :c |
4459
c horizontal matchParent.
4560
c vertical matchParent ].
4661

47-
classesList := GtCoderClassesTreeElement new.
62+
classesList := GtCoderClassesTreeElement new.
63+
protocolsList := GtCoderProtocolsGroupedListElement new.
64+
slotsList := GtCoderSlotsGroupedListElement new.
65+
methodsList := GtCoderMethodsGroupedListElement new.
66+
67+
protocolsSlotsTabGroup := BrTabGroup new
68+
aptitude: BrGlamorousTabGroupProportionalAptitude - BrTabGroupSplitterAptitude;
69+
addTab: (BrTab new
70+
hMatchParent;
71+
aptitude: GtProtocolSlotTabAptitude new;
72+
label: 'Categories' asRopedText glamorousCodeSmallSize;
73+
stencil: [ protocolsList ]);
74+
addTab: (BrTab new
75+
hMatchParent;
76+
aptitude: GtProtocolSlotTabAptitude new;
77+
label: 'Slots' asRopedText glamorousCodeSmallSize;
78+
stencil: [ slotsList ]).
79+
80+
pane1 := BrVerticalPane new
81+
addAptitude: BrGlamorousWithHorizontalResizerAptitude;
82+
matchParent;
83+
addChildren: {
84+
self headerLabel text: 'Classes'.
85+
classesList }.
86+
pane2 := BrVerticalPane new
87+
addAptitude: BrGlamorousWithHorizontalResizerAptitude;
88+
matchParent;
89+
addChildren: {
90+
protocolsSlotsTabGroup }.
91+
92+
pane3 := BrVerticalPane new
93+
matchParent;
94+
addChildren: {
95+
self headerLabel text: 'Methods'.
96+
methodsList}.
97+
98+
self
99+
addChildren: {pane1.
100+
pane2.
101+
pane3}
48102

49-
self addChild: classesList
50103
]
51104

52105
{ #category : #accessing }
@@ -97,6 +150,14 @@ GtCoderNavigationClassHierarchyElement >> onNavigationModelChanged [
97150
self updateContent.
98151
self subscribeToNavigationModel.
99152
self subscribeToClassList.
153+
154+
protocolsList navigationModel: self navigationModel.
155+
protocolsList updateProtocolListWith: self navigationModel protocolsToShow.
156+
self navigationModel selectedProtocol
157+
ifNotNil: [ :aProtocol | protocolsList selectProtocol: aProtocol ].
158+
159+
slotsList navigationModel: self navigationModel.
160+
methodsList navigationModel: self navigationModel
100161
]
101162

102163
{ #category : #'private - selection' }

src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt
232232

233233
{ #category : #'event handling' }
234234
GtCoderNavigationPackagesTagsClassesElement >> onNavigationModelChanged [
235+
methodProtocolsList navigationModel: self navigationModel.
235236
slotsGroupList navigationModel: self navigationModel.
236237
methodGroupList navigationModel: self navigationModel.
237238

@@ -317,39 +318,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [
317318
self deselectClasses ] ]
318319
]
319320

320-
{ #category : #'event handling - selection' }
321-
GtCoderNavigationPackagesTagsClassesElement >> onProtocolDeselected: anAnnouncement [
322-
methodProtocolsList deselectProtocol
323-
]
324-
325-
{ #category : #'event handling' }
326-
GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [
327-
| aSelectedItem |
328-
slotsGroupList deselectAll.
329-
aSelectedItem := methodProtocolsList selectedProtocol.
330-
aSelectedItem ifNil: [^self].
331-
self navigationModel selectProtocol: aSelectedItem source: self.
332-
"methodGroupList deselectAll.
333-
self updateMethodListWith: self navigationModel methodsToShow."
334-
]
335-
336-
{ #category : #'event handling - selection' }
337-
GtCoderNavigationPackagesTagsClassesElement >> onProtocolSelected: anAnnouncement [
338-
methodProtocolsList selectProtocol: anAnnouncement protocol
339-
]
340-
341-
{ #category : #'event handling' }
342-
GtCoderNavigationPackagesTagsClassesElement >> onProtocolsToShowChanged: anAnnouncement [
343-
self hasNavigationModel
344-
ifFalse: [ ^ self ].
345-
346-
methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow.
347-
348-
self navigationModel selectedProtocol
349-
ifNil: [ methodProtocolsList deselectProtocol ]
350-
ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ]
351-
]
352-
353321
{ #category : #'api - package updates' }
354322
GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [
355323
| aSelectedPackageOrTag anIndex |
@@ -528,7 +496,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [
528496
super subscribeToContent.
529497
self subscribeToPackageList.
530498
self subscribeToClassList.
531-
self subscribeToProtocolList.
532499
]
533500

534501
{ #category : #subscriptions }
@@ -548,10 +515,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [
548515
GtCoderNavigationPackageTagRenamed -> #onPackageTagRenamed:.
549516
"Announcement when items selected"
550517
"GtCoderNavigationClassSelected -> #onClassSelected:. <--- defined in the superclass"
551-
GtCoderNavigationProtocolSelected -> #onProtocolSelected:.
552-
GtCoderNavigationProtocolDeselected -> #onProtocolDeselected:.
553518
"Announcements when we need to update items in the lists"
554-
GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:.
555519
GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:.
556520
}.
557521
subscriptions
@@ -569,13 +533,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [
569533
do: [ :anEvent | self onPackageListSelectionChanged ]
570534
]
571535

572-
{ #category : #subscriptions }
573-
GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [
574-
methodProtocolsList
575-
when: BrSelectionChanged
576-
do: [ :anEvent | self onProtocolListSelectionChanged ]
577-
]
578-
579536
{ #category : #'updating lists' }
580537
GtCoderNavigationPackagesTagsClassesElement >> updateClassList [
581538
self hasNavigationModel
@@ -591,7 +548,6 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassList [
591548
GtCoderNavigationPackagesTagsClassesElement >> updateContent [
592549
self updatePackageLists.
593550
self updateClassList.
594-
self updateProtocolList.
595551
]
596552

597553
{ #category : #'updating lists' }
@@ -607,14 +563,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [
607563

608564
{ #category : #'updating lists' }
609565
GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [
610-
self hasNavigationModel
611-
ifFalse: [ ^ self ].
612-
613-
methodProtocolsList navigationModel: self navigationModel.
614-
methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow.
615-
616-
self navigationModel selectedProtocol
617-
ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ]
566+
methodProtocolsList updateProtocolsList
618567
]
619568

620569
{ #category : #'updating lists' }

src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ GtCoderProtocolsGroupedListElement >> initialize [
267267
protocolsGroupName: each domainObject
268268
targetClass: self navigationModel selectedClass ].
269269

270-
self when: BrSelectionChanged do: [ self privateEndRenameProtocol ].
270+
self when: BrSelectionChanged do: [
271+
self privateEndRenameProtocol.
272+
self onProtocolListSelectionChanged ].
271273

272274
protocolGroups := self createProtocolGroups.
273275
self groups: protocolGroups
@@ -280,7 +282,14 @@ GtCoderProtocolsGroupedListElement >> navigationModel [
280282

281283
{ #category : #accessing }
282284
GtCoderProtocolsGroupedListElement >> navigationModel: anObject [
283-
navigationModel := anObject
285+
navigationModel == anObject
286+
ifTrue: [ ^ self ].
287+
288+
self unsubscribeFromNavigationModel.
289+
navigationModel := anObject.
290+
self subscribeToNavigationModel.
291+
292+
self updateProtocolsList
284293
]
285294

286295
{ #category : #'private - refactorings' }
@@ -335,6 +344,31 @@ GtCoderProtocolsGroupedListElement >> onDropCompiledMethodsOnProtocol: anItemsDr
335344
compositeChange execute
336345
]
337346

347+
{ #category : #'event handling' }
348+
GtCoderProtocolsGroupedListElement >> onProtocolDeselected: anAnnouncement [
349+
self deselectProtocol
350+
]
351+
352+
{ #category : #'event handling' }
353+
GtCoderProtocolsGroupedListElement >> onProtocolListSelectionChanged [
354+
| aSelectedItem |
355+
aSelectedItem := self selectedProtocol.
356+
aSelectedItem ifNil: [ ^ self ].
357+
358+
self navigationModel
359+
ifNotNil: [ :aModel | aModel selectProtocol: aSelectedItem source: self ]
360+
]
361+
362+
{ #category : #'event handling' }
363+
GtCoderProtocolsGroupedListElement >> onProtocolSelected: anAnnouncement [
364+
self selectProtocol: anAnnouncement protocol
365+
]
366+
367+
{ #category : #'event handling' }
368+
GtCoderProtocolsGroupedListElement >> onProtocolsToShowChanged: anAnnouncement [
369+
self updateProtocolsList
370+
]
371+
338372
{ #category : #'private - refactorings' }
339373
GtCoderProtocolsGroupedListElement >> privateEndRenameProtocol [
340374
"Removes protocol editing UI"
@@ -406,7 +440,30 @@ GtCoderProtocolsGroupedListElement >> selectedProtocol [
406440
^ (self viewModel entityAt: anIndex) value object
407441
]
408442

409-
{ #category : #'api - list' }
443+
{ #category : #'private - subscriptions' }
444+
GtCoderProtocolsGroupedListElement >> subscribeToNavigationModel [
445+
| subscriptions |
446+
447+
subscriptions := {
448+
GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:.
449+
GtCoderNavigationProtocolSelected -> #onProtocolSelected:.
450+
GtCoderNavigationProtocolDeselected -> #onProtocolDeselected:.
451+
}.
452+
453+
subscriptions
454+
do: [ :sub |
455+
navigationModel weak
456+
when: sub key
457+
send: sub value
458+
to: self ]
459+
]
460+
461+
{ #category : #subscriptions }
462+
GtCoderProtocolsGroupedListElement >> unsubscribeFromNavigationModel [
463+
navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]
464+
]
465+
466+
{ #category : #'private - updating' }
410467
GtCoderProtocolsGroupedListElement >> updateProtocolListWith: theGtPharoProtocols [
411468
| virtualStream instStream classStream virtualGtPharoProtocols instanceGtPharoProtocols classGtPharoProtocols groupItems |
412469

@@ -442,3 +499,12 @@ GtCoderProtocolsGroupedListElement >> updateProtocolListWith: theGtPharoProtocol
442499

443500
self groups: protocolGroups
444501
]
502+
503+
{ #category : #'private - updating' }
504+
GtCoderProtocolsGroupedListElement >> updateProtocolsList [
505+
self updateProtocolListWith: self navigationModel protocolsToShow.
506+
507+
self navigationModel selectedProtocol
508+
ifNil: [ self deselectProtocol ]
509+
ifNotNil: [ :aProtocol | self selectProtocol: aProtocol ]
510+
]

src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)