Dynamic Web Development with Seaside

11.3Call/Answer Explained

Call and Answer at Work

Figure 83 illustrates the call/answer principle. The application is showing our ContactListView component.

When the user presses edit next to a contact name, the ContactListView component executes its callbacks until it reaches the line self call: ..., where it sends the message call: and passes it the ContactView component. This causes ContactView to take control of the browser region occupied by ContactListView. Note that the other component A, can continue to be active; this is an example of having multiple, simultaneous control flows in an application.

When the component ContactView reaches the line self answer, it sends the message answer, which has the effect of closing the ContactView component, giving back control to the ContactListView component, and possibly returning a value, as you will see in the next section. The returned value can be a complex object such as credit card information or a complete Contact object, or it can be as simple as a primitive object such an integer or a string. With Seaside you handle objects directly and there is no need to translate or marshall them in order to pass them around different components.

After the answer message send, the execution of the component ContactListView continues just after the call that opened the component ContactView. This is marked as "continue here" in the diagram.

Copyright © 19 March 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.