Sie sind auf Seite 1von 33

Planning the User Interface

Copyright 2008, Oracle. All rights reserved.


Objectives

After completing this lesson, you should be able to do the


following:
Describe the Model-View-Controller design pattern
Explain the role of the ADF Controller
Differentiate between bounded and unbounded task flows
Create task flows
Define control flows
Define global navigation
Create routers for conditional navigation
Call methods and other task flows
Convert task flows
Use validation in the user interface

13 - 2 Copyright 2008, Oracle. All rights reserved.


Describing the Model-View-Controller (MVC)
Design Pattern

Rich Clients Web and Mobile View

Controller Controller

Model Model

Business
Business Services Services

13 - 3 Copyright 2008, Oracle. All rights reserved.


Implementing MVC with the ADF Framework
Desktop Browser-based
View
ADF Swing Office JSP JSF ADF Faces / DVT

Controller
Struts JSF/ADF Task Flow

Model
ADF
ADFBindings
Bindings

Java EJB BAM BPEL Web ADFbc BI Essbase Portlets Business


Services Services
TopLink

Data
Services
Relational Data XML Data Legacy Data Packaged Apps

13 - 4 Copyright 2008, Oracle. All rights reserved.


Technology Choices for Fusion Applications
Desktop Browser-based
View
ADF Swing Office JSP JSF ADF Faces / DVT
Metadata Services (MDS)

Controller
Struts JSF/ADF Task Flow

Model
ADF Bindings

Java EJB BAM BPEL Web ADFbc BI Essbase Portlets Business


Services Services
TopLink

Data
Services
Relational Data XML Data Legacy Data Packaged Apps

13 - 5 Copyright 2008, Oracle. All rights reserved.


Characteristics of ADF Task Flows

ADF task flows are logical units of page flows that:


Offer advantages over JSF page flows:
Application can be broken into series of tasks
Can contain nodes other than pages
Can navigate between activities other than pages
Reusable
Shared memory scope
Can be either unbounded or bounded

13 - 6 Copyright 2008, Oracle. All rights reserved.


Characteristics of Unbounded ADF Task Flows

Unbounded ADF task flows often serve as the entry point to an


application, and have the following characteristics:
First entry on task flow stackthe outermost task flow
No well-defined boundary or single point of entry: use an
unbounded task flow if your application has multiple points
of entry
Can be used to define the top level flow of an application
Bookmarkable pages

13 - 7 Copyright 2008, Oracle. All rights reserved.


Working with Unbounded Task Flows

Unbounded task flow source file is adfcconfig.xml.


Editor contains four tabs to show different views:
Diagram
Source
Overview
History

You can easily test task flow functionality in the unbounded


task flow, and convert to bounded when functioning
correctly.

13 - 8 Copyright 2008, Oracle. All rights reserved.


Characteristics of Bounded Task Flows

Bounded task flows:


Are modular blocks of task flow functionality for reuse, with the following
characteristics:
Single point of entry Ability to accept input parameters and
to return values
Well-defined boundary
On-demand metadata loading
pageFlow Memory scope
Fragment reuse through task flow
Declarative transaction templates
management Addressable
Declarative Back button support
Consist of:
Activities
View
Router
Control flows between activities

13 - 9 Copyright 2008, Oracle. All rights reserved.


Comparing Unbounded
and Bounded Task Flows
Unbounded: Bounded:

First entry on task flow stack Added to task flow stack when called

No well-defined boundary or single point of entry Single point of entry, with zero or more exit
points

Cannot be used as a region on a page Use as region on page with page fragments

Does not accept parameters Can accept parameters and return values

Not securable on its own; uses page security Can be secured separately from pages

Cannot manage transactions or save for later Declarative transaction


management, save for later

Cannot be called Must be called to be invoked

Can be bookmarked Not bookmarkable

13 - 11 Copyright 2008, Oracle. All rights reserved.


Example: Bounded and Unbounded
ADF Task Flows
The unbounded task
flow for a shopping
application

The bounded CheckoutFlow


task flow

13 - 12 Copyright 2008, Oracle. All rights reserved.


Creating an Unbounded Task Flow

You can create an unbounded task flow by:


Adding task flow components to adfc-config.xml
Using the New Gallery
Converting a bounded task flow

13 - 13 Copyright 2008, Oracle. All rights reserved.


Creating a Bounded Task Flow

You can create a bounded task flow by doing one of the


following:
1. Using the New Gallery
OR
2
2. Extracting part of an
existing task flow
1

13 - 14 Copyright 2008, Oracle. All rights reserved.


Converting Task Flows

You can convert task flows:


Unbounded to bounded Bounded to unbounded

13 - 15 Copyright 2008, Oracle. All rights reserved.


Using a Bounded Task Flow

Using a bounded task


flow in a region on a
page

