ADF Region Interaction: External Train Navigation

Similar documents
ADF Code Corner. 97. How-to defer train-stop navigation for custom form validation or other developer interaction. Abstract: twitter.

Mastering Oracle ADF Task Flows. Frank Nimphius Principal Product Manager Oracle JDeveloper / ADF

ADF Code Corner How-to bind custom declarative components to ADF. Abstract: twitter.com/adfcodecorner

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

ADF Code Corner How-to launch a popup upon rendering of a page fragment in a region using JSF 2. Abstract: twitter.

ADF Mobile Code Corner

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

ADF Mobile Code Corner

ADF Code Corner How to cancel an edit form, undoing changes with ADFm savepoints

ADF Code Corner. 048-How-to build XML Menu Model based site menus and how to protect them with ADF Security and JAAS. Abstract:

Oracle Fusion Middleware 11g: Build Applications with ADF I

ADF Code Corner. 71. How-to integrate Java Applets with Oracle ADF Faces. Abstract: twitter.com/adfcodecorner

Functional. Pattern Embeding Regions inside PopUp Windows

ADF Code Corner How-to declaratively build a master-detail behavior with DVT components. Abstract: twitter.com/adfcodecorner

Oracle Fusion Middleware 11g: Build Applications with ADF I

ADF Code Corner. 90. Filtering ADF bound lists. Abstract: twitter.com/adfcodecorner

ADF Mobile Code Corner

ADF Code Corner. Oracle JDeveloper OTN Harvest 04 / Abstract: twitter.com/adfcodecorner

Oracle Middleware 12c: Build Rich Client Applications with ADF Ed 1 LVC

ADF Code Corner How-to build a reusable toolbar with Oracle ADF Declarative Components. Abstract: twitter.com/adfcodecorner

ADF Hands-On. Understanding Task Flow Activities / 2011 ADF Internal Enterprise 2.0 Training. Abstract:

ADF Code Corner. Oracle JDeveloper OTN Harvest 01 / Abstract: twitter.com/adfcodecorner

ADF Code Corner Implementing auto suggest functionality in ADF Faces. Abstract:

Oracle Fusion Middleware 11g: Build Applications with ADF Accel

ADF Code Corner. Oracle JDeveloper OTN Harvest 02 / Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to enforce LOV Query Filtering. Abstract: twitter.com/adfcodecorner

ADF Code Corner. 64. How-to implement a Select Many Shuttle with pre- selected values. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to use the af:autosuggestbehavior component tag with ADF bound data sources. Abstract: twitter.

ADF Code Corner How-to show a glasspane and splash screen for long running queries. Abstract: twitter.com/adfcodecorner

Oracle Retail Accelerators for WebLogic Server 11g

ADF Code Corner How-to further filter detail queries based on a condition in the parent view using ADF BC. Abstract: twitter.

ADF Code Corner. 70. How-to build dependent list boxes with Web Services Business Services. Abstract: twitter.com/adfcodecorner

ADF Code Corner. 65. Active Data Service Sample Twitter Client. Abstract: twitter.com/adfcodecorner

JSF Navigation.!! DevelopIntelligence

Oracle JDeveloper/Oracle ADF 11g Production Project Experience

ADF Code Corner. Oracle JDeveloper OTN Harvest 10 / Abstract: twitter.com/adfcodecorner

Building User Interface for Android Mobile Applications II

ADF Code Corner How-to use Captcha with ADF Faces and Oracle ADF. Abstract: twitter.com/adfcodecorner

ADF Code Corner. 016-How-to customize the ADF Faces Table Filter. Abstract: twitter.com/adfcodecorner

ADF Code Corner How-to restrict the list of values retrieved by a model driven LOV. Abstract: twitter.com/adfcodecorner

Oracle Developer Day

ADF Mobile Code Corner

ADF Code Corner. Oracle JDeveloper OTN Harvest 09 / Abstract: twitter.com/adfcodecorner

