Skip to content

Commit ee0fe44

Browse files
committed
tutorial update
1 parent e9cb3bd commit ee0fe44

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

doc/tutorial.texi

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
@cindex widget
66
@cindex application
77

8-
In this short tutorial we will build our first Iliad widget: a simple counter.
8+
In this short tutorial we will build a simple counter as our first Iliad widget and embed it into a simple application.
9+
910
Widgets (@pxref{Widgets}) are high-level reusable, stateful, graphical objects. We will create the class and a method to build HTML, then add some behavior to increase and decrease the counter.
1011

1112
@unnumberedsec Our first widget
@@ -16,7 +17,7 @@ Iliad.ILWidget subclass: CounterWidget [
1617
| count |
1718
1819
initialize [
19-
super initiliaze.
20+
super initialize.
2021
count := 0
2122
]
2223
]
@@ -32,7 +33,7 @@ contents [
3233

3334
@unnumberedsec Action methods
3435

35-
Now we can add action methods to increase and decrease the counter.
36+
Now we can add action methods (@pxref{Actions}) to increase and decrease the counter.
3637

3738
@example
3839
increase [
@@ -46,7 +47,7 @@ decrease [
4647
]
4748
@end example
4849

49-
To allow the user to increase or decrease the counter, we build anchors which will call the action methods (@pxref{Actions}), and modify the @code{contents} method as follow.
50+
To allow the user to increase or decrease the counter, we add anchors sending these messages to the @code{contents} method.
5051

5152
@example
5253
contents [
@@ -61,7 +62,7 @@ contents [
6162
]
6263
@end example
6364

64-
To tell Iliad that the state of the counter has changed and that it should be rebuilt, we call its @code{#markDirty} method in the action methods.
65+
If you try the code at this point, you will notice that the displayed counter value does not change, although the count instance variable is being updated. The missing link here is that you have to tell Iliad that changing the value of the @code{count} variable requires a client side update of the widget, too. Iliad will take care of this, but you have to decide and tell Iliad which widget(s) need rebuilding. You do this by sending the message @code{markDirty} to the widget(s) in question.
6566

6667
@example
6768
increase [
@@ -79,10 +80,11 @@ decrease [
7980

8081
@unnumberedsec Using the counter widget in an application
8182

82-
To see our widget in action, we build it in an application. Applications (@pxref{Applications}) are similar to widgets except that they dispatch requests in @dfn{controller methods}, similar to the @code{#contents} method of widgets. The default controller method is @code{#index}.
83+
To see our widget in action, we embed it into an application. Applications (@pxref{Applications}) are similar to widgets except that they dispatch requests in @dfn{controller methods}, similar to the @code{#contents} method of widgets. The default controller method is @code{#index}.
8384

8485
@example
8586
Iliad.ILApplication subclass: CounterApplication [
87+
| counterWidget |
8688
8789
CounterApplication class >> path [
8890
^'counter'
@@ -99,4 +101,5 @@ Iliad.ILApplication subclass: CounterApplication [
99101
]
100102
@end example
101103

102-
The class side @code{#path} method answers the base path of our application.
104+
The class side @code{#path} method answers the base path of our application. All requests using this path will be handled by the application.
105+
As seen above, widgets are usually initialized lazily. While you have to provide the implementation for every widget you @emph{might} use, not every widget @emph{will} be used. By using this pattern, only those widgets are built that are actually used.

0 commit comments

Comments
 (0)