What You May Need to Know About Removing Navigation Tabs

18-40 Web User Interface Developers Guide for Oracle Application Development Framework Figure 18–14 Navigation Buttons Rendered by a trainButtonBar Component Both train components 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. Briefly, a menu model for the train is implemented by extending the MenuModel abstract class, which in turn extends the TreeModel class for more information, see Chapter 10, Using Tables and Trees . A MenuModel object represents the menu structure of a page or application or could represent the hierarchy of pages and stops involved in a flow. Because an instance of a MenuModel class is a special kind of a TreeModel object, the nodes in the TreeModel object can represent the stops of a train. The node instance that represents a train stop within the train component can be of type TrainStopModel, or it can be any object as long as it provides the same EL structure as a TrainStopModel object. However, the TrainStopModel class exposes methods to retrieve the outcome, as well as the label of a stop and its immediate, disabled, and visited attribute states. The MenuModel class can also indicate where in the tree the current train stop page is focused. The getFocusRowKey method in the MenuModel class returns the rowKey object of the focus page for the current viewId. The menu model implementation for the train must also have a specific train behavior, which you can create by extending the org.apache.myfaces.trinidad.model.ProcessMenuModel class. The train behavior controls what stops along the train users can visit while visiting at a current train stop. To create a train stop model, you can either extend the TrainStopModel abstract class and implement the abstract methods, or you can create your own class with the same method signatures. Your class must return a rowData object. Binding a train component to a train menu model is similar to binding a navigationPane component to an XMLMenuModel class described in Section 18.6.3, How to Bind to the XMLMenuModel in the JSF Page . However, as long as your TrainStopModel implementation returns a rowData object, you do not need to Note: In an application that uses the ADF Model layer and ADF Controller, this navigation and display is set up and handled in a different manner. For more information, see the Creating a Train section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. Working with Navigation Components 18-41 provide the commandNavigationItem components for each stop. At runtime ADF Faces dynamically creates the nodeStamp facet and commandNavigationItem component, and automatically binds the methods in the train stop model to the appropriate properties on the commandNavigationItem component. Example 18–20 shows the simplified binding for a train. Example 18–20 Simplified Train Model Binding af:train value={simpleTrainModel} The MenuModel implementation of your train model must provide specific train behavior. Train behavior defines how you want to control the pages users can access based on the page they are currently visiting. ADF Faces supports two train behaviors: Plus One and Max Visited. Suppose there are 5 pages or stops in a train, and the user has navigated from page 1 to page 4 sequentially. At page 4 the user jumps back to page 2. Where the user can go next depends on which train behavior is used in the train model. In Max Visited, from the current page 2 the user can go back to page 1, go ahead to page 3, or jump ahead to page 4. That is, Max Visited allows the user to return to a previous page or advance to any page up to the farthest page already visited. The user cannot jump ahead to page 5 from page 2 because page 5 has not yet been visited. Given the same situation, in the Plus One behavior the user can only go ahead to page 3 or go back to page 1. That is, Plus One allows the user to return to a previous page or advance one more stop further than the current stop. The user cannot jump ahead to page 4 even though page 4 has already been visited. To define and use a train for all pages in a multistep process: ■ Create a JSF navigation rule and the navigation cases for the train. Creating a navigation rule and its navigation cases for a train is similar to Section 18.7.1, How to Create a Simple Page Hierarchy , where you create one global navigation rule that has the navigation cases for all the train stops in the train. ■ Create a train model that implements a specific train behavior and provides the train stop items for stamping. This includes creating a train stop model class and a menu model class. See Section 18.8.1, How to Create the Train Model . ■ Configure managed beans for the train model. See Section 18.8.2, How to Configure Managed Beans for the Train Model . Tip: If you need to collate information for the train stops from various places, then you will need to manually create the nodeStamp facet and the individual commandNavigationItem components that represent the train stops. For more information, see Section 18.8.3, How to Bind to the Train Model in JSF Pages . Note: You may want to set the value of the redirect element to true for each navigation case that you define within the JSF navigation rule if each train stop is an individual page and you want the client browser’s URL to reference each new page. If you enable partial page rendering, the displayed URL may be different. For more information about the redirect element, see the JavaServer Faces specification. For more information about partial page rendering, see Chapter 7, Rerendering Partial Page Content .