Oracle Application Development Framework Overview

AuraPlayer Server Manager User Guide

ADF OAF Who Cares? You Do! Oracle Applications Framework / Application Development Framework - Which way do I go?

Oracle Digital Assistant: Strategies for Escaping the Validation Loop

JUnit Test Patterns in Rational XDE

A Closer Look at XPages in IBM Lotus Domino Designer 8.5 Ray Chan Advisory I/T Specialist Lotus, IBM Software Group

Overview. Principal Product Manager Oracle JDeveloper & Oracle ADF

SETTING UP SALESFORCE KNOWLEDGE

Template Designer: Create Automatic PDF Documents for Attachment or Print Purpose

Java EE 6: Develop Web Applications with JSF

A Guide to CMS Functions

Oracle Fusion Middleware

Oracle ADF: The technology behind project fusion. Lynn Munsinger Principal Product Manager Application Development Tools Oracle Corporation

NetAdvantage for ASP.NET Release Notes

The Extensible Markup Language (XML) and Java technology are natural partners in helping developers exchange data and programs across the Internet.

<Insert Picture Here> Advanced ADF Faces. Frank Nimphius Principal Product Manager

What's New in Sitecore CMS 6.4

Building Web Sites Using the EPiServer Content Framework

Rich Web UI made simple Building Data Dashboards without Code

Creating your first JavaServer Faces Web application

Common Navigator Framework

CWCM Webmaster Training. Denis Bacquelaine, Technical Consultant I.R.I.S. Solutions & Experts S.A.

Oracle Developer Day

User Defined Types. Babes-Bolyai University Lecture 06. Lect Phd. Arthur Molnar. User defined types. Python scope and namespace

Oracle WebCenter Suite Integrating Secure Enterprise Search

Real Life ADF Mobile. 10 things that you don't get from the developer guide

Web Dynpro Java for Newbies: a Quick Guide to Develop Your First Application

ADF Code Corner. Oracle JDeveloper OTN Harvest 12 / Abstract: twitter.com/adfcodecorner

Oracle Developer Day

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

5.1 Registration and Configuration

Take Your Oracle Forms on the Road Using ADF Mobile. Mia Urman, OraPlayer & Denis Tyrell, Oracle Corporation

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:

Proposed User Experience for Handling Multiple Identity Providers in Network Identity Manager 2.0

Just Get it Written: Deploying Applications to WebLogic Server Using JDeveloper and WLS Console. Don t get it right, just get it written.

Lyudmil Pelov, A-Team, Oracle December Development Lifecycle for Task Flows in Oracle WebCenter Portal 11gR1 version

Styles, Themes, and Material Design

User Guide Using AuraPlayer

Oracle 1Z Oracle Application Development Framework 12c Essentials. Download Full Version :

CS142 Winter 2017 Midterm Grading Solutions and Rubric

6/13/2012. Sneak Preview: Oracle JDeveloper 12c New Features. Frank Nimphius Senior Principal Product Manager Oracle Development Tools

Ignite UI Release Notes

1Z0-430

Chapter 2 FEATURES AND FACILITIES. SYS-ED/ Computer Education Techniques, Inc.

Lesson: Web Programming(6) Omid Jafarinezhad Sharif University of Technology

Oracle Education Partner, Oracle Testing Center Oracle Consultants

VisAssist Web Navigator

ZERORISK Portal Access

Exam Questions 1Z0-419

Vue.js Framework. Internet Engineering. Spring Pooya Parsa Professor: Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

Advanced Input Help - The Object Value Selector (OVS)

1z0-554qa88. Number: Passing Score: 800 Time Limit: 120 min File Version: 1.0. Oracle 1z0-554

Oracle Applications OAF, MSCA, MA and ADF. May 06, 2011

Oracle Cloud Developing Applications with Oracle Visual Builder

Oracle Reports Developer 10g: Build Reports

