Skip to content

Commit

Permalink
Add the adapter for drop list
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Jun 21, 2024
1 parent eae6ea7 commit f79b944
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/Spec-Toplo/SpToploDropListAdapter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Class {
#name : #SpToploDropListAdapter,
#superclass : #SpToploWidgetAdapter,
#category : #'Spec-Toplo-Adapters'
}

{ #category : #factory }
SpToploDropListAdapter >> buildWidget [

^ ToSingleSelectElement new
]

{ #category : #accessing }
SpToploDropListAdapter >> selectedIndexes [

^ widget selecter selectedIndexes
]

{ #category : #initialization }
SpToploDropListAdapter >> subscribeToPresenter [

super subscribeToPresenter.

model model whenChangedDo: [
self
updateItems;
updateSelection ].
model selection whenChangedDo: [ self updateSelection ]
]

{ #category : #initialization }
SpToploDropListAdapter >> updateAll [

super updateAll.

self
updateItems;
updateSelection
]

{ #category : #updating }
SpToploDropListAdapter >> updateItems [

widget dataAccessor
removeAll;
addAll: model items
]

{ #category : #private }
SpToploDropListAdapter >> updateSelection [

widget selecter selectIndex: model selectedIndex
]

0 comments on commit f79b944

Please sign in to comment.