marp | title | description | author |
---|---|---|---|
true |
Spec |
Pharo Training |
Santiago Bragagnolo |
- Model View Presenter
- Object Oriented
- Model
- View
- Presenter
- Subclass
SpPresenter
- Often 1 instance variable per internal wideget
- Overrides methods:
#defaultLayout
#initializePresenters
#connectPresenter
initializePresenters
title := self newDropList .
name := self newDropList .
date := self newTextInput .
details := self newText.
table := self newTable.
ok := self newButton
label:#ok;
yourself.
cancel := self newButton
label:#cancel;
yourself.
defaultLayout
^ SpBoxLayout newLeftToRight
add: (SpBoxLayout newTopToBottom
add: #title
height: self toolbarHeight;
add: #date
height: self toolbarHeight;
add: #details);
add: (SpBoxLayout newTopToBottom
add: #name
height: self toolbarHeight;
add: #table;
add: (SpBoxLayout newLeftToRight
add: #ok;
add: #cancel));
yourself
connectPresenters
ok action: [
self inform:'Ok'
].
cancel action: [
self inform:'Cancel'
].
model: aModel
model := aModel.
self modelChanged.
modelChanged
self fillWidgetWithModel
fillWidgetWithModel
title selectedItem: model title.
name selectedItem: model name.
date text: model birthDate.
details text: model details.