Skip to content

Commit 35dff5a

Browse files
committed
explaining model
1 parent 9cefce6 commit 35dff5a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Chapters/Country/CountriesExamples.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ Object << #EarthMap
247247
```
248248

249249
We initialize the `countries` instance variable to an `OrderedCollection`.
250+
Define an accessor.
250251

251252
```
252253
EarthMap >> initialize
@@ -347,19 +348,22 @@ First we define a new class `EarthCountryBrowser`. It inherits from the class `S
347348

348349
```
349350
SpPresenterWithModel << #EarthCountryBrowser
350-
slots: { #countryList . #countryCode . #countryFlag };
351+
slots: { #countryList . #countryCode . #countryFlag };
351352
package: 'EarthTutorial'
352353
```
353354

354355
The instance variables are:
355356
- `countryList` is a presenter of the list of country names. It is a drop-list presenter.
356357
- `countryCode` is a presenter to display the country code such as FR or CH. It is an input field presenter.
357358
- `countryFlag` is a presenter for the flag. It is an image presenter.
358-
- map is an instance of the class `EarthMap`.
359359

360360
#### Initialize sub components.
361361

362362
With the method `initializePresenters`, we initialize the different presenters that compose our interface.
363+
Note that the expression `self model` is given by the superclass `SpPresenterWithModel`.
364+
The model is automatically set using the message \ct{on:} as shown below in expression
365+
\ct{(EarthCountryBrowser on: ...}.
366+
In our scenario the model is an instance of the class \ct{EarthMap}.
363367

364368
```
365369
EarthCountryBrowser >> initializePresenters
@@ -426,7 +430,7 @@ EarthCountryBrowser >> flagForCountryCode: astring
426430
^ BorderedMorph new asForm
427431
```
428432

429-
Once this done we can know define the method `onCountrySelected:`
433+
Once this is done, we can now define the method `onCountrySelected:`
430434
that will display the country code and the flag. We concatenate some spaces in front of the country code so that it looks better on the screen.
431435

432436

0 commit comments

Comments
 (0)