directive attribute1= value1 attribute2= value2... attributen= valuen %>

How to Use Context Menus in a Web Dynpro for Java Application

Transcription:

ADF Region Interaction: External Train Navigation Abstract twitter.com/adfarchsquare The ADF bounded task flow train model is an alternative to control flow cases for users to navigate views in bounded task flows. Bounded task flows are specifically designed to have one entry point, and as a result represent isolated and encapsulated units of work. For example the train model contained within a bounded task flow is not directly accessible from the outside, it can only be accessed via the single entry point of the bounded task flow. A frequent requirement for bounded task flows exposed in ADF regions though is to allow the parent view or a contained child region to navigate the bounded task flow using the train model. This article explains a pattern that allows you to navigate bounded task flow trains from outside of the task flow. Author: Date: Frank Nimphius 30/SEP/2012 1

Introduction A bounded task flow can be configured to expose a train model to navigate from one view to another, just by setting the task flow s Train property. In the view activities of the task flow, you use the Oracle ADF Faces af:train and af:trainbuttonbar components to render the train model in the UI. The view activities itself must have its Train Stop property set to true to become a stop in the train model. At runtime users navigate to a view represented by a train stop by clicking on the representative train stop icon. Alternatively, developers can choose to programmatically navigate a train model in response to a user action for example. This article focuses on a special use case of programmatic navigation, that is to make a bounded task flow train model contained within a region navigate by an external programmatic call. The technique explained in this article is non intrusive in that it does not break the encapsultaion of the bounded task flow. Instead you expose a custom API for the parent view or a contained child task flow to use for navigating the bounded task flow. Because the pattern is generic and does not maintain any dependencies to the bounded task flow it is implemented in, it s a good candidate to put into a bounded task flow template for reuse in multiple task flows. Note: Working with the train model doesn't require a train component to be added to a view. If programmatic train navigation is sufficient then no UI (af:train, af:trainbuttonbar) needs to be provided for the train model in a view. Pattern Configuration and Implementation The core implementation code of the External Train Navigation pattern for region interaction mainly exists within the bounded task flow to navigate. The implementation on the parent view and child region, also explained in the following document, purely shows how to work with the exposed train navigation API. External Task Flow Navigation Pattern: Bounded Task Flow Implementation Beside the train model configuration which is out of scope for this article the bounded task flow you want to navigate from an external needs to be configured with two method activities associated with a wildcard navigation control flow as shown in figure 1. 2

Figure 1: Bounded task flow with method activities Figure 1 shows the two method activities above the three views to navigate. The control flow names in this example are somewhat cryptic within underscores (" trainnavprevstop " and " trainnavnextstop ") but help to avoid control flow naming conflicts in case you implement this solution in a bounded task flow template for reuse. To externally trigger navigation in the bounded task flow, you queue the control flow case of one of the method activities, " trainnavprevstop " or " trainnavnextstop ", on the parent view or the child region. Shown in figure 2, the method activities associated with the control flows reference a managed bean method. The managed bean must be configured in the same bounded task flow (or the bounded task flow template) that contains the method activities and should have backing bean scope. Figure 2: Method activities are configured to access managed bean methods in task flow Figure 3, shows the configuration of one of the method activities. In this sample, the Method property references the "ontaskflownavprev" method of the managed bean, to look up the current train model state to determine the next enabled train stop. As train navigation is based on implicit created control flow cases, if such a control flow case name is returned from a method activity, navigation will happen to the target view. 3

