In Oracle JDeveloper 11g R1, you set the display name of a train
stop of an ADF bounded task flow train model by using the Oracle JDeveloper
To do so
Following the steps outlined above, you can define static display
names – like "PF1" for page fragment 1 shown in the image below - for
train stops to show at runtime.
In the following, I explain how you can change the static
display string to a dynamic string that reads the display label from a resource
bundle so train stop labels can be internationalized.
There are different strategies available for managing
message bundles within an Oracle JDeveloper project. In this blog entry, I decided
to build and configure the default properties file as indicated by the projects
properties. To learn about the suggested file name and location, open the JDeveloper project properties (use a right mouse click on
the project node in the Application Navigator and choose Project Properties.
Select the Resource
Bundle node to see the suggested name and location for the default message
bundle. Note that this is the resource bundle that Oracle JDeveloper
would automatically create when you assign a text resource to an ADF Faces component
in a page.
For the train stop display name, we need to create the
message bundle manually as there is no context menu help available in Oracle JDeveloper. For this, use a right mouse click on the JDeveloper project
and choose New |
General | File from the menu
and in the opened dialog.
Specify the message bundle file name as the name looked up
before in the project properties Resource
Bundle option. Also, ensure that the file is saved in a directory structure that matches the package structure shown in the Resource
Bundle dialog. For example, you would save the properties file in the View
Project's src >
adf > sample directory if the package structure was "adf.sample" (adf.sample.ViewControllerBundle).
Edit the properties file and define key – values pairs for
the train stop component. In the sample, such key value pairs are
TrainStop1=Train Stop 1
TrainStop2=Train Stop 2
TrainStop3=Train Stop 3
Next, double click the faces-config.xml
file and switch the opened editor to the Overview
tab. Select the Application category
and press the green plus icon next to the Resource
Define the resource bundle Base Name as the package and properties file name, for example
Finally, define a variable name for the message bundle so
the bundle can be accessed from Expression Language. For this blog example, the name
is chosen as "messageBundle".
Next, select the display-name
element in the train stop node (similar to when creating the display name) and
use the Property Inspector to change the static display string to an EL expression
referencing the message bundle. For example:
At runtime, the train stops
now show display names read from a message bundle (the properties file).