05 – TaskFlow – Reusable part of ViewController

This time you will see how to create a reusable part of the oracle ADF framework called taskFlow. In my opinion taskFlows is an one of the most powerful Oracle ADF features. It allows you to isolate a flow and reuse it in the another context. TaskFlow contains input and output parameters, java beans, pages and other activities. It behaves like a function, but in the sense of flow. The result of this tutorial is an application with screen devided into two sections. Each section contains instance of the same taskFlow called region, but instantiated different input parameter value.

Requirements

  • Prepare simple application. Add panel header with panel grid layout (two columns, one row) into the main page.
  • For idlers: download tutorial laboratory T05ReusableTaskFlow and open base project.

Main page should looks like:

22:40:26_001

Creating reusable TaskFlow

There are two main types of TaskFlows:

  • Unbounded TaskFlow – there is only one unbouded TaskFlow in application (This is not entirely true, but more on that later). It is ADF an application controller entry point: adfc-config.xml.
  • Bounded TaskFlow – there might be many bouded TaskFlows in application and can be devided into two main groups:
    • with pages – can be used to work with pages, dialogs or as subflow of the Unblunded TaskFlow.
    • with page fragments – can be used as region in page or page fragment. Other use case is a subflow of the another Bounded TaskFlow.

It’s time to create reusable TaskFlow. Right click on the ViewController project then “New->ADF Task Flow”. Enter the name, select “Create with Page Fragments” and click OK.

Open the created TaskFlow and add some view.

TaskFlow input parameters

To add TaskFlow input parameters open reusableTF (1), select Overview tab (2), open Parameters tab (3), click Add(4). Then enter the parameter name (5) and class name (6). In this case select that the parameter is required (7). Remember or copy Value field (8).

b217_001

The next step is to use the inputTitle parameter on reusableView page. In this tutorial we display inputTitle as title of a panelHeader and text “I am:” concatenated with inputTitle parameter as outputText inside the panelHeader.

Go reusableView.jsff, drag panelHeader (1) and drop it on the page. Click icon on the right of the “Text” property (2). From editor choose inputTitle (3) and click OK (4). You can paste ExpressionLanguage (“#{pageFlowScope.inputTitle}” – EL) directly into the “Text” property.

8499_001

Add outputText into panelHeader (1) and enter EL “I am: #{pageFlowScope.inputTitle}” into “Value” property.

e023_001

Reusable TaskFlow is ready.

Placing TaskFlow as region

Open mainTestPage.jsf. To use reusableTF TaskFlow just drag reusableTF.xml (1) and drop into the first cell of the the panelGridLayout (2). From menu choose “Region” (3) and enter “Left panel” as inputTitle parameter value (4). Click OK (5). Do the same for the second cell using “Right panel” as inputTitle.

If you had a problem to create second region, just add for example a button into second cell in Structure Window, then add region and remove unused button.

Running the application

Select ViewController project and click Run form top menu.

A the first time JDeveloper asks you which of  views is the application entry point. Click Browse and select mainTestPage.jsff. After few seconds you will see the tutorial result.

 

 

Facebooktwittergoogle_plusredditlinkedinmail

Leave a Reply