Figure 3: Method activity configuration Node the setting of the tostring()propery of the method activity in figure 3. For a method activity to perform navigation you either need to define a value for the Fixed Outcome property or set the tostring()to true. If you don't set one of these, or both, you create invalid XML and the task flow cannot be run. Setting trostring() to true will convert the return value of the method call into a string and use this for navigation. This is the setting needed for the pattern explained in this document. The sample code below demonstrates for the managed bean of the bounded task flow how to programmatically navigate the train. One method performs the train forward navigation, while the other handles the back navigation. Before navigating to a next or previous stop, a check is performed to determine if the target node is enabled or disabled (controlled by the view activity skip property). If so then the next stop is tried for navigation. Disclaimer: The code uses TrainStopModel, which is an internal framework class that should not be used in custom applications. A bug is filed to make this class public so it can be used with no precaution. Until this public class is implemented it is easiest to go with the internal class instead of working around the missing functionality. /** * Method navigates to the next enabled train stop if any. * @return implicit outcome of the train stop */ public String ontaskflownavnext() { String nextstopaction = null; ControllerContext controlctxt = ControllerContext.getInstance(); ViewPortContext viewportctxt = controlctxt.getcurrentviewport(); TaskFlowContext taskflowctxt = viewportctxt.gettaskflowcontext(); TaskFlowTrainModel trainmodel = taskflowctxt.gettaskflowtrainmodel(); TaskFlowTrainStopModel currentstop = trainmodel.getcurrentstop(); TrainStopModel nextstop = (TrainStopModel)trainModel.getNextStop(currentStop); while (nextstop!= null) { if (nextstop.isenabled()) { nextstopaction = nextstop.getoutcome(); break; 4

