you must change the train component tag,
as shown in Listing 2.
In this changed tag configuration,
af:commandNavigationItem is added to the
nodeStamp facet to replace the default train
stop renderer. The EL trainNode variable is
defined on the var attribute of af:train to
access the train stop properties defined in
the train model.
Note that the trainNode variable is
also accessible from a managed bean
(MBean) during train rendering. An
example that uses this option to set the
af:commandNavigationItem component’s
immediate property is explained in the
“Enabling Backward Navigation” section
later in this column.
directly to a page. To set it for a template,
open the Property Inspector for the selected
train component and click the arrow icon
next to the value property. Then choose the
Expression Builder menu option to declaratively compose the expression
#{ controllerContext.currentViewPort
. taskFlowContext.trainModel}
Figure 4: Display name configuration for a train stop
in the Structure window
support translated labels for internationalized applications.
2. The trainButtonBar component renders
the train model with buttons for forward
and backward navigation. Navigation
with trainButtonBar is strictly sequential
and does not skip over disabled train
stops. If a train stop is configured with
the Skip property set to true, the
trainButtonBar will stop there.
The Oracle ADF Faces train and
trainButtonBar components are located in
the Oracle JDeveloper Component Palette
window under ADF Faces -> Common
Components. When you drag either component to a page or a page fragment in a
bounded task flow whose Train property is
set to true, Oracle JDeveloper automatically
sets the component’s value property, as
shown in Listing 1, for each component.
The EL string within each of these component tags references the train model of
the active bounded task flow to determine
the current stop in the navigation sequence.
By doing so, it also determines the preceding
and next stops in a sequential train.
ENABLING REUSE VIA A PAGE TEMPLATE
As you know from the preceding section, the
af: train and af:trainButtonBar components
reference the bounded task flow train model
by using the generic expression
The sample application uses a page
template, PageFragment Template.jspx,
to add the train definition to all views in
the bounded task flows. In the Application
Navigator, the template is under the
ViewController project, in the templates
folder inside the Web Content folder. When
you reference an MBean from the train com-
ponent configuration, as the sample applica-
tion does, make sure the MBean is configured
with the same name in all bounded task
flows that use the page template.
#{ controllerContext.currentViewPort
. taskFlowContext.trainModel}
Because this string does not include the
task flow name, train configuration is a good
candidate for use in page templates.
However, when you add a train component to a template, the value property is not
automatically set, as it is when you add it
INCLUDING METHOD CALL AC TIVITIES IN
TRAIN NAVIGATION
Train navigation occurs among view and
task flow call activities, but in some use
cases, you might also want to call a method
as part of the navigation. To include method
call activities in train navigation, you set the
train stop’s Outcome property to reference a
wildcard control flow case.
As you can see in Figure 2, the
Code Listing 1: Automatic default settings for train components
<af:train id="t2"
value="#{ controllerContext.currentViewPort.taskFlowContext.trainModel}"/>
<af:trainButtonBar id="tbb1"
value="#{ controllerContext.currentViewPort.taskFlowContext.trainModel}"/>
Code Listing 2: Changing the settings of a train component
CUS TOMIZING THE TRAIN USER
INTERFACE
To customize the train stop behavior—for
example, to add an action listener to a train
stop, to mark a train stop as required, or to
use your own custom icons for train stops—
<af:train id="t1" var="trainNode"
value="#{ controllerContext.currentViewPort.taskFlowContext.trainModel}">
<f:facet name="nodeStamp">
<af:commandNavigationItem text="#{trainNode.textAndAccessKey}"
id="cni1" visited="#{ trainNode.visited}"
disabled="#{trainNode.disabled}"
action="#{ trainNode.action}"
immediate="false"
actionListener="…"/>
</f:facet>
</af:train>