Red Hat Web Application Framework 6.1 Manuel D’Utilisation

Page de 230
Chapter 5. WAF Component: Presentation
27
TabbedPane tabs = new TabbedPane();
page.add(tabs);
tabs.addTab("Browse", new BrowsePane());
tabs.addTab("Search", new SearchPane());
tabs.addTab("Roles", new RoleAdminPane());
page.lock();
Document doc = page.buildDocument(sreq, sresp);
transform(sreq, sresp, doc);
}
Example 5-2. Basic Bebop Page
5.4.1.1. Bebop Lifecycles
Bebop components used in a page design have a regular lifecycle.
UI Lifecycle
1. Register each component.
a. Each component adds any state parameters and event listeners it needs.
b. Each component is added to the page and given a unique key so that any state carried in
the query string is safe from collisions.
2. Lock the component tree.
a. Components can no longer be added or removed. The component instances are now safe
for reuse across requests.
3. Service requests.
Request Lifecycle
1. Client sends an HTTP request.
2. A new page state object is created.
Using the servlet request and the parameter models defined by the developer, the page builds an
object representing the state of the current request.
In addition to component state parameters, the selected component and the visibility state are
recovered from the servlet request state.
3. Fire the request event.
Any request listeners added when each component registered itself run at this time. Note that this
runs before the page request state is validated; in fact, the request event runs before much of any
work is done.
4. Validate page state.
This is when custom validators, e.g. a zip-code validation listener, are run. Parameters are also
typed at this step.
If there are errors, they are saved so that the component whose state is invalid may choose how to
present the issues.