Skip to content

Commit 77e28fa

Browse files
committed
fixed ToListDisabledSelectionElementEventHandler>>listDisabledSelectionChangedEvent:
1 parent eb7f36a commit 77e28fa

14 files changed

+81
-50
lines changed

src/Toplo-Examples/ToSandBox.class.st

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10176,8 +10176,7 @@ ToSandBox class >> listWithData: aCollection [
1017610176
holder fontSize ifNil: [
1017710177
holder fontSize: (rand nextIntegerBetween: 10 and: 16) ].
1017810178
label := (ToLabel text:
10179-
holder position asString , ': '
10180-
, dataItem asString)
10179+
holder position asString , ': ' , dataItem asString)
1018110180
fontSize: holder fontSize;
1018210181
yourself.
1018310182
triplet startElement: ToIconicRemoveButton new.
@@ -10234,8 +10233,9 @@ ToSandBox class >> listWithData: aCollection [
1023410233
labelText: 'Unable/disable';
1023510234
clickAction: [
1023610235
idxes do: [ :idx |
10237-
(bar nodeContainerAt: idx) disabled:
10238-
(bar nodeContainerAt: idx) isEnabled ] ];
10236+
(bar isEnabledAtPosition: idx)
10237+
ifTrue: [ bar disabledAtPosition: idx ]
10238+
ifFalse: [ bar enabledAtPosition: idx ] ] ];
1023910239
yourself).
1024010240
m addItem: (ToMenuItem new
1024110241
labelText: 'Unselectable';

src/Toplo-Widget-Circular/ToCircularMenuNode.class.st

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ ToCircularMenuNode >> applyConfiguration [
3939
self fitContent
4040
]
4141

42+
{ #category : #'event handling' }
43+
ToCircularMenuNode >> enablementChangedEvent: anEvent [
44+
45+
self holder nodeContainer flagAsDisabled: self isDisabled
46+
]
47+
48+
{ #category : #initialization }
49+
ToCircularMenuNode >> initialize [
50+
51+
super initialize.
52+
self
53+
addEventFilterOn: ToEnablementChangedEvent
54+
do: [ :event | event sendTo: self ]
55+
]
56+
4257
{ #category : #'t - item node' }
4358
ToCircularMenuNode >> installEventDelegatorOnItem [
4459

src/Toplo-Widget-List/TToInnerFiniteListElement.trait.st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ TToInnerFiniteListElement >> onItemRangeChanged: aPositionStart itemCount: anIte
154154
pos := container holder position.
155155
(pos >= aPositionStart and: [ pos < (aPositionStart + anItemCount) ])
156156
ifTrue: [
157+
container holder initializeNodeSelections.
157158
container requestConfiguration ] ]
158159
]
159160

src/Toplo-Widget-List/TToInnerListElement.trait.st

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,6 @@ TToInnerListElement >> partlyVisibleNodesDo: aBlock [
168168
^ self shouldBeImplemented
169169
]
170170

171-
{ #category : #'t - inner list element' }
172-
TToInnerListElement >> postponeAction: aValuable for: aTarget [
173-
174-
self dataSourceManager postponeAction: aValuable for: aTarget.
175-
" ensure a layout here to trigger the action running"
176-
self requestLayout
177-
]
178-
179171
{ #category : #'t - inner list element' }
180172
TToInnerListElement >> postponeCommand: aCommand [
181173

src/Toplo-Widget-List/TToItemListUser.trait.st

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,18 @@ TToItemListUser >> isItemContainer [
145145
^ true
146146
]
147147

148+
{ #category : #'t - item list user - disable/ enable' }
149+
TToItemListUser >> isItemDisabled: anItem [
150+
151+
self itemList isDisabledAtPosition: anItem positionInList
152+
]
153+
154+
{ #category : #'t - item list user - disable/ enable' }
155+
TToItemListUser >> isItemEnabled: anItem [
156+
157+
self itemList isEnabledAtPosition: anItem positionInList
158+
]
159+
148160
{ #category : #'t - item list user - configuration' }
149161
TToItemListUser >> isScrollable [
150162

src/Toplo-Widget-List/TToPostponedCommandManager.trait.st

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@ TToPostponedCommandManager >> nextFinalStepCommand [
5050
^ self finalStepCommands removeFirst
5151
]
5252

53-
{ #category : #'t - postponed command manager' }
54-
TToPostponedCommandManager >> postponeAction: aValuable for: aTarget [
55-
56-
self postponeCommand: (ToListDataSourceActionCommand new
57-
action: [ aValuable cull: aTarget ];
58-
yourself)
59-
]
60-
6153
{ #category : #'t - postponed command manager' }
6254
TToPostponedCommandManager >> postponeCommand: aCommand [
6355

src/Toplo-Widget-List/ToBasicListElement.class.st

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Class {
1111
'mouseMoveReplayRequested',
1212
'innerElementClass',
1313
'innerElement',
14-
'postponedActions'
14+
'postponedCommands'
1515
],
1616
#category : #'Toplo-Widget-List-Core'
1717
}
@@ -64,12 +64,12 @@ ToBasicListElement >> checkMouseMoveReplayRequest [
6464
]
6565

6666
{ #category : #layout }
67-
ToBasicListElement >> checkPostponedActions [
67+
ToBasicListElement >> checkPostponedCommands [
6868

69-
postponedActions ifEmpty: [ ^ self ].
70-
postponedActions do: [ :action |
71-
self innerElement postponeAction: action for: self ].
72-
postponedActions reset
69+
postponedCommands ifEmpty: [ ^ self ].
70+
postponedCommands do: [ :cmd |
71+
self innerElement postponeCommand: cmd].
72+
postponedCommands reset
7373
]
7474

7575
{ #category : #layout }
@@ -323,7 +323,7 @@ ToBasicListElement >> hiddenSelectionModel [
323323
ToBasicListElement >> initialize [
324324

325325
super initialize.
326-
postponedActions := OrderedCollection new.
326+
postponedCommands := OrderedCollection new.
327327
mouseMoveReplayRequested := false.
328328
selectionModeMap := IdentityDictionary new.
329329

@@ -593,7 +593,7 @@ ToBasicListElement >> onLayoutDone [
593593

594594
super onLayoutDone.
595595
self checkSelections.
596-
self checkPostponedActions.
596+
self checkPostponedCommands.
597597
self checkMouseMoveReplayRequest
598598
]
599599

@@ -613,18 +613,19 @@ ToBasicListElement >> placeholderClass [
613613
{ #category : #layout }
614614
ToBasicListElement >> postponeAction: aValuable [
615615

616-
innerElement ifNotNil: [ :inner |
617-
^ inner postponeAction: aValuable for: self ].
618-
postponedActions add: aValuable.
616+
| cmd |
617+
cmd := ToListDataSourceActionCommand action: aValuable.
618+
innerElement ifNotNil: [ :inner | ^ inner postponeCommand: cmd ].
619+
postponedCommands add: cmd.
619620
self requestLayout
620621
]
621622

622623
{ #category : #layout }
623-
ToBasicListElement >> postponeCommand: aCommand [
624+
ToBasicListElement >> postponeCommand: aCommand [
624625

625626
innerElement ifNotNil: [ :inner |
626-
^ inner postponeCommand: aCommand ].
627-
postponedActions add: [ self postponeCommand: aCommand ].
627+
^ inner postponeCommand: aCommand ].
628+
postponedCommands add: aCommand.
628629
self requestLayout
629630
]
630631

src/Toplo-Widget-List/ToListDataSourceActionCommand.class.st

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Class {
77
#category : #'Toplo-Widget-List-InnerList'
88
}
99

10+
{ #category : #accessing }
11+
ToListDataSourceActionCommand class >> action: aValuable [
12+
13+
^ self new action: aValuable
14+
]
15+
1016
{ #category : #accessing }
1117
ToListDataSourceActionCommand >> action [
1218

src/Toplo-Widget-List/ToListDisabledSelectionElementEventHandler.class.st

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@ ToListDisabledSelectionElementEventHandler >> listDisabledSelectionChangedEvent:
1818
self updateSelectionFromEvent: anEvent.
1919
anEvent selectionModel selectedIndexesIntervalsDo: [ :int |
2020
listElement selectionMode makeDisabledUnselectable ifTrue: [
21-
listElement selecter deselectInterval: int ] ]
21+
listElement selecter deselectInterval: int ] ].
22+
anEvent appliedCommand indexes do: [ :idx |
23+
listElement dataSource notifyItemsChanged: (idx to: idx) ].
24+
listElement requestUpdateSelectionMode:
25+
listElement primarySelectionMode
2226
]

src/Toplo-Widget-List/ToListSelecter.class.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,13 @@ ToListSelecter >> nextSelectableIndexToScrollTo [
297297
ToListSelecter >> onBasicCommandApplied: aCommand [
298298

299299
selectionChangedEventClass ifNil: [ ^ self ].
300-
300+
301301
element dispatchEvent: (ToListSelectionCommandAppliedEvent new
302302
command: aCommand;
303303
yourself).
304304

305305
element dispatchEvent: (selectionChangedEventClass new
306-
selectionModel: aCommand selectionModel;
306+
appliedCommand: aCommand;
307307
selectionOption: self selectionOption;
308308
yourself)
309309
]

0 commit comments

Comments
 (0)