13 - 16 Copyright 2008, Oracle. All rights reserved.


Using ADF Task Flow Components

1 2 3

13 - 17 Copyright 2008, Oracle. All rights reserved.


Defining ADF Control Flow Rules

ADF control flow rules:


Define flow through activities, such as views (pages)
Are stored in task flow configuration files
Can be defined by using:
The visual editor (Navigation Modeler)
The .xml console (Configuration Editor)
The .xml file directly
The Structure window
Are invoked by:
Command components (button, link)
Tabs or breadcrumbs
Trains

13 - 20 Copyright 2008, Oracle. All rights reserved.


Example of ADF Control Flow Rules

<af:commandButton
text="Show Items"
action="showDetail"/>

browseOrders Page:

<af:commandButton
text= "Return to Orders"
action="showOrders"/>

orderDetail Page:

13 - 21 Copyright 2008, Oracle. All rights reserved.


Using the Navigation Modeler
to Define Control Flow

4
2 3

13 - 22 Copyright 2008, Oracle. All rights reserved.


Using the Configuration Editor
to Define Control Flow

Use from-action
to define dynamic
control flow.

13 - 23 Copyright 2008, Oracle. All rights reserved.


Editing the.xml File to Define Control Flow

Source code editor shows errors:

...
<control-flow-rule>
<from-activity-id>browseOrders</from-activity-id>
<control-flow-case>
<from-outcome>showDetail</from-outcome>
<to-activity-id>orderDetail</to-activity-id>
</control-flow-case>
</control-flow-rule>
<control-flow-rule>
<from-activity-id>orderDetail</from-activity-id>
<control-flow-case>
<from-outcome>showOrders</from-outcome>
<to-activity-id>browseOrders</to-activity-id>
</control-flow-case>
</control-flow-rule>
...

13 - 24 Copyright 2008, Oracle. All rights reserved.


Using the Structure Window
to Modify a Task Flow
Freeze /
Unfreeze New
View View

13 - 25 Copyright 2008, Oracle. All rights reserved.


Using Wildcards to Define Global Navigation

To define a global (for all pages) control flow rule, drag a


wildcard control flow rule to the page:

13 - 26 Copyright 2008, Oracle. All rights reserved.


Using Routers for Conditional Navigation

Router activities:
Use expressions
that evaluate to
true or false
Define
from-outcomes
based on the
value of the expression

13 - 28 Copyright 2008, Oracle. All rights reserved.


Defining Router Activities

13 - 29 Copyright 2008, Oracle. All rights reserved.


Calling Methods and Other Task Flows

Task flow call

Method call

13 - 30 Copyright 2008, Oracle. All rights reserved.


Defining a Task Flow Return Activity

When you return from a called task flow, the task flow return
activity specifies the outcome that is returned to the caller.

Calling task flow Task flow return activity


of called task flow

13 - 31 Copyright 2008, Oracle. All rights reserved.


Making View Activities Bookmarkable
(or Redirecting)

Saving a view activity as a bookmark is available only in


unbounded task flows.
You can:
Designate in Property Inspector at
design time
Designate at run time with the
ViewBookmarkable() method
Optionally specify:
URL parameters
Method to invoke before view is rendered
Use the redirect option for a view activity
instead of making it bookmarkable

13 - 32 Copyright 2008, Oracle. All rights reserved.


Adding UI Code

Managed beans:
Configured in adfc-config.xml or other task flow .xml
file
Plain Old Java Objects (POJOs), Lists and Maps
Have no-argument constructor
Lazy initialization by JavaServer Faces framework as
needed

13 - 33 Copyright 2008, Oracle. All rights reserved.


Incorporating Validation into the User Interface

ADF Faces provides the following types of validation:


UI component attributes
Default ADF Faces validators
Custom ADF Faces validators
Use ADF Faces validation to provide immediate feedback
to users, instead of waiting for commit.
You should always define equivalent validation at the
business component level.

13 - 34 Copyright 2008, Oracle. All rights reserved.


Describing the Course Application:
UI Functionality

1 3

2 5

13 - 35 Copyright 2008, Oracle. All rights reserved.


Summary

In this lesson, you should have learned how to:


Describe the Model-View-Controller design pattern
Explain the role of the ADF Controller
Differentiate between bounded and unbounded task flows
Create task flows
Define control flows
Define global navigation
Create routers for conditional navigation
Call methods and other task flows
Convert task flows
Use validation in the user interface
13 - 36 Copyright 2008, Oracle. All rights reserved.
Practice 13 Overview:
Defining Task Flows

This practice covers the following topics:


Building an unbounded task flow
Creating a bounded task flow
Defining control flow rules
Adding routers, wildcards, and task flow calls
Converting an unbounded task flow to a bounded task flow

13 - 37 Copyright 2008, Oracle. All rights reserved.

Das könnte Ihnen auch gefallen