nextstop = (TrainStopModel)trainModel.getNextStop(nextStop); return nextstopaction; /** * Method navigates to the previous enabled train stop if any. * @return implicit outcome of the train stop */ public String ontaskflownavprev() { String prevstopaction = null; ControllerContext controlctxt = ControllerContext.getInstance(); ViewPortContext viewportctxt = controlctxt.getcurrentviewport(); TaskFlowContext taskflowctxt = viewportctxt.gettaskflowcontext(); TaskFlowTrainModel trainmodel = taskflowctxt.gettaskflowtrainmodel(); TaskFlowTrainStopModel currentstop = trainmodel.getcurrentstop(); TrainStopModel prevstop = (TrainStopModel)trainModel.getPreviousStop(currentStop); while (prevstop!= null) { if (prevstop.isenabled()) { prevstopaction = prevstop.getoutcome(); break; prevstop = (TrainStopModel)trainModel.getPreviousStop(prevStop); return prevstopaction; To summarize the work you need to complete in the bounded task flow is: 1. Optional, but recommended, create a bounded task flow template to create a reusable implementation of this technique 2. Enable the train model on the bounded task flow 3. Configure views as train stops, which is automatic for all views created after enabling the train model for a bounded task flow 4. Create two wild card navigation cases to method activities 5. Create a managed bean with the code shown above or a custom version of it 6. Document the names of the wildcard flows for developers who want to use this API Configuration: Parent View That Triggers Navigation Indicated in figure 4, the af:region tag in the parent view that exposes the bounded task flow is represented by an instance of RichRegion at runtime. 5

The RichRegion class has a public method queueactioneventinregion that you use to invoke a control flow case on the bounded task flow. To navigate the train model you need to queue an action for either the " trainnavprevstop " or " trainnavnextstop " control flow cases. Remember that the two control flow cases navigate to a method activity in the bounded task flow to determine the next navigation target. If a valid target is found, navigation occurs. Figure 4: location of RichRegion queueactioneventinregion method To achieve this use the following code in a managed bean and reference it from command buttons for forward or backward navigation of the bounded task flow train model. Note that in the sample code, the reference to the af:region instance is created through the af:region Binding property. // Method to reference from a command item for next navigation public String onnavnext() { queueactionevent(" trainnavnextstop "); return null; // Method to reference from a command item for backward navigation public String onnavprev() { queueactionevent(" trainnavprevstop "); return null; 6

// Nethod to queue navigation on the region private void queueactionevent(string action) { FacesContext fctx = FacesContext.getCurrentInstance(); ExpressionFactory ef = fctx.getapplication().getexpressionfactory(); ELContext ectx = fctx.getelcontext(); MethodExpression me = ef.createmethodexpression(ectx, action, String.class, new Class[] { ); regioncontainer.queueactioneventinregion(me, null, null, false, -1, -1, PhaseId.INVOKE_APPLICATION); // Setter/getter methods created by JDeveloper when creating the // af:region Binding reference public void setregioncontainer(richregion regioncontainer) { this.regioncontainer = regioncontainer; public RichRegion getregioncontainer() { return regioncontainer; Note: if you perform train navigation from command button or link, ensure partialsubmit property is set to true to avoid a full page refresh To summarize the work you need to complete in the parent view to trigger train navigation in the bounded task flow is: 1. Create command items for forward or backward train navigation 2. Create a managed bean in the parent view task flow and create two action methods and one binding reference to the af:region 3. Call queueactioneventinregion on the af:region reference, passing the control flow case names for the method activities in the bounded task flow to navigate the train Configuration: Child Region That Triggers Navigation To navigate a bounded task flow from a child region contained with the bounded task flow, you use the ADF task flow parent action activity you find in the JDeveloper component palette for the task flow diagrammer. The parent action takes a control flow name " trainnavprevstop " or " trainnavnextstop " in this example and invokes it on either the parent region, or the root region. Figure 5 shows the use case: View 2 contains a child region, from where you want to navigate to either View 1 or View 2 in the parent task flow. 7

Figure 5: Bounded task flow with a view containing a child region The bounded task flow in the child region has two parent actions defined, one for backward and one for forward navigation of the parent task flow train model. The parent action is navigated to from command items, like buttons, menus or a link. The use of a wild card navigation as shown in figure 5 is optional and allows any view in a child task flow to navigate the parent flow. Figure 6: Parent action configuration The parent action has its Parent Outcome property configured with the name of a wild card control flow in the parent bounded task flow. The Root Outcome property can be used to navigate the top level task flow, which is the browser view. The Outcome property defines a possible callback if parent navigation fails. In the example, nothing should happen in this case. 8

Figure 7: Parent action in action Figure 7 shows how the child region call to the parent task flow works to trigger train navigation. Each parent activity in the child region references a control flow case leading to a method activity in the parent task flow to perform train navigation. Because the method activities execute within the parent task flow, the train model navigation command is executed in the right context. To summarize the work you need to complete 1. Add parent activity elements to be child task flow that should trigger train model navigation on the parent task flow 2. Configure the Parent Outcome property to point to a control flow case that exists in the parent task flow. The parent task flow control flow case should then navigate to a method call activity that navigates the train model 3. Define a value for the Outcome property so that navigation finds a fallback navigation within the child region in case parent navigation fails (which would indicate a design time issue in setting up the Parent Outcome property) Summary This article outlines two related techniques to navigate bounded task flows exposed in a region from either the parent view or a child region. Both techniques use the same managed bean code within the navigated task flow. The API that is created for consumers of such an implementation is the name of a control flow case. 9

RELATED DOCOMENTATION Oracle product documentation about trains http://docs.oracle.com/cd/e23943_01/web.1111/b31974/taskflows_complex.htm#cjhfbfie af:train tag documentation http://docs.oracle.com/cd/e23943_01/apirefs.1111/e12419/tagdoc/af_train.html All aboard Oracle Magazine article about train navigation http://www.oracle.com/technetwork/issue-archive/2011/11-sep/o51adf-452576.html How to programmatically navigate train models Put a different look to your train stops http://www.oracle.com/technetwork/developer-tools/adf/learnmore/82-programmaticallynavigate-trains-396873.pdf http://www.oracle.com/technetwork/developer-tools/adf/learnmore/93-differentuifortrainstops- 1413952.pdf Dynamically enabling or disabling train stops http://www.oracle.com/technetwork/developer-tools/adf/learnmore/80-dyn-sequential-configtrain-387002.pdf 10