You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/tutorial.texi
+10-7Lines changed: 10 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@
5
5
@cindexwidget
6
6
@cindexapplication
7
7
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
+
9
10
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.
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.
36
37
37
38
@example
38
39
increase [
@@ -46,7 +47,7 @@ decrease [
46
47
]
47
48
@end example
48
49
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.
50
51
51
52
@example
52
53
contents [
@@ -61,7 +62,7 @@ contents [
61
62
]
62
63
@end example
63
64
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.
65
66
66
67
@example
67
68
increase [
@@ -79,10 +80,11 @@ decrease [
79
80
80
81
@unnumberedsec Using the counter widget in an application
81
82
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{controllermethods}, 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{controllermethods}, similar to the @code{#contents} method of widgets. The default controller method is @code{#index}.
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