First page Back Continue Last page Graphics


Notes:

Using a Train Component (continued)

As shown in the slide, the train component provides at least four styles for train stops:

The current stop is indicated by a bold font style in the label, and a different image for the stop.

Stops visited before the current stop are indicated by a different label font color and image color.

The next stop immediately after the current stop appears enabled.

Any other stops that have not been visited are grayed out.

A train stop can include a subprocess train; that is, you can launch a child multistep process from a parent stop, and then return to the correct parent stop after completing the subprocess. Suppose stop #4 has a subprocess train containing three stops. When the user navigates into the first stop in the subprocess train, ADF Faces displays an icon representing the parent train before and after the subprocess train.

Adding Navigation Buttons

The af:trainButtonBar component may be used in conjunction with the af:train component to provide additional navigation items for the train, in the form of Back and Next buttons. The third example in the slide shows what a rendered af:trainButtonBar component could look like. The Back and Next buttons provided by af:trainButtonBar enable users to navigate only to the next or previous train stop from the current stop. You can also use the af:trainButtonBar component without af:train.

The train and train button bar work by having the value attribute bound to a train model of type org.apache.myfaces.trinidad.model.MenuModel. The train menu model contains the information needed to:

Control a specific train behavior (that is, how the train advances users through the train stops to complete the multistep process)

Dynamically generate the train stops, including the train stop labels, and the status of each stop (that is, whether a stop is currently selected, visited, unvisited, or disabled).