OAF DevGuide
OAF DevGuide
Table of Contents
Preface........................................................................................................................ 5 Chapter 1: Getting Started......................................................................................... 11 Chapter 2: OA Framework Essentials........................................................................ 27 Chapter 3: Building an OA Framework Application (the Basics)................................. 63 Chapter 4: Implementing Specific UI Features......................................................... 149 Chapter 5: Implementing Server-Side Features....................................................... 567 Chapter 6: Advanced OA Framework Application Topics......................................... 633 Chapter 7: Testing and Debugging .......................................................................... 705 Chapter 8: Standards and Guidelines ...................................................................... 737 Chapter 9: Extending and Deploying OA Framework Applications........................... 799 Appendices.............................................................................................................. 819 Glossary .................................................................................................................. 875 Subject Index........................................................................................................... 879
Contents
Audience Related Publications Typographic Conventions Send Us Your Comments
Audience
This documentation is written for the application developer and assumes familiarity with Java and SQL.
Related Publications
Additional Oracle9i JDeveloper helpsets that apply to OA Framework application development include: OA Framework ToolBox Tutorial OA Component Reference Getting Started with the OA Extension Getting Started with JDeveloper Developing Business Components As an application designer, you should also be familiar with the Oracle Browser Look and Feel (BLAF) UI Guidelines and the documentation for the Oracle9i Database.
Typographic Conventions
This manual uses the following typographic conventions to distinguish important elements from the body of the manual.
Convention plain monotype < Italic monotype in angle brackets > ... /* */ /** */ // Indentation
Explanation Used for code fragments and examples. Indicates developer-supplied values. An ellipsis indicates that the actual code extends beyond the example shown. A C-style comment. A Javadoc comment. A Java comment. Oracle standard indentation helps to show code structure.
Preface
Contents
Understanding the Support Options Available Important Limitations and Guidelines
Personalizations
Personalizations performed within the scope of the OA Personalization Framework are a fully supported means of customizing OA Framework based applications. Due to its declarative nature and durable architecture, the OA Personalization Framework continues to be recommended as the primary means for customizing OA Framework based applications. The supported capabilities, methods and tools for performing personalizations are documented in the Oracle Applications Framework Personalization Guide. The most current version of this Personalization guide is published in Metalink Note 268969.1. Methods or capabilities that not detailed in the Oracle Applications Framework Personalization Guide, fall beyond the scope of the OA Personalization Framework, and are not supported for Oracle E-Business Suite installations. Customers leveraging the capabilities of the OA Personalization Framework must ensure their 11i instance is kept current with latest OA Framework patchset applied. When reporting issues against Personalization, Oracle Support will as a first step, require you to check and confirm you have applied the most current patchset to ensure that the latest fixes for known issues have been applied to your instance. Information on the current 7
patchset, including known issues addressed in that patchset can be found in the OA Framework Release Notes for 11.5.10 (Metalink Note 275874.1).
Extensions
Release 11.5.10 of the OA Framework and the accompanying Oracle9i JDeveloper release provide features for developing a new class of Oracle applications extensions not available to customers in prior releases. Assistance with customer developed extensions is available via the following resources: Oracle Applications Framework Developer's Guide The Developer's Guide fully documents the capabilities of the Framework including instructions, examples and essential standards for implementing business-tier objects, UI components and server-side features. Specifically, Chapter 9 of the Developer's Guide under the section Extending OA Framework Applications, provides instructions on how to extend OA Framework based applications with custom business logic, including detailed guidelines for BC4J code extensions. Oracle Applications Framework ToolBox Tutorial Application The ToolBox Tutorial application is a sample application accompanied by extensive examples with step-by-step instructions that demonstrate the usage of business objects and UI components to build OA Framework based application pages, against a simple Purchase Order type application schema, installed on your 11i instance. The ToolBox includes a specific tutorial lab on Extending OA Framework Applications. OA Framework Javadoc Documents all core Oracle Applications Framework packages and classes, including UIX and BC4J objects extended by the Framework. OA Framework Discussion Forum on the Oracle Technology Network Starting with Release 11.5.10 of the OA Framework, OTN (http://otn.oracle.com) will host a discussion forum for OA Framework Extensions and the OA Extension to Oracle9i JDeveloper. Navigate to OTN Forums under the E-Business Suite (http://forums.oracle.com/forums/index.jsp?cat=3). You can use the forum to post questions and exchange information with other customers on the OTN community working on extensions. The OA Framework Development team and Oracle Support will monitor and participate in some of the discussion threads on this forum. Additionally, you may also consider participating in the OTN JDeveloper forum for usage questions concerning Oracle9i JDeveloper. Oracle Applications Product Documentation Some products may provide additional information on extending application specific business objects and functionality. Consult Oracle Metalink (http://metalink.oracle.com) under the respective product for more information. For issues logged with Oracle Support to address questions concerning OA Framework based extensions or usage of the OA Extension tool, Oracle Support will evaluate the nature of the question, and in most cases refer the customer to one or more of the resources outlined above.
be durable between upgrades. If it is absolutely essential to handle custom form submit events on a shipped product page, processFormRequest() is the only method that should be overriden in a controller class, although the risks outlined above still apply. Customers are fully responsible for all custom code written to support customer developed extensions. Oracle Support and E-Business Suite development will not review custom code. Questions such as those relating to design, and usage of components to develop extensions, will generally be redirected to the OTN forums mentioned above. To facilitate transparent upgrades and new feature uptake, custom code must comply with the Oracle E-Business Suite OA Framework coding standards described in Chapter 8 of the OA Framework Developer's Guide. Note: Information about the forthcoming passivation feature is provided throughout the Developer's Guide (including the coding standards) for preview/planning purposes only; passivation is not supported in Release 11.5.10. Customers planning to undertake advanced or complex extension projects may consider engaging services available from Oracle Consulting or Oracle Partner resources. Oracle Consulting and Partner organizations offer an alternative means of support through consulting resources who have been specially trained or certified on OA Framework and Oracle Applications technology. For more information on what options are available, please refer to the information under Oracle Consulting Services (http://www.oracle.com/consulting) and the Oracle Partner Network (http://www.oracle.com/webapps/opus/pages/SimpleSearch.jsp). Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
10
Introduction to OA Framework
Oracle Applications Framework (OA Framework) is the Oracle Applications development and deployment platform for HTML-based business applications. OA Framework consists of a set of middle-tier runtime services and a design-time extension to Oracle9i JDeveloper called Oracle Applications Extension (OA Extension). During the first few years after the Internet evolution, the software industry witnessed an influx of rapidly changing technologies. These technologies matured, yet there are still a myriad of low-level and complex technologies that are hard to learn and implement. Under these circumstances, OA Framework has emerged as an integrated platform for developing and deploying Oracle E-Business Suite HTML-based applications, leveraging technological advances without taking on associated complexity. Since its inception, OA Framework embraces the following principles: End User Productivity The shift from client-server to multi-tier deployments comes with many cost savings, but not without compromise. HTML-based applications started out very much like old mainframe terminals; actions on the client side resulted in a round trip to the middle tier. Over time, user interface interactivity improved. OA Framework has always kept user interface interactivity a top priority with features such as partial page rendering (PPR), hot keys, smart choice lists and auto-completion of fields with lists of values. In addition, Oracle focuses a wealth of resources and expertise on user behavior and psychology, to develop a set of user interface layout and interaction standards, commonly known as the BLAF (Browser-Look-And-Feel) guidelines. BLAF is the default look and feel that all OA Framework applications assume, but can be personalized in many ways to meet customer branding and style requirements. OA Framework's implementation of BLAF standards yields a consistent user experience and further enhances user productivity. Enterprise-Grade Performance and Scalability OA Framework has aggressive performance and scalability targets. Most Oracle E-Business Suite application pages have sub-second response times to most user interactions. It takes a bit longer the first time a page is accessed within the same Java Virtual Machine, but thereafter, most of the commonly needed information (such as user information) is cached in the middle tier, allowing faster response. Resources are conserved through a number of resource pooling mechanisms and the swapping of idle resource data between memory and database. Developer Productivity OA Framework is designed around the simple Model-View-Controller (MVC) architecture. To shield application developers from costs associated with the rapidly changing technological landscape, Oracle has adopted a declarative flavor of the MVC architecture. Key building blocks of an application are defined in a descriptive manner using a simple JDeveloper user interface and then saved in an industry standard XML format. With OA Framework Release 11.5.10, Oracle is extending access and benefits of the OA Framework development environment to all Oracle E-Business Suite customers and partners. Customers and partners can leverage the proven OA Framework technology to add extensions to their Oracle E-Business Suite applications. Application Customizability Oracle is able to exploit its twenty plus years of experience in building and deploying business applications, to architect OA Framework with durable and economical customizations. Oracle has kept that goal in focus and produced a very compelling solution with plenty of flexibility to tailor the user interface (look-and-feel) and business logic. Thanks to the declarative and object oriented nature of OA Framework, application personalization and extensibility is readily available at a fraction of the industry startup cost and at a very minimal maintenance cost, if any. Open Standards Oracle continues to be a champion of industry standards and an active participant in the development of several emerging standards. OA Framework technologies has driven several industry standards 11
and has adopted several others as they were published. Several Oracle technology architects are active members on a number of standards drafting committees. OA Framework is J2EE based and features several industry standards such as XML, HTML, Java, JSP, SQL and Web Services.
Architecture
OA Framework is based on the industry-standard J2EE MVC design pattern. Developers manipulate the application's metadata using Oracle 9i JDeveloper OA Extension, while OA Framework uses the most efficient manner to execute the application. The MVC architecture is a component-based design pattern with clean interfaces between the Model, View, and Controller. The Model is where the application implements its business logic. The View is where the application implements its user interface and the Controller is where the application handles user interaction and directs business flow. Figure 1: OA Framework MVC architecture.
OA Extension offers the following design time tools: UML tools to model and generate business logic. Guided user interface (and visual editors in a future release) to lay out client user interfaces. Code generation for Controller classes. 12
The OA Framework Model is implemented using Oracle Business Components for Java (BC4J). BC4J provides optimized, ready-to-use implementations of the J2EE design patterns that developers otherwise would have to code, debug, and test by hand. By leveraging BC4J's combination of tested code and productivity tools inside the Oracle JDeveloper IDE, development teams can focus immediately and only, on writing business logic and user interfaces instead of on designing, coding, and debugging handcrafted application "plumbing" code. The OA Framework View is implemented using UI XML (UIX). UIX uses XML to describe the components and hierarchy that make up an application page. UIX also provides runtime capabilities to translate that metadata into HTML output so that it can be shown on a Browser or a mobile device. The metadata used to describe the UI is loaded into a database repository, called Meta Data Services (MDS), at deployment time and optionally at design time as well. User- and application-driven interactions are handled by the OA Controller, which is a pure Java class implementation. Simple page flows (such as a 2-step transaction) are implemented directly into the Controller object; others are implemented using Oracle Workflow. In a future release, business flows will be implemented in a declarative manner similar to that used to define model and view objects.
Key Features
Integrated Development Environment
Oracle9i JDeveloper with OA Extension (OA Extension) is a world class J2EE-based integrated development environment. Oracle customers and third party consultants have access to the same tools used by Oracle EBusiness Suite developers to build complementary applications as well as extend the Oracle E-Business Suite applications. OA Extension provides features such as easy-to-use wizards, a hierarchy navigator, and a property sheet. These features enable developers to populate the metadata for declarative application business logic and user interfaces. JDeveloper offers a wealth of productivity tools such as the UML modeler, code coach, integrated debugger, local testing environment and documentation generator. With the OA Extension software comes a wealth of documentation and learning aids including a Developer's Guide, Javadoc, Online Help, a Sample Library and a rich set of Tutorials.
Application administrators and application developers have the flexibility to tailor the user experience at several levels. They can author personalizations that affect all users, users of a particular locale, users of a particular organization, users with a particular role and in the context of a particular function. Several levels can apply at the same time with a predetermined precedence order that yields a very personalized user experience. Using a combination of OA Extension wizards and built-in personalization screens, several user interface and business logic extensions are made possible at a minimal cost to development with little-to-no maintenance cost. In addition, Oracle E-Business Suite customers continue to enjoy the extensibility features offered by Oracle Flexfields, Oracle Workflow and Business Events.
PPR is a means by which designated parts of a page, rather than the whole page, is refreshed when the user performs certain actions. OA Framework supports PPR on actions such as: table record-set navigation, table sorting, table column totaling, adding a row to a table, row-level and cell-level detail disclosure, toggling the visibility of a Hide/Show component, populating a LOV, subtab navigation, Gantt chart refreshing and descriptive Flexfields context switching. Moreover, developers can declaratively enable PPR events on several components. For example, a developer can: Configure the selection of a poplist to cause related fields to render, be updatable, be required or be disabled based on the selected value. Configure the value change of a text field to set related field values (for example, if you set a Supplier value and tab to the next field, the dependent Supplier Site defaults automatically). Configure the selection of a master table's record to automatically query and display related rows in a detail table.
2. Accelerator (Hot) Keys
OA Framework supports mnemonic accelerator keys for selected buttons and enables developers to assign numeric access keys to product specific user actions.
3. Enhanced Save Model
OA Framework provides a default implementation to warn users when they are about to lose changes such as when they click on a link that takes them outside the context of the current transaction. Developers can override the default behavior on a component-by-component basis.
4. Smart Poplist
OA Framework supports a personalizable hybrid between a static poplist and a searchable list of values. The poplist includes the most popular values a user uses to populate a particular attribute. The user can personalize the values that show up in the poplist by picking new values from a list of values. Moreover, the user can personalize the order in which values are listed in the poplist as well as remove less popular values. This feature is also referred to as a LOV Choicelist.
5. LOV Auto Completion
Lists of values (LOVs) are used when the list of possible values is long and the user may want to conduct a search before picking a value. In some business scenarios, especially with clerical jobs, the user uses a small set of values or may find it faster to type a partial value. If the user enters a partial value in a field that is associated with an LOV, OA Framework conducts a search before bringing up the LOV window. If the search leads to a unique record, OA Framework completes the rest of value for the unique record and saves the user from having to use the LOV window. 14
Built-in Security
HTML-based applications offer great user and administrator convenience, but special care must be taken to ensure that these applications are secure. Developing HTML applications that are truly unbreakable is very difficult, historically requiring application developers to also be security experts. In fact, most application developers are not security experts, and they should not need to be. It is the responsibility of the application framework to ensure that HTML transactions are authorized, private, and free from tampering. OA Framework provides built in protection against known HTML hacking strategies, leaving the application developer free to concentrate on application functionality. Also, since UI components are defined in metadata rather than in code, the security protection offered by OA Framework can be advanced to keep up with the state of the art, without requiring applications to be rewritten. 15
Deployment Environment
OA Framework applications are deployed using standard Oracle9i AS / Apache and Oracle9i Database servers. Application pages can be rendered on Internet Explorer 5.0 or above, Netscape 4.73 or above and Mozilla 1.5 or above. The data and middle tiers can be deployed on several platforms including Linux, UNIX and Windows.
Summary
Based on the Model-View-Controller (MVC) architecture, OA Framework lets application developers focus on the business requirements rather than on the underlying technologies. By using declarative and guided-coding (and soon visual) techniques, OA Framework allows application developers who are not necessarily J2EE experts to quickly become productive. OA Framework-based applications offer a highly consistent user experience with the highest levels of user interactivity without a client footprint. Applications are optimized for sub-second response to most user interactions and competitive scalability trends. OA Framework exploits its declarative and object-oriented architecture to offer the most durable personalization and extensibility capabilities on the market, at a fraction of the cost. OA Framework features translate to lower costs of ownership, better user experience and competitive deployments. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
16
Select My Computer on your desktop, right-click and select Properties. In the System Properties dialog, select the Environment tab. In the Environment page, select any variable in the User variables for <username> list. Replace the Variable name with JDEV_USER_HOME. Replace the Value with <drive>:\jdevhome\jdev where <drive> is the drive where you installed the OA Framework ARU. For example: C:\jdevhome\jdev. 5. Select the Set button to create the variable, and OK to close the System Properties dialog. Warning: The variable value should not contain a leading space before the drive name. If it does, your environment will not work properly.
1. 2. 3. 4.
2. In the System Navigator, select toolbox.jws and select Project > Rebuild toolbox.jws from the main menu. You should get 0 errors (warnings are okay and expected). 3. In the System Navigator, expand the Tutorial.jpr project again and select Project > Show Categories from the main menu (this helps organize the files in a large project). 4. Expand the HTML Sources category beneath Tutorial.jpr, select test_fwktutorial.jsp, and select Run > Run test_fwktutorial.jsp from the main menu. The Test Framework ToolBox Tutorial page displays a list of lesson links; select Hello, World! to run a very simple page. If you can't run the Hello, World! page, please revisit the steps listed above to ensure that you completed everything correctly. If the problem persists, follow the support procedure described in the Release Notes accompanying this ARU. 5. Now you are ready to follow for some hands-on experience with the Oracle 9i JDeveloper OA Framework Extension. The ToolBox Tutorial lessons can be launched from jdevdoc\index.htm.
First, you need to identify your UNIX home server. To do this, log into the Oracle E-Business Development Services Account Management System (instructions for logging in are provided in the application). A fter logging in, look for the PC Mapping Path value (for example, for the user jdoe this looks like \\ap106nap\home2\jdoe). Create a mapping for your H: drive to the \\<your_unixserver>\<home>\<your_username> PC Mapping Path value you found above and check reconnect at logon. You will use this drive to access your private work area. Note: You must use the letter "H" for this mapping.
20
H:\jdevhome\jdev\myhtml H:\jdevhome\jdev\myprojects
23
Contents
Page Test Modes Profile Options Technology Stack Information
Note: You can set page test modes two different ways, however, the back button and passivation test modes currently must be set as cookies in a test JSP.
Project Settings
1. Select your project in the JDeveloper System Navigator and select Project > Project Settings... from the main menu. 2. In the Project Settings dialog, select the Common > Oracle Applications > Run Options page. 3. In the Run Options page, select the test modes that you want to enable in the Off Options List and shuttle them to the On Options List. 4. Select OK to save your changes.
Note: Test JSP cookie values override any values that you set for the project. <SCRIPT LANGUAGE="JavaScript"> document.cookie = "OADiagnostic=1"; document.cookie = "OADeveloperMode=1"; document.cookie = "OABackButtonTestMode=0"; document.cookie = "OAPassivationTestMode=0"; document.cookie = "OADumpUIXTree=0"; </SCRIPT>
Profile Options
There are several profile options that you might want to set during development. See Appendix B: OA Framework Profile Options for a list of all the Oracle E-Business Suite profile options that affect the OA Framework. Warning: Be conservative when you change profile option values! You should be setting them at the responsibility, user, or application level as appropriate in order to avoid impacting other developers working on the same environment.
Accessibility
The Self Service Accessibility Features profile options controls whether pages can be used with assistive technologies. If enabled, the OA Framework Partial Page Rendering (PPR) features are disabled -- which can be surprising if you're not expecting this behavior.
Personalization
There are series of related profile options that control whether Personalization is enabled and accessible in a page. See the Personalization section in the profile options document (this also points you to additional information about the feature).
Logging
There are a series of related profile options that control if and how logging is implemented. See the Logging section in the Profile Options document (this also points you to additional information about the feature).
Passivation
There are a series of related profile options that control whether passivation is enabled. See the Passivation section in the Profile Options docment (this also points you to additional information about this feature).
25
26
Contents
Key JSP Application Components What Happens at Runtime? Event Handling: Web UI vs. Classic Client UI Page Navigation What is a Cookie? More About Servlet Sessions
Suggested Reading
For additional information about JSP applications and servlets (none of which is required reading for working with the OA Framework), you might want to review the following for tutorials, documentation and book suggestions: Oracle Technology Network JavaSoft Java Developer Connection
27
What is a "Form?" In simple terms, a "form" lets you collect data entered by users into "form fields," and send that data to the server for processing. A form is an HTML construct that groups data entry controls like fields (both hidden and visible), poplists and so on with action controls (like buttons) that are capable of "submitting the form." When the user selects a submit button, for example, the browser issues a POST request which sends the form's data to the server. Tip: People often use the terms "POST" and "submit form" interchangeably when talking about the OA Framework.
Step 2
The HTTP listener in the web application server routes the incoming request to the JSP. The developer's code does not know or care whether the browser issued a POST or a GET. All it does is read request values to determine what to do. So, for example, one of the request values might tell the JSP that a "Go" button had been pressed, which means it must execute a query.
Step 3
As shown in Figure 1 above, the JSP delegates to one or more JavaBeans which implement various behaviors including database interaction. Once they have completed their work, the JSP prepares the appropriate HTML content to send back to the browser in the response. Note: We included the JavaBeans in this example just to make the point that in an application of any complexity -- and modularity -- the JSP does not do the application work on its own since you should not combine model, view and controller code in the same file. However, there is no absolute technical requirement for the JSP to work with any other Java classes, and if it does, there is no requirement that these classes be JavaBeans.
Step 4
The browser displays the HTML it received in the response.
Page Navigation
So far, we've reviewed what happens (in general terms) when the browser communicates to the web server and vice versa, but we have not discussed the primary mechanisms for navigating from one page to another. Note: In the following generic descriptions, it does not matter whether the request sent by the browser is a POST or a GET.
Standard Request
29
Scenario A user selects a link on some Page X to navigate to Page A. While on Page A, she selects a link to navigate to Page B. Implementation The browser sends a request to Page A which does its work and sends a response to the browser including the HTML to display. When the user indicates she wants to see Page B, the browser sends a new request to Page B which does its work and sends a response so Page B can display. Figure 2: Standard request illustration
30
JSP Forward
Tip: You will code many JSP Forwards in your OA Framework application. You must understand this concept. Scenario While on Page A, a user selects an action from a dynamically defined list. The code in JSP A needs to handle that action to determine what page to display in response. Implementation In this case, while handling an incoming request as a result of the user's action selection, JSP A "forwards" to JSP B which does its work and sends a response including the HTML to display itself. Since the "forward" action happens on the server, the browser knows nothing about it and the two pages share the same request. Figure 3: JSP forward from one page to the next within a single request
In another variation, which is very common in OA Framework pages for reasons which will be described later in this chapter and the next, Page A could perform a JSP Forward back to itself as shown below. Figure 4: JSP forward from one page back to itself within a single request
31
Client Redirect
Scenario A user selects a link on some Page X to navigate to Page A, but the link is old so the developer wants to automatically send the user to the new replacement, Page A2. Implementation In this case, while handling an incoming request, JSP A sends a special "redirect" message to the browser telling it to immediately access JSP A2. The browser sends a second request to JSP A2 which does its work and sends a response including the HTML to display. Figure 4: A client redirect from one location (page) to the next (the same page in a different location)
32
What is a Cookie?
To fully understand how the OA Framework maintains application context after a user logs in, you need to understand what a browser "cookie" is. A "cookie" is a nugget of information that a web application can give to a browser with the understanding that the browser will send it back to the server with each request. In other words, it is a mechanism for holding on to some small amount of state between requests. Cookies can be persistent or session-based: The browser saves a persistent cookie to a file on the user's computer, and the information endures across browser sessions. Have you ever navigated to a web site that greeted you by name before you logged in? If so, this was accomplished with a persistent cookie. Session-based cookies are held in the browser's memory, and when the browser is closed, the cookie is destroyed.
Since a single browser session can be served by numerous threads (a different one for each request), the servlet session provides a resource for maintaining state across requests. If a web application wants to establish a servlet session, it calls a method on the request object asking for a session to be created. The servlet engine creates the session (specifically, a javax.servlet.http.HttpSession object), along with a special cookie that it returns to the browser with the response. This session cookie holds the servlet session ID. When a new request is received with the session ID cookie, the servlet engine uses this ID to locate that particular browser's servlet session object. Web application code can then access any data stored on the servlet session during previous requests within the same browser session. Note: You can track sessions two ways. The most common way, which is what the OA Framework does, is to use a session cookie. Alternatively, you can encode the cookie into request URLs. If you want to learn more about this, or any other concepts presented in this document, see the suggested reading section above. Copyright 2000 - 2004, Oracle Corporation. All rights reserved. 34
Contents
Page Basics The Model The View The Controller Web Bean Architecture Guide to OA Framework Javadoc
Prerequisite Reading
If you are new to web application development, please read the short JSP Application Primer before proceeding. The OA Framework Developer's Guide assumes you are familiar with the concepts and vocabulary presented in the JSP Primer.
Page Basics
At the browser level, an OA Framework page -- like any other web page -- renders as standard HTML. In the middle tier, however, this page is actually implemented in memory as a hierarchy of Java beans -- very much like a classical Java client UI. Each UI "widget " that renders in the page (buttons, a table, the tabs, the application branding image and so on) actually corresponds to one or more web beans in the hierarchy. When the browser issues a request for a new page, the OA Framework reads the page's declarative metadata definition to create the web bean hierarchy. For each bean with an associated UI controller, the OA Framework calls code that you write to initialize the page. When page processing completes, the OA Framework hands the web bean hierarchy to the UIX framework so it can generate and send HTML to the browser. When the browser issues a form submit (if, for example, the user selects a search region's "Go" button), the OA Framework recreates the web bean hierarchy if necessary (the hierarchy is cached between requests, and typically needs to be recreated only in exceptional cases that we'll discuss in detail later), and then calls any event handling code that you've written for the page beans. When page processing completes, the page HTML is generated again and sent to the browser. The rest of this document introduces the specific model, view and controller code and declarative definitions that you create to implement a page. Figure 1: A conceptual illustration of the OA Framework model-view-controller architecture
35
The Model
The model encapsulates the underlying data and business logic of the application. It also provides an abstraction of the real-world business object(s) and application service(s) that it provides. The Implementing the Model document in Chapter 3 discusses all of the following in detail. Figure 2: Basic model architecture
36
* Note: To be completely accurate and consistent, this diagram should include the implementation oracle.apps.fnd.framework.server.OADBTransactionImpl instead of the oracle.apps.fnd.framework.OADBTransaction interface, however, we have chosen to include latter since you will exclusively use the interface in your code.
Application Modules
A BC4J application module is essentially a container that manages and provides access to "related" BC4J model objects. In this context, objects are "related" by virtue of participating in the same task. For example, all the BC4J objects that comprise a single transaction participate in the same task -- even if the corresponding user interface requires that the user visit multiple pages. All application modules that you create subclass the oracle.apps.fnd.framework.server.OAApplicationModuleImpl class. Each OA Framework page has a "root" application module which is associated with the top-level page region (the pageLayout region). The root application module provides transaction context and establishes a database connection. If multiple pages participate in the same physical or virtual transaction, they should share the same root application module. If a page functions independently of any other, it should have its own application module. The OA Framework State Management document in this chapter discusses the relationship between root application modules and different kinds of pages in detail. Note: It is also possible for a root application module to contain one or more "nested" application modules (which can themselves nest children to any arbitrary level). In this scenario, the root application module has access to all the data/objects held by its children, and all children participate in the same transaction established by the root. You will use this feature whenever you want to create a reusable UI region that interacts with the database.
implements all the business rules for inserting, updating and deleting a supplier. Note: Entity objects can also be based on views, synonyms or snapshots. The OA Framework supports both Java and PL/SQL entity objects (Chapter 5 discusses business logic design and implementation in detail, including advice on choosing Java versus PL/SQL entity objects). Most entity objects that you create subclass the oracle.apps.fnd.framework.server.OAEntityImpl class (you will see a bit later that the PL/SQL entity objects extend specialized versions of OAEntityImpl). There is a one-to-one mapping between a table and an entity object, and all Oracle Applications entity objects should include all columns in their associated tables. Entity objects use a declarative mapping between their attributes and underlying database columns to automatically implement queries, inserts, updates and deletes. In most cases, all you need to do is add the validation logic. An entity object is intended to be used by any program (not just an OA Framework client) that needs to interact with a given table. As such, it should consolidate all the validation logic for the entity object so business rules are consistently implemented regardless of which client exercises them. Association Objects If you have complex objects (like a 3-level purchase order with a 1:many relationship between headers, lines and shipments) you can also define relationships between the corresponding entity objects by creating association objects. You can create weak associations (a purchase order header "references" a supplier which exists independently of any given purchase order) and strong composition associations (a purchase order header "owns" its lines, which cannot exist outside the context of their header).
OADBTransaction
As shown in the diagram above, the OADBTransaction plays a central role in your model code since it encapsulates the JDBC connection/database session associated with a root application module, and directly owns any entity objects that you create (your view objects, owned by the root application module, hold 38
references to their entity objects in their view rows). You will also make regular use of the OADBTransaction in your model code for the following common actions: Creating a callable statement for executing PL/SQL functions and procedures Accessing session-level Applications context information like the user's name, id, current responsibility and so on Accessing an oracle.apps.fnd.framework.OANLSServices object if you need to perform NLS operations like converting server date/time into user date/time and so on Access to the OADBTransaction is provided by the root application module.
The View
The view formats and presents model data to the user. The Implementing the View document in Chapter 3 discusses all of the following in detail.
39
Note: The region and item names shown below do NOT comply with the Oracle Applications naming standards; instead, they are intended to help you translate from the structure to the corresponding web beans. Figure 4: page structure in JDeveloper
40
Attribute Sets Each region or item can inherit groups of property settings by using attribute sets. An attribute set is a named, reusable collection of properties that can be used by any type of UI object, including regions, items, and other attribute sets. Whenever you create a UI that uses attribute sets, you can override the inherited properties (although this is discouraged in the OA Framework coding standards). To illustrate this concept, in Applications development, each table must have associated attribute sets for each displayable column. These attribute sets include properties like prompt, display width, and so on. In the OA Framework ToolBox Sample Library/Tutorial, we have a purchase orders table (FWK_TBX_PO_HEADERS) with a primary key column HEADER_ID of type NUMBER that is also displayed to users as the purchase order number. This table has an associated attribute sets XML package file called FwkTbxPoHeaders that includes all the attribute sets for the table's displayable columns (one attribute set per column). One of the attribute sets is called HeaderId. The HeaderId attribute set has the Prompt property set to Order Numberand the Display Length set to something reasonable like 15. When we create a page that includes the purchase order number item, we would specify the Attribute Set property to the fully qualified attribute set name /oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxPoheaders/Headerid 41
Component Reuse If you want to incorporate shared objects into your page, you can simply extend them. For example, in the OA Framework ToolBox Sample Library/Tutorial we created a common region (named PoSummaryRN) so the same content could be included in multiple pages without recoding. To add this shared region to a page, we simply created a new region, and then set its Extends property to the fully qualified name of the shared region: /oracle/apps/fnd/framework/toolbox/tutorial/webui/PoSummaryRN Note: The shared region is not editable in the referencing page, so its items are grayed out in the JDeveloper Structure pane. Figure 6: Extending a region JDeveloper
42
Data Source Binding For beans with any database interaction (query, insert, update and/or delete), you also specify a data source binding to a View Instance Name and associated View Attribute Name. This binding is crucial because the OA Framework uses it to get queried data from, and write user-entered data to, the underlying view object. The View Instance Name references the underlying view object within the context of its containing application module (all view objects "live" within an application module and are identified by an instance name within its container). For example, if a SuppliersVO view object is identified by the instance name "MySupVO" within your page's root application module, "MySupVO" is the name you would specify here. The View Attribute Name references the underlying view object attribute that maps to a column. For example, if your SuppliersVO has an attribute "SupplierId" (which maps to the underlying column SUPPLIER_ID), "SupplierId" is the name you would specify here.
Personalizing Pages
The OA Framework also includes a declarative customization infrastructure called the OA Personalization Framework. This is intended to support the customization needs of end users and the product delivery chain (changes for localization, verticalization and so on). Note: As you'll see throughout the Developer's Guide, creating regions and items declaratively is always preferable to creating them programmatically. In fact, you should create components programmatically ONLY if you cannot create them declaratively so customers can personalize your work.
The Controller
The controller responds to user actions and directs application flow. The Implementing the Controller document in Chapter 3 discusses all of the following in detail. Controllers can be associated with the view at the region level (in more general terms, any OA Framework web beans that implement the oracle.apps.fnd.framework.webui.beans.OAWebBeanContainer interface can have associated controllers). All controllers that you create subclass oracle.apps.fnd.framework.webui.OAControllerImpl as shown in Figure 7 below. The controller class is where you define how the web beans behave. Specifically, you write controller code to: Manipulate/initialize the UI at runtime (including any programmatic layout that you are unable to do declaratively) and Intercept and handle user events like button presses
Request Handling
When the browser issues an OA.jsp request for one of your pages: 1. The oracle.apps.fnd.framework.webui.OAPageBean (the main OA Framework page processing class) uses the page name to determine which root application module it needs so it can check it out from the application module pool. This application module also checks out a JDBC connection from the connection pool, and the transaction context for the page is established. 2. The user session is validated; if invalid, a login page is displayed (note that this is a simplification; additional details are provided later in the Developer's Guide). 3. Assuming the user is valid, the OAPageBean evaluates request parameters to figure out if it is dealing with an HTTP POST or a GET. Handling a GET Request When the browser issues a GET request to the server for a page (or you manually forward to it), the OA Framework uses the declarative UI definition to build the web bean hierarchy: 1. The OAPageBean calls processRequest() on the page's top-level pageLayout bean, and the entire web bean hierarchy is processed recursively as follows to initialize the web beans (including any associated model components): 1. Each web bean instantiates its controller -- if it has one -- and calls processRequest(OAPageContext pageContext, OAWebBean webBean) on the controller. This is the method you use to construct/modify your page layout, set web bean properties and do any manual data initialization (if, for example, you need to perform an autoquery when you navigate to the page). 2. Some complicated web beans (like the oracle.apps.fnd.framework.webui.beans.table.OATableBean and oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean) perform post-controller processing by calling their prepareForRendering() methods (this method is described in the corresponding bean Javadoc). 3. Each web bean calls processRequest() on its children. 2. The oracle.apps.fnd.framework.webui.OAPageBean gives the web bean hierarchy to UIX to render and send to the browser. Handling a POST Request When the browser issues a POST request to the server for a page: 44
1. The OAPageBean checks to see if the web bean hierarchy is in memory. If not (because resources were reclaimed, the user navigated with the browser Back button, or a POST is issued to the main page from a dialog message page), it recreates the hierarchy as described in the GET processing above. 2. The OAPageBean calls processFormData(OAPageContext pageContext, OAWebBean webBean)on all the beans in the hierarchy to write the form data to the model (specifically, it calls processFormData() on the pageLayout region, and then each web bean recursively calls processFormData() on its children). Writing the form data to the underlying model automatically invokes attribute and entity-level validations, and if you throw any validation exceptions, processing stops and error messages are displayed to the user. 3. If no exceptions are thrown during the processFormData() phase, OAPageBean calls processFormRequest(OAPageContext pageContext, OAWebBean webBean) on all the beans in the hierarchy using the same approach described above. This pass gives your controller code the opportunity to respond to user actions. 4. If no JSP forwards or page redirects were issued -- or exceptions were thrown in processFormRequest() -- then the page is refreshed.
OAPageContext
When the OA Framework receives an OA.jsp request, the OAPageBean creates an oracle.apps.fnd.framework.webui.OAPageContext, a class that exists only for the duration of page processing. Each of the three key methods described above (processRequest(), processFormData() and processFormRequest()) takes an OAPageContext as a parameter, and any controller code that you write will invariably make use of this crucial class. Figure 7: Relationship between the OAPageContext and other key classes
As illustrated in the diagram above, the OAPageContext has a reference to both the request and the root application module. Given these relationships, and the fact that an OAPageContext is passed to each of your controller response-processing methods, you can see how you would use the OAPageContext for the following list of common tasks: Accessing Request Parameters Perhaps most importantly, this is the class that you use to read request values by calling a simple getParameter(String name) method (remember that the request includes any URL parameters plus -- if it is a POST -- any form field values plus the names and events associated with any action/control widgets selected by the user). Tip: For individual web beans on your page (buttons, fields, and so on) the name value passed to getParameter() is the corresponding unique ID that you assign when defining your page. So, for example, you 45
can tell if the user pressed a button that you named "GoButton" in JDeveloper by writing the following code in a controller: processFormRequest(OAPageContext pageContext, OAWebBean webBean) { if (pageContext.getParameter("GoButton") != null) { // The user pressed the "Go" button, do something... } } Accessing the Root Application Module The OAPageContext caches a reference to the root application module, which in turn provides access to its view objects and the transaction. If you need access to an application module, ask the OAPageContext: processFormRequest(OAPageContext pageContext, OAWebBean webBean) { OAApplicationModule am = (OAApplicationModule)pageContext.getRootApplicationModule(); } Issuing Navigation Instructions You use methods on this class to tell the OA Framework to perform a JSP forward or a client redirect. For example (we'll review this method in greater detail later in the Developer's Guide): processFormRequest(OAPageContext pageContext, OAWebBean webBean) { if (pageContext.getParameter("CreateButton") != null) { // The user pressed the "Create Supplier" button, now perform a JSP forward to // the "Create Supplier" page.
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/dem/employee/webui/EmpDetails PG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, null, true, // Retain AM OAWebBeanConstants.ADD_BREAD_CRUMB_YES, // Show breadcrumbs OAWebBeanConstants.IGNORE_MESSAGES); } } Accessing Application Context Information Like the OADBTransaction in your model code, the OAPageContext provides access to servlet session-level Oracle Applications context information like the user's name, id, current responsibility and so on. For example, the following code snippet shows how to get the user's name: processRequest(OAPageContext pageContext, OAWebBean webBean) { String userName = pageContext.getUserName(); }
the UIX framework, and the package definitions still use this old name). Each OA Framework web bean also implements a group of interfaces whose implementations collectively define the behaviors that the OA Framework adds to the base UIX beans. oracle.appps.fnd.framework.webui.beans.OAWebBean - defines core behavior common to all web beans (for example, among other key behaviors, this defines the processRequest, processFormData and processFormRequest methods that individual beans implement for themselves) oracle.apps.fnd.framework.webui.OAWebBeanConstants - a collection of constants used in the view/controller modules oracle.apps.fnd.framework.webui.beans.OAWebBeanData - defines common personalization definition and data source management behavior oracle.apps.fnd.framework.webui.beans.OAWebBeanContainer - defines the characteristics of all web beans that can act as containers for other web beans. For instance, all the layout web beans implement this interface. Only beans which implement this interface can have associated controllers. OAWebBean<Type> - defines a bean's inherent behaviors within the context of the OA Framework. For example, the OATableBean implements the oracle.apps.fnd.framework.webui.beans.OAWebBeanTable interface. Figure 8: Example of a container web bean (OATableBean)
Internal Bean Structure Each web bean maintains the following information about itself: _indexedChildren - child web beans _namedChildren - child web beans that UIX tags for special behavior _attributes - web bean characteristics (descriptive properties) as illustrated in Figure 9 below Figure 9: Illustration of web bean use of a Dictionary to track key/value pairs of its attributes
47
Data Bound Values Instead of literal values as illustrated in Figure 9 above, OA Framework web bean attributes are actually implemented as data bound values, meaning that the value is provided by an underlying data source that is resolved to the component at rendering time. You will see a bit later how to define and use custom bound values in your code. Rendering At page rendering time, the UIX framework processes the web bean hierarchy to generate the page HTML. For each web bean attribute, UIX calls its getAttributeValue() method while passing it a rendering context (a rendering context is basically all the information that UIX needs to resolve bound values). For a given attribute, for example, the rendering context knows what the underlying view object instance, view attribute and current row are. The data bound value uses the information supplied by the rendering context to interrogate its data source, and returns the actual value to UIX so it can generate the corresponding HTML.
oracle.apps.fnd.framework
Contains classes and interfaces which can be safely accessed from model (server) and user interface controller or view (client) code. For example, if you need to access a root application module in your page, you will use the oracle.apps.fnd.framework.OAApplicationModule interface (you will never access an implementation on the client). Among other things, this package also includes: All OA Framework exceptions that you might have occasion to throw The OANLSServices class that you will use to perform internationalization operations
oracle.apps.fnd.framework.server
Contains classes and interfaces for implementing the model in an OA Framework Model-View-Controller application. These classes are intended to be used with any client user interface (not just OA Framework HTML pages), and as such should have no direct references to any classes and interfaces published in the oracle.apps.fnd.framework.webui package and subpackages, or in any application-specific webui packages 48
and subpackages. When building an OA Framework application model, you should always work with the classes in this package instead of the BC4J classes they extend. Warning: Never call any classes in this package from controller or view code.
oracle.apps.fnd.framwork.webui
Contains core classes for building and manipulating OA Framework HTML user interfaces. Some of the most commonly used classes/interfaces in this package include: OAController OAPageContext Any class in the beans subpackages described below Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.beans
Contains web bean classes for user interface components that don't fit neatly into the various bean subpackages (for example: image, switcher, static instruction text, key flexfield, descriptive flexfield and more). You should use these classes when writing a user interface controller that needs to programmatically manipulate the web beans. This package also contains core OA Framework interfaces implemented by all web beans. The classes in this package and its subpackages correspond to the UIX components they extend as shown below. When building OA Framework application pages, you should always work with the OA Framework classes unless a new feature that you want to use has been introduced in UIX, and is not yet supported by the framework. Note: OA Framework classes are always instantiated for MDS pages that you build declaratively in JDeveloper. UIX Package OA Package oracle.cabo.ui.beans oracle.apps.fnd.framework.webui.beans oracle.cabo.ui.beans.form oracle.apps.fnd.framework.webui.beans.form oracle.cabo.ui.beans.include oracle.apps.fnd.framework.webui.beans.include oracle.cabo.ui.beans.layout oracle.apps.fnd.framework.webui.beans.layout oracle.cabo.ui.beans.message oracle.apps.fnd.framework.webui.beans.message oracle.cabo.ui.beans.nav oracle.apps.fnd.framework.webui.beans.nav oracle.cabo.ui.beans.table oracle.apps.fnd.framework.webui.beans.table Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.beans.form
Contains web bean classes for HTML form components including a submit button and various data entry/specification controls (checkbox, radio group, shuttle, text input field and more). You should use these classes when writing a user interface controller that needs to programmatically manipulate the web beans. Note: for many of the web beans in this package there are variants in the oracle.apps.fnd.framework.webui.beans.message package (the message web beans have the ability to display error, information, and warning icons with an explanatory message whereas corresponding data entry/specification web beans in this package do not). When you create your pages declaratively in JDeveloper, the OA Framework automatically instantiates message beans for any of those components that exist in both packages. You should use the classes in this package only in the following cases: 1. the class doesn't have a message bean alternative (for example, the OASubmitButtonBean exists only in this package) 49
2. you cannot use the message bean alternative Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.beans.include
Contains web bean classes for including user interface fragments from external sources (servlets, JSP pages, and plain HTML) in OA Framework application pages. You should use these classes when writing a user interface controller that needs to programmatically manipulate the web beans. Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.beans.layout
Contains web bean classes for laying out content in an OA Framework application page, including special layout components like hide/show, content containers, bulleted lists, headers, standardized templates for single/double column layouts and more. You should use these classes when writing a user interface controller that needs to programmatically manipulate the web beans. Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.beans.message
Contains web bean classes for HTML form data entry/specification components that are capable of displaying associated error, warning or information icon(s) with an explanatory message (for example, if a user enters the wrong value in a text input field an error icon renders next to its prompt). You should use these classes when writing a user interface controller that needs to programmatically manipulate the web beans. Note: Many of the web beans in this package are also included in the oracle.apps.fnd.framework.webui.beans.form package without the ability to display the supplemental message icons and text. When you create your pages declaratively in JDeveloper, the OA Framework automatically instantiates message beans for any of those components that exist in both packages. You should use the classes without the message capability only if you cannot include message beans in your page. Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.beans.nav
Contains web bean classes for HTML user interface navigation components (links, trees, menu elements, quick links, breadcrumbs and more). You should use these classes when writing a user interface controller that needs to programmatically manipulate the web beans. Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.beans.table
Contains web bean classes for tables (which present data to the user in a tabular format) and HGrid components (a hybrid of tabular data display with treelike hierarchical structure). You should use these classes when writing a user interface controller that needs to programmatically manipulate the web beans. Warning: Never call any classes in this package from model code.
oracle.apps.fnd.framework.webui.laf
Contains utilities that can be used for controlling HTML rendering characteristics including the page's look-andfeel and context-specific behavior (for example, content can be optimized for printing versus display in a regular browser or in an e-mail). Warning: Never call any classes in this package from model code. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
50
Contents
Architectural Overview Root Application Modules (Database Session and Transaction State) Servlet Session Oracle Applications User Session Page Context Request State Persistence Model ("Passivation") Application Module Pooling
Architectural Overview
Figure 1 provides a conceptual application developer's view of the OA Framework state management components (it is not intended to reflect all internal OA Framework details). Each component shown in the illustration is discussed below. Figure 1: OA Framework primary state management components
51
OA Framework, a database session is associated with a JDBC connection). The root application module is the backbone of any OA Framework module because the core application data (as stored in BC4J view objects, entity objects, and so on) and the page's web bean hierarchy is automatically cached on the root application module's oracle.apps.fnd.framework.OADBTransaction object. Warning: The use of the browser Back button can cause the loss of application module state. Be sure to review the advanced topic Supporting the Browser Back Button before you start coding. Note that the OA Framework coding standards published in Chapter 8 also include specific recommendations for dealing with this. Any data stored on the transaction is accessible to all pages that share the same root application module instance (assuming that navigation between them involves retaining this application module as described below). The OA Framework provides methods that you can use to store, retrieve and remove custom application values to/from a transaction. Since a single transaction can be accessed from both controller (client) and model (server) code, these utilities are provided in both the oracle.apps.fnd.framework.webui.OAPageContext (for the controller) and OADBTransaction (for the model) classes.
Note: The OA Framework never releases application modules during form submit (POST) requests (unless you explicitly release the application module in a controller). So, for example, if a user sorts a table or navigates the result set within a table -- two actions that implicitly submit the page form -- the page's root application module instance is automatically retained. Retaining the Application Module Across Pages The default behavior as described above is desirable for individual pages that comprise an isolated, complete task, however, it is not appropriate for a multipage flow that implements a single task, or a series of related 53
pages participating in a virtual transaction. In these cases, the different pages should be associated with the same root application module instance. Figure 3: Conceptual illustration of related pages sharing a root application module (and transaction)
To achieve this, you must do the following: Declaratively associate the same root application module type with each page in the multipage flow (see Implementing the View for additional details on specifying this page property in JDeveloper) Set the application module retention flag for a page by specifying the URL parameter retainAM=Y. For GET requests, this flag is evaluated when a new page is rendered (as mentioned above, the OA Framework always retains the application module for POST requests regardless of the retainAM parameter value). If set to "Y," the previous page's application module instance will be retained. If set to "N" (or not specified, which implies "N"), the OA Framework releases all application modules -including any that might have been explicitly retained before reaching this point. You also set this parameter when calling JSP forward OAPageContext methods. See Implementing the Controller for additional details on controlling this programmatically. Warning: It is not enough to simply associate the same root application module with each page. If you forget to set the retainAM flag, each page will have a different application module instance -- and transaction -- even though they are associated with the same application module type. Note: Technically, depending on the state of the application module pool, Page B could get a reference to the same physical application module instance that Page A used, however, the object's state will be completely reset as if created anew. For the purposes of this discussion, you can safely consider it a "new instance." Figure 4: Conceptual illustration of two pages referencing the same root application module type, but the Retain AM flag is not properly set
54
Similarly, if you set the retainAM flag to "Y" -- but associate a different root application module type with each of the page -- you will accumulate several different application module instances (one for each page), each with its own transaction. Conditionally Retaining/Releasing an Application Module In some situations, you need to make a conditional determination about whether an application module should be released or not. In these cases, you can implement the oracle.apps.fnd.framework.webui.OAReleaseListener interface for individual application modules as described in the Javadoc. Warning: Oracle Applications developers should not use this interface without first alerting the OA Framework development team. The incorrect use of this interface can lead to inadvertent memory leaks, and the OA Framework team is currently tracking all implementations. Explicitly Releasing an Application Module There are also times when you will want to explicitly release a root application module before the OA Framework would do this normally. Specifically, if you call the OAPageContext.releaseRootApplicationModule() method in one of your page's controllers, the OA Framework will release the page's root application module as soon as it finishes rendering the page instead of waiting until the next application module request.
Multipage Flow
When navigating between related pages that perform different tasks associated with the same business object (even if the pages present different commit points to the user), you should retain the application module if the pages are closely associated in the UI. For example, a module that lets you query, view, update, delete and print purchase orders would benefit from application module retention. If you have a multipage flow with a branch transaction (for example, you need to create a supplier while creating a purchase order), you should retain the application modules in the main purchase order flow and use the OAPageContext.releaseRootApplicationModule method in the Create Supplier page.
Note: Before passivation and JDBC connection pooling/harvesting was introduced in OA Framework release 11.5.57, developers were urged to release the application module with greater frequency because it was expensive to hold on to the JDBC connections. This is no longer a consideration if you are leveraging the passivation feature.
Servlet Session
As mentioned in the JSP Application Primer, a servlet session is a mechanism for maintaining state between HTTP requests during a period of continuous interaction between a browser and a web application. A session may be initiated at any time by the application and terminated by the application, by the user closing the browser, or by a period of user inactivity. A session usually corresponds to an application login/logout cycle, but that is not strictly true in the case of OA Framework applications (see the Oracle Applications User Session below). You have the option of caching small, Serializable objects (the OA Framework restricts this to Strings, Numbers and Dates) on the servlet session; any data that you cache is accessible to all pages rendered within the session. For example, you might want to use this approach if you want to user information that is too expensive to retrieve from the database each time it is required. Note: The session cache should be used only when you need to set and access simple values in many pages with different root application modules (so the transaction cache discussed above isn't an option). You must remember that servlet session data is never cleared (while the session is active) and must be explicitly removed. For this reason, the session should be considered a last choice for caching since there is no good event point for freeing memory if the user simply abandons the session without logging out. Tip: Experienced JSP developers may wonder why hidden form fields aren't recommended instead. Due to the way that OA Framework currently implements menus (some menu selections issue a GET instead of a POST), it is not always possible for you to add values to the corresponding request when a user navigates by making a menu selection (and root application module boundaries are crossed). If you want to store, retrieve and remove values from the servlet session, see the OAPageContext put*(), get*() and remove*() methods for session values.
session (the servlet session should time-out sooner). An Oracle Applications user session might be associated with multiple servlet sessions (if, for example, the servlet session times out while the user takes a phone call in the middle of creating an OA Framework expense report, and then resumes work before the Oracle Applications user session times out). A servlet session might be associated with multiple Oracle Applications user sessions (if, for example, a user logs out and then back in again without closing the browser window). If the Oracle Applications user session times out, as long as the user does not close the browser window (so the browser session-based cookie isn't lost) and no one deletes the corresponding session row in the ICX_SESSIONS table, the user can resume her transaction at the point where she stopped working after being prompted to log back in. If you need access to any of the information stored with the Oracle Applications user session, you can obtain it from OAPageContext (in your controller code) or OADBTransaction (in your model code).
Page Context
Each time a request is received for a page, the OA Framework creates an OAPageContext that persists until a new page finishes processing (specifically, the OAPageBean -- which is the primary force behind page processing -- creates the OAPageContext).
57
In some situations, however, the request and page boundaries are not the same. Consider the following JSP Forward case: The user navigates from Page X to Page A as illustrated in Figure 5 above. While on Page A, the user selects a control that the Page A code must evaluate before deciding which page to display in response. So, the browser issues a request to Page A which the OA Framework processes (including creating an OAPageContext for the page). Once Page A finishes processing, we've reached the first page boundary as illustrated in Figure 6 below. Within the Page A code, the developer evaluates which control the user selected and issues a JSP 58
Forward to Page B. Instead of providing an HTTP response at this point since we don't want to redisplay Page A, the OA Framework begins processing for Page B (including creating a new OAPageContext for this page). Once Page B finishes processing, we've reached the second page boundary. Since Page B must now be displayed to the user, an HTTP response it sent to the browser. We've now reached the request boundary. Figure 6: Conceptual illustration of request and page boundaries differing in the JSP Forward case
It is important to understand this distinction for several reasons: Request parameters exist throughout the life span of the request -- which can span multiple page boundaries. This can be somewhat surprising for new OA Framework developers who simply assume that a request and a page are the same thing, and therefore do not account for request parameters "hanging around" after performing a JSP Forward. Consider the following example: A user selects a link in Page X that navigates to Page A. The Page A URL includes the parameter foo=bar. Page A issues a JSP Forward to Page B. Now, even though we are in a new page, the request still includes the value foo=bar. If you don't want a parameter value on the request after doing a JSP Forward, you must explicitly replace it (note that you cannot actually remove parameters from a request). For example, in this case, you can simply reset the value to something like foo=X when you call the OAPageContext's setForward*() method. Tip: It is preferable to replace the unwanted parameter value with a new one that your code can use as an "ignore" value. Do not simply set the value to "". Since there isn't a one-to-one mapping between the page context and the request, some people find it 59
a bit confusing that you access request parameters from the OAPageContext. Just remember that each page is a distinct entity, and from its "point of view," the OAPageContext represents the request. When you get into the details of passivation in Chapter 6, you'll see that page and request boundaries are distinct event points with different passivation implications.
Request
Although short-lived, an object is created for each HTTP request. This object contains the following application state: Any URL parameters, regardless of whether the browser issued a POST or a GET request Assuming the browser issues a POST request: any form field data values (for example, the data a user enters into a text field or the data a developer stores in a hidden field) Assuming the browser issues a POST request: the web bean and event names associated with a user's selection of action/control components (for example, if the user selects a "Go" button to execute a query, the request includes the web bean name of this button so you can ascertain that it was pressed and respond accordingly) To access any of these request values, use OAPageContext getParameter*() methods (you will not interact directly with the request itself). To put values on the request (the preferred way of communicating between pages) you can do any of the following. See Implementing the View and Implementing the Controller for additional information about working with request parameters.
URL programmatically on web beans that have associated URLs. Warning: The URL is space-constrained; you should be cautious about adding numerous URL parameters, particularly if they are lengthy. Since the URL is visible to users, you should also encrypt any sensitive values as described later in Chapter 3.
Architectural Overview and Application Module Pooling in this topic. Figure 7: Conceptual illustration of application module pool
62
Contents
Designing Model Objects Recommended Build Approach Business Components Packages Entity Objects Entity Associations (Association Objects) View Objects and View Rows View Links Application Modules Entity Objects, Entity Experts, "Validation" Application Modules and "Validation" View Objects Validation View Objects (VVOs) Validation Application Modules (VAMs) Entity Experts
Prerequisite Reading
This document assumes that you have read the following in the OA Framework Developer Guide: Building "Hello, World!" JSP Application Primer Anatomy of an OA Framework Page OA Framework State Management
63
In general, to enable reuse at the layer boundaries, objects can reference down the dataflow stack, but not up. Model code should never reference controller code directly. For example, view objects and application modules should not call methods in your UI controllers, and entity objects should not reference UI application modules and view objects (as discussed a bit later, however, you will see that entity objects can and do make use of server-side validation application modules and view objects). Never reference/import any server-side implementation classes or interfaces on the client-side (in other words, classes/interfaces which are in the oracle.apps.fnd.framework.server package). For example, you should not call methods on an oracle.apps.fnd.framework.OADBTransaction in your UI controller. If you need the server code to do some work for you, always route your calls through the root application module using the generic "remoteable" invokeMethod() method on the oracle.apps.fnd.framework.OAApplicationModule interface, or create an interface for your application modules so you can call typed methods whose invocation can be checked at compile time. The application module can delegate or implement the logic as required. Note: The OAApplicationModule interface is in the oracle.apps.fnd.framework package, so it does not violate the rule stated in the first sentence of this paragraph. All classes, interfaces and exceptions in the oracle.apps.fnd.framework package can safely be used in both client and server code. Note: If you opt to create an interface for your application module instead of using invokeMethod(), you should create this interface in the package directory immediately above your implementation. For example, the EmployeeAM interface for the oracle.apps.fnd.framework.toolbox.labsolutions.server.EmployeeAMImpl application module should be created in the oracle.apps.fnd.framework.toolbox.labsolutions package. Never include JDBC or other server-side processing directly in your client code. Again, if the UI client needs information from this server it should ask the application module, which can delegate or implement the request appropriately.
Chapter 8: OA Framework Naming / File / Package / Directory Structure Standards Chapter 8: OA Framework Model Coding Standards
Entity Objects
This introduces the basics of entity object creation/usage. See Java Entity Objects and PL/SQL Entity Objects in Chapter 5 for additional information about working with these objects. As described in Anatomy of an OA Framework Page, an entity object implements the business rules for a given table, view or snapshot. Entity objects are intended to be used in many clients (not just an OA Framework UI), and as such, should consolidate all of the relevant validation/behavior for the table. Each table should have at most one entity object. 65
Entity objects should include attributes for all columns in its table. You can subclass your own common entity objects (for example, see the Advanced Model Development Topics in Chapter 6 to learn how to create polymorphic entity objects that extend a common base class). You will commonly add object initialization, attribute validation, entity-level validation, and other functional behaviors to your entity objects. You can also create "entity expert" singletons to perform work shared by multiple related entity objects in a composite business object (like a purchase order which has a header, lines and shipments). Other referencing entity objects can also use the entity expert to perform lightweight validations (for example, a purchase order might ask a supplier's entity expert if a supplier id that it wants to reference is valid). Entity experts are discussed further below. Finally, you can create server "helper" objects and interfaces as needed to create modular code. For example, as illustrated in the OA Framework ToolBox Tutorial, you could create one or more helper objects to perform processing on multiple entity object types.
Declarative Implementation
For additional information about Entity Object Wizard properties not specifically described here, please see the JDeveloper documentation. Note that you can access context-sensitive Help while in any of the BC4J wizards by selecting the F1 key on your keyboard. To create a new entity object in a Business Components (BC4J) package: 1. In the JDeveloper Navigator, select the BC4J package where you want to create your entity object. 2. From the main menu, choose File > New to open the New Object Gallery. 3. In the Categories tree, expand the Business Tier node, and select Business Components (BC4J). 4. In the Items list, select Entity Object to open the Entity Object Wizard. Note that you can also right-click on the BC4J package and select New Entity Object to navigate directly to the Entity Object Wizard. 5. In the Name page (Step 1 of 5): Specify the entity object's Name in accordance with the OA Framework File / Directory / Package Structure standards. Verify that you have selected the right BC4J Package. Do NOT enter a value in the Extends Entity Object field unless you are deliberately subclassing one of your own entity objects. To improve the wizard's performance, specify a Schema Object (the exact name of the table for the entity object) as shown in Figure 2. You do not need to check the Synonyms or Tables checkboxes. Select Next to proceed. Figure 2: Entity Object Wizard Name Page (Step 1 of 5)
66
2. In the Attributes page (Step 2 of 5), you should see all the columns in the table that you specified in the Name page. Since you should include all of the table's columns, do not remove any entity attributes. Note that you can select New... to create a transient attribute that is used in the business logic (for example, a calculated OrderTotal in a purchase order that is used for approval checking). Alternatively, if you want to display a calculated value for an entity object that isn't really relevant to the business logic itself (it is very UI-specific), you can always create an attribute for it in the view object as described below. 3. Select Next to proceed. Figure 3: Entity Object Wizard Attributes Page (Step 2 of 5)
67
4. In the Attribute Settings page (Step 3 of 5), verify or set the following information for each of the entity object's attributes: The Attribute and Database Column Name and Type properties default correctly from the table definition. All database column attributes should have the Persistent and Queriable checkboxes selected as shown. For primary key columns, ensure that the Primary Key and Mandatory checkboxes are selected. Warning: If you fail to define your primary keys, BC4J will generate a ROWID key for you, and this can lead to problems. Be careful to correctly identify your primary keys. For columns that are never updateable, or updateable only when new, select the appropriate Updateable radio button. For columns whose values change after database triggers execute, select the Refresh After update or insert as appropriate. Never select the Unique checkbox; uniqueness checking should always be performed programmatically (the state of this checkbox has no impact on runtime behavior; BC4J uses it to create a database constraint if you generate a table from the EO wizard). The Discriminator column is used for polymorphic entity objects as described in Chapter 6 Advanced Model Development Topics. If you are using an Object Version Number column, select the Change Indicator checkbox for it. See Chapter 5 for information about this. 5. Select Next to proceed. Figure 4: Entity Object Wizard Attribute Settings Page (Step 3 of 5)
68
6. In the Java page (Step 4 of 5) page: Check the option for generating an Entity Object Class. In the Generate Methods box, opt to generate Accessors, a Create Method and a Delete Method. Select the Extends... button to verify that you will be subclassing oracle.apps.fnd.framework.server.OAEntityImpl for the Row (the entity object). 7. Select Finish to save your entity object definition and implementation. BC4J will create an XML definition file and a Java implementation file for your entity object as shown in Figure 5. Note that you can quickly view the underlying table and attributes included in the entity object by simply selecting it in the System Navigator. 8. Select your entity object, right-click and select Edit<EntityName>... Navigate to the Tuning page and check the Use Update Batching property. Set the Threshold value to 100. See the OA Framework Model Coding Standard M68 for additional information about batch DML updates, including a list of situations in which this feature cannot be used. Figure 5: JDeveloper System Navigator and Structure pane showing a selected entity object
69
70
Multilanguage "_TL" Entity Objects To create a multilanguage "_TL" entity object, follow the steps above for creating a regular entity object with following exception: change the OA Framework class that you subclass to oracle.apps.fnd.framework.server.OATLEntityImpl. See Chapter 5 for additional information about this. PL/SQL Entity Objects To create a PL/SQL entity object, follow the steps above for creating a regular entity object with one exception: change the OA Framework class that you subclass to oracle.apps.fnd.framework.server.OAPlsqlEntityImpl. See Chapter 5 for additional information about this.
Programmatic Control
For detailed information about coding entity object business logic, see Implementing Entity Objects in Chapter 5. Also see Implementing PL/SQL Entity Objects in the same chapter.
Declarative Implementation
For additional information about Association Wizard properties not specifically described here, please see the JDeveloper documentation. Note that you can access context-specific Help while in any of the BC4J wizards by selecting the F1 key on your keyboard. 1. In the JDeveloper Navigator, select the BC4J package where you want to create your association object. 2. From the main menu, choose File > New to open the New Object Gallery. 3. In the Categories tree, expand the Business Tier node, and select Business Components (BC4J). 4. In the Items list, select Association to open the Association Wizard. Note that you can also right-click on the BC4J package and select New Association Object to navigate directly to the Association Wizard. 5. In the Name page (Step 1 of 3): Specify the association's Name in accordance with the OA Framework File / Directory / Package Structure standards. Verify that you have selected the right BC4J Package. Do NOT enter a value in the Extends Association field unless you are deliberately subclassing one of your own associations. Select Next to proceed. 6. In the Entity Objects page (Step 2 of 3), specify the association's cardinality (for example, is it a one-tomany relationship?) and select the source and destination join attributes as shown in Figure 5. Select 71
the Add button to create the join (repeat as necessary for a multikey relationship). Select Next to proceed. Figure 5: Selecting source and destination entity objects and attributes in the Entity Object (Step 1 of 3) page
7. In the Association Properties page (Step 3 of 3): Check the Expose Accessor options as appropriate for the source and destination objects (an accessor lets the object get a reference to the other end of the association). Select the Composition Association checkbox if the destination object cannot exist outside the context of the source object. Note: For compositions, always check the Expose Accessor option on the destination object. Optionally enable this for the source object as required in your code. Do not select any of the other page options. 8. Select Finish to save your association. BC4J will create an XML definition file as shown in Figure 6. Note that you can quickly view the underlying relationship by simply selecting the association in the System Navigator. Figure 6: JDeveloper System Navigator and Structure pane showing a selected association object
72
Programmatic Control
Association objects have no implementation, so you will not write any code for them. In Chapter 5, we discuss how to access an entity object using an association.
objects used with complex query criteria since it would be impractical to create individual definitions for every possible query criteria combination. Finally, view objects (like any BC4J objects) can be created declaratively and programmatically. Again for performance reasons, it is always better to declaratively define the view object if you can.
Declarative Implementation
For additional information about View Object Wizard properties not specifically described here, please see the JDeveloper documentation. Note that you can access context-specific Help while in any of the BC4J wizards by selecting the F1 key on your keyboard. Note: Whenever you create a view object, always generate a view row implementation class. You should generate a view object implementation class only if you intend to write any code for the view object. Note: You can create a shared view object, which subclasses oracle.apps.fnd.framework.server.OAViewObjectImpl, that you can then subclass to create more specific behaviors. SQL View Objects To create a new view object in a Business Components (BC4J) package that is based entirely on a SQL query: 1. In the JDeveloper Navigator, select the BC4J package where you want to create your view object. 2. From the main menu, choose File > New to open the New Object Gallery. 3. In the Categories tree, expand the Business Tier node, and select Business Components (BC4J). 4. In the Items list, select View Object to open the View Object Wizard. Note that you can also right-click on the BC4J package and select New View Object to navigate directly to the View Object Wizard. 5. In the Name page (Step 1 of 7): Specify the view object's Name in accordance with the OA Framework File / Directory / Package Structure standards. Verify that you have selected the right BC4J package. Do NOT enter a value in the Extends View Object field unless you are deliberately subclassing one of your own view objects. Select Next until you get to Step 5. 6. In the Query page (Step 5 of 7): Enter your query in the Select Statement field (do not include a semicolon). Note that you must always use Oracle-style bindings (select emp_name from emp where emp_id = :1) if you expect to bind variables at runtime. Select the Test... button to verify that your query is correct. Select Next to proceed. 7. In the Attribute Mappings page (Step 6 of 7): Verify that Query Columns you defined in your SELECT match the View Attributes. If they don't match, click the View Attribute value that is in error to activate a poplist. Select the correct attribute. Select Next to proceed. 8. In the Java page (Step 7 of 7): Always check the option to generate a View Row Class (including accessors). Check the option to generate a View Object Class only if you anticipate writing any code for your view object (you can always generate this class later if you need to, or delete it if you generate it now and find later that you don't have a need for it). Select the Extends... button to ensure that you are subclassing the OA Framework classes oracle.apps.fnd.framework.server.OAViewObjectImpl and oracle.apps.fnd.framework.server.OAViewRowImpl as appropriate. If you need to correct the default values, select Browse... to open the Find Superclass window. 9. Select Finish to save your new view object. BC4J will create an XML definition file and Java implementations as shown in Figure 7. Note that you can quickly view the underlying attributes and view links by selecting the view object in the System Navigator. Figure 7: JDeveloper System Navigator and Structure pane showing a selected view object 74
At this point, you are not quite finished with the creation process. To proceed, you need to edit the view object as follows: 1. In the JDeveloper Navigator, select the view object that you just created, right-click and select Edit 75
<viewobject_name>.... 2. In the View Object Wizard, select Tuning. 3. In the Tuning page, deselect the Enable Passivation checkbox. Select OK to save your changes. Entity Object View Objects To create a new view object in a Business Components (BC4J) package that is based entirely on entity objects: 1. In the JDeveloper Navigator, select the BC4J package where you want to create your view object. 2. From the main menu, choose File > New to open the New Object Gallery. 3. In the Categories tree, expand the Business Tier node, and select Business Components (BC4J). 4. In the Items list, select View Object to open the View Object Wizard. Note that you can also right-click on the BC4J package and select New View Object to navigate directly to the View Object Wizard. 5. In the Name page (Step 1 of 6): Specify the view object's Name in accordance with the OA Framework File / Directory / Package Structure standards. Verify that you have selected the right BC4J package. Do NOT enter a value in the Extends View Object field unless you are deliberately subclassing one of your own view objects. Select Next to proceed. 6. In the Entity Objects page (Step 2 of 6): In the Available list, select the entity objects that you want to include in the view object and shuttle them to the Selected list. Indicate whether the entity objects are Read Only, and if they should be treated as a Reference (see the JDeveloper documentation for additional information about this page). Select Next to proceed. 7. In the Attributes page (Step 3 of 6) select the attributes that you want to include from the Available list and shuttle them to the Selected list. Select Next to proceed. 8. In the Attribute Settings page (Step 4 of 6), verify that the default information is correct. Select Next to proceed. 9. In the Query page (Step 5 of 6): Verify that the query BC4J generated for you is correct. If not, select the Expert Mode checkbox to make the query editable. Note: For expert mode view objects, do not try to set a value in your SELECT statement for an EO attribute. For example, do not do the following (assume the "flag" column is based on an EO attribute). This will result in a locking failure since BC4J will try to compare this value with the original database value, and will complain that they are different. See Java Entity Objects for valid approaches to setting attribute default values. SELECTx pk1, y pk2, z status, 'Y' flag, .... Select the Test... button to verify that your query is correct. Select Next to proceed. 10. In the Java page (Step 6 of 6): Check the option to generate a View Row Class (including accessors). Check the option to generate a View Object Class only if you anticipate writing any code for your view object (you can always generate this class later if you need to, or delete it if you generate it now and find later that you don't have a need for it). Select the Extends... button to ensure that you are subclassing the OA Framework classes oracle.apps.fnd.framework.server.OAViewObjectImpl and oracle.apps.fnd.framework.server.OAViewRowImpl as appropriate. If you need to correct the default values, select Browse... to open the Find Superclass window. 11. Select Finish to save your new view object. Once you have created an entity object-based view object, you must edit it to tune its passivation properties as described above. For example, for a view object used to update entity objects, the Passivation option 76
should be checked in the Tuning page. See Chapter 6 OA Framework State Persistence Model (Passivation) for additional information about this. Hybrid View Objects (Expert-Mode View Objects) You can also create view objects that are based on entity objects, and include SQL attributes. In this case, create the view object as described in the entity object case above, with a few small modifications: In the Attributes page, select the New button to create attributes for the non-entity object values that you want to query directly. In the Query page, select Expert Mode to edit the generated SQL as needed to retrieve these "calculated" values. In the Attribute Mappings page (displayed only if you have SQL-based attributes), ensure that the Query Columns and View Attributes match. Primary Keys Per the OA Framework Model Coding Standard M39, almost all view objects require primary keys. You can specify primary keys declaratively when defining attributes, or you can set them programmatically by calling setKeyAttributeDefs() on OAViewObjectImpl.
Programmatic Control
Query Handling Each view object implements its own search, and if necessary, should be capable of "translating" incoming parameters to bind variables and WHERE clause phrases. As a general coding practice, all methods that perform this work should be named initQuery() or some descriptive variant like initNewEmployeesQuery() if you need multiple "init" methods. Note that you must also use "Oracle-style" binding ( FOO >= :1 ) instead of ANSI-style binding ( FOO >= ? ). Although the code is a little more complex, the OA Framework team plans to desupport the ANSI-style bindings in 11ix. The following example illustrates how to modify a WHERE clause and bind search criteria based on the values passed to the initQuery method. // Initialize and execute the query public void initQuery(String name, String onHold, String number) { StringBuffer whereClause = new StringBuffer(100); Vector parameters = new Vector(3); int clauseCount = 0; int bindCount = 0; setWhereClauseParams(null); // Always reset if ((name != null) && (!("".equals(name.trim())))) { whereClause.append(" NAME like :"); whereClause.append(++bindCount); parameters.addElement(name + "%"); clauseCount++; } if ((number != null) && (!(""Equals(number.trim())))) { Number supplierId = null; // SUPPLIER_ID is a NUMBER; datatypes should always // match, and the parameter passed to this method is a // String. try 77
{ supplierId = new Number(number); } catch(Exception e) {} if (clauseCount > 0) { whereClause.append(" AND "); } whereClause.append(" SUPPLIER_ID = :"); whereClause.append(++bindCount); parameters.addElement(supplierId); clauseCount++; } if ((onHold != null) && (!(""Equals(onHold.trim())))) { if (clauseCount > 0) { whereClause.append(" AND "); } whereClause.append(" ON_HOLD_FLAG = :"); whereClause.append(++bindCount); parameters.addElement("Y"); clauseCount++; } setWhereClause(whereClause.toString()); if (bindCount > 0) { Object[] params = new Object[bindCount]; // the copyInto() is 1.1.8 compliant which, as of 4/02/03, is required by ARU parameters.copyInto(params); setWhereClauseParams(params); } executeQuery(); } // end initQuery( ) Business Logic View objects are not an appropriate home for business logic; you should not be writing validation rules in your view objects or view rows. View Rows Although you should always create a view row as mentioned above, for the most part, you won't need to write view row code. View row code is useful in cases where you want to calculate a transient attribute value, for example, but you can't or don't want to include the logic in your query (perhaps the performance cost is too high). You can also use view row code to perform simple validations of transient attributes used in the UI, or call custom entity object methods (see the "Approve" example in the Application Module section below for additional information). Note that custom view row methods may not be accessed directly on the client. The client must first invoke a method on the application module, which delegates to the view object. The view object provides access to the view row. Furthermore, to realize the performance benefit of having the view row class, you should always call 78
the generated setters/getters (for example, setSupplier()) on the row if you need to programmatically access or set values as this is much faster than calling the generic setAttribute("<AttributeName>") and getAttribute("<AttributeName>"). For example, the Entity Object Delete Example in the Application Module section below shows how to properly retrieve a view row attribute value.
View Links
As described above, an association defines a relationship between two entity objects. Similarly, a view link defines a relationship between two view objects that BC4J uses to automatically query and coordinate the destination view object based on the current source view object. View links can be based on an association or a declarative join relationship between two view objects. For example, suppose two tables have a master-detail relationship based on a foreign key. The corresponding entity objects are related via an association, and view objects based on those entity objects can be related by a view link based on the association. View links can be very convenient, however, you should use them sparingly in the web applications pages because they cache both the master and detail records as the user navigates from one master row to the next -- and this can be expensive. In fact, you should use view links only in the following cases: When specific beans (like the HGrid) require them. When you have updateable master/detail view objects (on the same or different pages) whose underlying entity objects are related using composition, you must define a view link between them (we discuss this further in Chapter 5). When you have a read-only master and detail view object on the same page, and navigating to a master row should cause the children to query automatically.
Declarative Implementation
For additional information about View Link Wizard properties not specifically described here, please see the JDeveloper documentation. Note that you can access context-specific Help while in any of the BC4J wizards by selecting the F1 key on your keyboard. To create a new view link in a Business Components (BC4J) package: 1. In the JDeveloper Navigator, select the BC4J package where you want to create your view link. 2. From the main menu, choose File > New to open the New Object Gallery. 3. In the Categories tree, expand the Business Tier node, and select Business Components (BC4J). 4. In the Items list, select View Link to open the View Link Wizard. Note that you can also right-click on the BC4J package and select New View Link to navigate directly to the View Link Wizard. 5. In the Name page (Step 1 of 6): Specify the view link's Name in accordance with the OA Framework File / Directory / Package Structure standards. Verify that you have selected the right BC4J package. Do NOT enter a value in the Extends View Link field unless you are deliberately subclassing one of your own view objects. Select Next to proceed. 6. In the View Objects page (Step 2 of 6), select the Source and Destination view objects. Select Next to proceed. 7. In the Source Attributes page (Step 3 of 6), specify the join attribute or association object of the source object (if available) as shown in Figure 8. Select Next to proceed. Figure 8: View Link Wizard showing use of an association to obtain the source view object join attribute
79
8. In the Destination Attributes page (Step 4 of 6), specify the join attribute or association of the destination object. Select Next to proceed. 9. In the View Link SQL page (Step 5 of 6), review the WHERE clause that BC4J is going to create for you to ensure that it is correct. Tip: If there are no primary keys specified in the source and destination view objects, BC4J cannot properly create a WHERE clause. If these fields are disabled, check your view object definitions. Figure 8: View Link Wizard showing a generated WHERE clause
80
10. In the View Link Properties page (Step 6 of 6,) specify the cardinality between the view objects and indicate whether you want to generate accessors from the source to the destination and vice versa. 11. Select Finish to create your view link. BC4J will create an XML definition file as shown in Figure 9. Note that you can quickly view the underlying relationship by selecting the view link in the System Navigator. Figure 9: JDeveloper System Navigator and Structure pane view of a selected view link
81
Programmatic Control
View links have no implementation, so you will not write any code for them. In Chapter 5, we discuss how to access a view object using a view link.
Application Modules
This introduces the basics of application module creation/usage. See Application Modules in Detail in Chapter 5 for additional information about working with these objects.
Objects, Entity Experts, "Validation" Application Modules and "Validation" View Objects topic below for additional information.
Declarative Implementation
For additional information about Application Module Wizard properties not specifically described here, please see the JDeveloper documentation. Note that you can access context-specific Help while in any of the BC4J wizards by selecting the F1 key on your keyboard. Create a New Application Module Note: You can create a shared application module that subclasses oracle.apps.fnd.framework.server.OAApplicationModuleImpl which you can then subclass to create more specific behaviors. To create a new application module in a Business Components (BC4J) package: 1. In the JDeveloper Navigator, select the BC4J package where you want to create your application module. 2. From the main menu, choose File > New to open the New Object Gallery. 3. In the Categories tree, expand the Business Tier node, and select Business Components (BC4J). 4. In the Items list, select Application Module to open the Application Module Wizard. Note that you can also right-click on the BC4J package and select New Application Module to navigate directly to the Application Module Wizard. 5. In the Name page (Step 1 of 5): Specify the application module's Name in accordance with the OA Framework File / Directory / Package Structure standards. Verify that you have selected the right BC4J package. Do NOT enter a value in the Extends Application Module field unless you are deliberately subclassing one of your own application modules. Select Next until you get to Step 4. 6. In the Java page (Step 4 of 5), deselect the Generate Java File(s) checkbox ONLY if you are certain that you won't be writing any code for your application module (you can always delete the class later if you find that you don't need it, so it's probably best to simply generate it at this point unless you are creating a simple container for LOV view objects). If you do want to generate an implementation class for your application module, select the Extends... button to verify that you will be subclassing oracle.apps.fnd.framework.server.OAApplicationModuleImpl. 7. Select Finish to create your application module. BC4J will create an XML definition and implementation file as shown in Figure 10. Note that you can quickly view the underlying contents by selecting the application module in the System Navigator. Figure 10: JDeveloper System Navigator and Structure pane view of a selected application module
83
At this point, you are not quite finished with the creation process. To proceed, you need to edit the application module as follows: 1. In the JDeveloper Navigator, select the application module that you just created, right-click and select Edit <appmodule_name>.... 2. In the Application Module Wizard, select Properties. 3. In the Properties page, create a passivation property as described in OA Framework State Persistence Model (Passivation). For example, the most common application module passivation configuration involves setting the application module's Retention Level to MANAGE_STATE. To do this: 1. Type RETENTION_LEVEL in the property Name field. 2. Type MANAGE_STATE in the property Value field. 3. Select Add to create the property. 4. Finally, while you are still in the application module wizard, navigate to the Tuning page. Verify that the Customize Runtime Instantiation Behavior checkbox is checked, and the Lazy Loading radio button is selected (note that you should also review Application Modules in Detail for a detailed description of the Lazy Loading feature and several use case considerations). 5. Select OK to save your changes. Genterate an Application Module Interface If you want to generate an application module interface so you can invoke typed methods directly (with compile-time checking) instead of calling invokeMethod(), you must first create the methods that you want to expose to the client. Then: 1. In the JDeveloper Navigator, select the application module that you just created, right-click and select 84
Edit <appmodule_name>.... 2. In the Application Module Wizard, select Client Methods. 3. Select the methods you want to be able to invoke remotely in the Available list and shuttle them to the Selected list. 4. Select OK to create your interface. JDeveloper automatically creates an interface in the correct package and with the correct name per the OA Framework File Standards. Add View Objects Tip: When you create a view object for a particular purpose, immediately add it to the appropriate application module so you don't forget to do it later. All view objects are used in the context of a given application module. Starting with release 11.5.10, view objects are instantiated on an "as needed" basis (in previous releases, BC4J instantiated all the view objects associated with a given application module when the application module was created). For example, if you write code to find a specific view object so you can query it, or a UI page renders with items bound to view object attributes, BC4J automatically instantiates the necessary view objects. If a view object that is associated with an application module is not required at runtime, it is not instantiated. To create this relationship declaratively for a given view object and application module: 1. In the JDeveloper Navigator, select the application module that you just created, right-click and select Edit <appmodule_name>.... 2. In the Application Module Wizard, select Data Model . 3. In the Data Model page, select the view objects that you want to include from the Available View Objects list and shuttle them to the Data Model list. 4. Optionally change the default view Instance Name. A single view object can be added to the same application module multiple times (for example, you could perform the same query in multiple regions within the same UI task/module). Each view object instance has a unique identifier; this unique identifier is the Instance Name. When you add a view object to an application module, BC4J creates the default instance name by appending an integer to the view object's name as shown in the Figure 11. To edit this value, simply select the view object in the Data Model list and make your changes in the updateable field below the list. Figure 11: Application Module Wizard Data Model page showing a default view Instance Name
85
Note: To add a detail view object (accessed via a view link) to the application module, follow these steps in the Edit Application Module dialog. You must adhere to these instructions to properly access the detail view object; it's not sufficient to simply add the detail view object as a peer to the master view object. 1. Select the master view object in the Data Model view 2. Select the detail view object in the Available View Objects view and shuttle it to the Data Model view If you added the detail view object correctly, it will appear as shown in Figure 12. Figure 12: Application Module Wizard Data Model page showing a detail view object added to its master via a view link
86
Add Nested Application Modules You can nest application modules to any arbitrary level. Starting with release 11.5.10, nested application modules are instantiated on an "as needed" basis (in previous releases, BC4J instantiated all the nested application modules when the containing application module was created). For example, if you do a findApplicationModule , BC4J will instantiate the object. If a nested application module is never accessed, it is not created. To add a nested application module to your application module: 1. In the JDeveloper Navigator, select the application module that you just created, right-click and select Edit <appmodule_name>.... 2. In the Application Module Wizard, select Application Modules . 3. In the Application Modules page, select the application module(s) that you want to include from the Available list and shuttle them to the Data Selected list. 4. Optionally change the default application module Instance Name as described for view objects above.
Programmatic Control
You should not code business logic (validations and the like) in application modules; this should be coded in underlying entity objects instead. The application module is an appropriate place for logic that: Provides access to any associated BC4J objects. For example, in Implementing the Controller, you will see that controllers should never access view objects directly when they need to execute a query. Instead, they must invoke methods on the page's application module asking for a particular query to be executed. Performs multiple server-side actions, or spans multiple view objects as the result of a single event or method invocation. For example, code that copies all the rows from View Object A to View Object B belongs in this class. Returns server side values to the client that cannot be accessed from an OAPageContext. If, for example, your page needs a specific server value to determine if a region should be rendered or an 87
item should be read-only, the application module should provide this information. Calls special PL/SQL routines. Tip: If the PL/SQL routines are used for validation and processing of individual rows (or a set of rows), then you should use PL/SQL-based entity objects instead. See Chapter 5 for additional information about using PL/SQL entity objects. Method Naming Any application module methods that directly support the UI should be named for the corresponding UI "events." For example, if the user presses a "Create" button, the application module method should be named "create" and so on and shown in the following examples. Note: Corresponding controller invocations of all the following examples are included in Implementing the Controller. Entity Object Create Example The following example illustrates an application module method that creates and inserts a row into the SuppliersVO view object. This particular view object is based on the SupplierEOImpl entity object, so BC4J instantiates this behind the scenes when the row is created. public void createSupplier() { OAViewObject vo = getSuppliersVO(); Row row = vo.createRow(); vo.insertRow(); // As specified in OA Framework Model Coding Standards, // set the new row state to STATUS_INITIALIZED. row.setNewRowState(Row.STATUS_INITIALIZED);} View Object Query Examples This shows an application module method that queries the SuppliersVO view object using search criteria passed from the client. Public void query(String supplierName, String onHoldFlag, String supplierNumber) { SuppliersExpVOImpl vo = getSuppliersExpVO(); if (vo == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "SuppliersExpVO")}; throw new OAException("ICX", "FWK_TBX_OBJECT_NOT_FOUND", tokens); } vo.initQuery(supplierName, onHoldFlag, supplierNumber); } // end query() This example illustrates a query that initializes a page when the user navigates to it. Note the browser Back button check to ensure that a query isn't executed needlessly (see Chapter 6 Supporting the Browser Back Button for additional information). public void init(String status) { PoSimpleSummaryVOImpl vo = getPoSimpleSummaryVO(); if (vo == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "PoSimpleSummaryVO")}; throw new OAException("ICX", "FWK_TBX_OBJECT_NOT_FOUND",tokens); 88
} // Follows Back Button standard of never performing a blind query without // checking to see if this is necessary. if (!vo.isPreparedForExecution()) { vo.initQuery(status); } } // end init() Entity Object Delete Example This illustrates how to search a view object row set looking for a single selected object so the entity object can be deleted. /** * Deletes a purchase order from the PoSimpleSummaryVO using the * poHeaderId parameter. */ Public void delete(String poHeaderId) { // First, we need to find the selected purchase order in our VO. // When we find it, we call remove( ) on the row which in turn // calls remove on the associated PurchaseOrderHeaderEOImpl object. int poToDelete = Integer.parseInt(poHeaderId); OAViewObject vo = getPoSimpleSummaryVO(); PoSimpleSummaryVORowImpl row = null; // This tells us the number of rows that have been fetched in the // row set, and will not pull additional rows in like some of the // other "get count" methods. int fetchedRowCount = vo.getFetchedRowCount(); // We use a separate iterator -- even though we could step through the // rows without it -- because we don't want to affect row currency. RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter"); if (fetchedRowCount > 0) { deleteIter.setRangeStart(0); deleteIter.setRangeSize(fetchedRowCount); for (int i = 0; i < fetchedRowCount; i++) { row = (PoSimpleSummaryVORowImpl)deleteIter.getRowAtRangeIndex(i); // For performance reasons, we generate ViewRowImpls for all // View Objects. When we need to obtain an attribute value, // we use the named accessors instead of a generic String lookup. // Number primaryKey = (Number)row.getAttribute("HeaderId"); Number primaryKey = row.getHeaderId(); if (primaryKey.compareTo(poToDelete) == 0) { row.remove(); getTransaction().commit(); break; // only one possible selected row in this case } 89
} } deleteIter.closeRowSetIterator(); } // end deletePurchaseOrder() Custom Action Example ("Approve") This illustrates how to search a view object row set looking for a one or more selected objects to call a custom entity object event. /** * Steps through the POSimpleSummaryVO to look for selected rows. For * each selected row, this calls the approve( ) method on the * PurchaseOrderHeaderEOImpl class. */ Public void approvePurchaseOrders( ) { // To call a custom method on an Entity Object you should add a wrapper // in the VO's *RowImpl class (see // oracle.apps.fnd.framework.toolbox.schema.server.PoSimpleSumaryVORowImpl). OAViewObject vo = getPoSimpleSummaryVO(); PoSimpleSummaryVORowImpl row = null; int matches = 0; // This tells us the number of rows that have been fetched in the // row set, and will not pull additional rows in like some of the // other "get count" methods. int fetchedRowCount = vo.getFetchedRowCount(); // We use a separate iterator -- even though we could step through the // rows without it -- because we don't want to affect row currency. RowSetIterator approveIter = vo.createRowSetIterator("approveIter"); if (fetchedRowCount > 0) { approveIter.setRangeStart(0); approveIter.setRangeSize(fetchedRowCount); for (int i = 0; i < fetchedRowCount; i++) { // For every row with a selected checkbox, we want call // the approve( ) wrapper on the POSimpleSummaryVORowImpl which // in turn calls the approve ) method on the PurchaseOrderHeaderEOImpl. row = (PoSimpleSummaryVORowImpl)approveIter.getRowAtRangeIndex(i); // For performance reasons, we generate ViewRowImpls for all // View Objects. When we need to obtain an attribute value, // we use the named accessors instead of a generic String lookup. // String selectFlag = (String)row.getAttribute("SelectFlag"); String selectFlag = row.getSelectFlag(); if ("Y"Equals(selectFlag)) { row.approve( ); matches++; } 90
} } approveIter.closeRowSetIterator(); // If the user didn't actually select any rows, display an error message. If (matches > 0) { getTransaction().Commit(); } else { throw new OAException("ICX", "FWK_TBX_T_SELECT_FOR_APPROVE"); } } // end approve() Commit Example /** * Provides a "commit" wrapper so UI controller code doesn't need to * get a handle to the transaction itself which is a violation of the * client/sever tier separation rules. */ Public void apply() { getTransaction().Commit(); } // end apply()
Entity Objects, Entity Experts, "Validation" Application Modules and "Validation" View Objects
For detailed information about using entity objects, entity experts, validation application modules and validation view objects together, see Chapter 5. This section simply introduces the objects and the roles they play in an application.
Implementation From an implementation standpoint, "validation" view objects are no different from "regular" view objects; they are differentiated only by the use case. That said, however, you should always disable passivation for these view objects which should never have associated state and should always be recreatable (again, see the OA Framework Model Coding Standards).
Entity Experts
The "entity expert" is a singleton defined to be a special affiliate of a business object (either the top entity object in a composition, or a standalone entity object). It includes common code called by the owning business object, or simple validation routines called by other entity objects that don't want the cost of instantiating the entity object itself. For example, a PurchaseOrderHeaderEOImpl class doesn't want to instantiate a whole SupplierEOImpl class just to find out if the supplierId foreign key it's about to set is valid. Instead, it can call an isSupplierIdValue(Number supplierId) method on the supplier's entity expert singleton -- a much lighter weight operation. Implementation To create an entity expert, first create a class that extends oracle.apps.fnd.framework.server.OAEntityExpert. The class should be named and packaged according to the standards published in the OA Framework File / Package / Directory Structure standards. Second, you need to associate this class with an entity object: Note: For composition business objects, associate the expert with the top-level object. Otherwise, simply associate it with the standalone entity object. 1. In the JDeveloper System Navigator, select the entity object to which you want to attach the expert. Right-click and select Edit <EntityOjectName>... 2. Navigate to the Properties page to create a new property with the following characteristics: Set the Name to ExpertClass. Set the Value to the fully qualified name of your expert class. For example: oracle.apps.fnd.framework.toolbox.schema.server.PurchaseOrderEntityExpert. 3. Select Add to create your property. 4. Select OK to save your changes. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
92
Contents
Designing the User Interface Pages Reusable Components Attribute Sets URL Parameters: Tokens, Encryption, Encoding Style Sheets Accessibility Internationalization Model Interaction Menus and Page Security
Prerequisite Reading
This document assumes that you have read the following in the OA Framework Developer Guide: Building "Hello, World!" JSP Application Primer Anatomy of an OA Framework Page OA Framework State Management Implementing the Model
Designing Mobile Applications The OA Framework supports deployment of specially designed applications on wireless platforms (initially, PDA handheld devices like a Palm Pilot). For information on designing, building, testing and deploying mobile applications, see the Mobile Applications document in Chapter 4. Note that you should continue reading about OA Framework development basics as this information applies to mobile development as well.
Pages
The basic steps for creating pages, regions and items are outlined in Chapter 2: Building "Hello, World!", and in the JDeveloper OA Extension Help. For information about implementing featurespecific regions and items, see Chapter 4.
Form for additional information about these features. CSS Class - Indicates which cascading style sheet class to apply to the item (for many items, UIX sets this value for you automatically to comply with the BLAF UI Guidelines). This is discussed in more detail below. Rendered - Indicates whether the corresponding object is included in the web bean hierarchy, and the HTML that UIX sends to the browser for rendering. For most items, this indicates whether an item displays or not, but for some items that never actually display (like a hidden developer field), this indicates whether the object exists on the page. View Instance - For items that bind to an underlying view object for reading and writing (if needed) data, this identifies the view object instance (within the context of a containing application module) to which the item binds. View Attribute - This is the view instance's attribute to which the item binds. Admin Personalization - Indicates whether the property is system administrator personalizable. See the OA Framework Personalization Guide for additional information about personalization. User Personalization - Indicates whether the property is user personalizable. See the OA Framework Personalization Guide for additional information about personalization. Initial Value - Default value for the item (note that this can be personalized by customers). See the Defaulting topic below for additional information. Simplest Possible Expression Language (SPEL) For selected properties, the OA Framework supports the use of SPEL expressions to quickly bind the property to an underlying data source that provides the property's value. For example, you could bind the Rendered property of a button to a view object attribute to ascertain whether it should be hidden or shown when the page renders. The SPEL syntax for this property looks like: ${oa.<ViewInstanceName>.<ViewAttributeName>} Tip: SPEL is an industry-standard expression language included in the JSP Standard Tag Library (JSTL). If you're interested in learning more about this (although this isn't necessary for the limited use in the OA Framework), searching for "simplest possible expression language (SPEL)" on the web returns numerous resources. The use of SPEL expressions is fully described in Chapter 4's Dynamic User Interface.
Reusable Components
One of the key advantages of the declarative OA Component development environment is the ease with which you can reuse common page, region and item definitions. See the Reusable Region Example in this chapter to see how a common module with its own logic and application module is created and used.
Shared Regions
Comply with Reuse Standards If you want to create a shared region, you must comply with the following standards. Note: A shared region can include one or more subregions. The top-level (shared) region must be saved in its own XML file. You can design your shared region to accept values from a using region. Values may be passed on the request using any of the approaches described in OA Framework State Management, or as a cached value on the page's transaction (also described in the State Management document). The shared region must be implemented to fail gracefully. For example, if appropriate parameters are not passed from a using region, the shared region should set acceptable defaults or raise a meaningful (and documented) exception. If the region scope is set to Public (see Create a Shared Region below for additional information about this): The top-level region must have its own application module. The application module should include only those view objects that are relevant for the shared region. The top-level region must have its own controller. You may associate additional controllers with 95
subregions as necessary. The shared region must be fully documented as described below. Create a Shared Region To create a shared region : 1. In the JDeveloper Navigator, select the OA Project where you want to create your region. 2. From the main menu, choose File > New to open the New Object Gallery. 3. In the Categories tree, expand the Web Tier node, and select OA Components. 4. In the Items list, select Region to open the New Region window. 5. Enter a Name and a Package in accordance with the OA Framework File Standards, and specify the Style of region that you want to create (select your style carefully since you cannot change it once you create the region). Select OK to save create your <Package>.<Name>.xml OA Component document. 6. Select the new region in the JDeveloper Structure pane and set the Documentation Comment property with the content described below. 7. Set the Scope property as appropriate for your planned use of the shared region. For example, for a private region to be used exclusively within the current package, select the Current Package option (note that you can limit access to just your product if you wish). Alternatively, set this to Public to let anyone use it in any page. 8. Set the other properties in your region. 9. When it is time to package and ship your shared region, you must generate the region's Javadoc-like HTML documentation using the Developer Documentation Generator Tool in JDeveloper (see Getting Started with the OA Extension > Command Line Tools for the OA Extension > About the Developer Documentation Generator Tool in the Oracle9i JDeveloper online Help for additional information). Warning: Pay strict attention to the naming standards in the OA Framework File Standards document when naming your shared region and any of its items and subregions. Since all OA components in a page must have a unique name, adherence to the naming standards will help ensure that your reusable region truly can be reused. Note: Due to naming restrictions, a single region cannot be used more than once in a page. This restriction will be removed at some point in the future. Documentation Comment Content You must add the following content t in the region's Documentation Comment property: /** * Controller for: <shared page/region name including package> * * Scope: < private (for owning product team use only -- this is the default scope), * public (for use by anyone) or oracle (for Oracle Applications development use only)> * * Usage: < describe the component's purpose and use, including any error messages that * might be raised> * * @param <object parameter 1> <object parameter 1 description and acceptable values> * @param <object parameter 2> <object parameter 2 description and acceptable values> * @param <object parameter N> <object parameter N description and acceptable values> * @see <optionally include references to other objects such as other shared children controllers, if any> */ Note: When describing a parameter, clearly indicate whether the parameter should be passed to the region on the request, or on the application module transaction. 96
The following example illustrates appropriate content for a shared component controller: Controller for: ford.oracle.apps.xyz.webui.FordDistributorAddressRN Scope: Public Usage: Implements a localized address region for distributors. @param: distID disitributor ID which is passed on the request; required to initialize the region @param: locale locale which is passed on the request; required to correctly localize the address @param: submit passed on the request; if specified, this region will commit its changes. Extend a Reusable Region As mentioned in Anatomy of an OA Framework page, to use a shared region in your page, you simply extend it: 1. In the JDeveloper Structure pane, select the region to which you want to add the shared region. 2. Use your right mouse button to select New > Region from the context menu. 3. Place your cursor in the new region's Extends field in the Property Inspector and select the ... button to open the component browser. Search or browse as you prefer, select the region you want to extend from the results list and select OK to make your choice. 4. JDeveloper enters the fully qualified name of the shared region in the Extends field (for example, /oracle/apps/fnd/framework/toolbox/tutorial/webui/PoSummaryRN). Note that you can edit most of the properties of the base region that you created (you can't change its Style), but the extended region cannot be modified. In fact, its contents render with a gray font in the Structure pane and in the Property Inspector. 5. Save your work. Tip: When you add a shared region with its own application module to your page, the OA Framework automatically nests the component application module beneath your root application module. You don't need to create any explicit design-time relationships between these application modules. To clear an extension, place your cursor in the Extends field and select the Property Inspector's Set to Default toolbar button. Special Case: List of Values (LOV) Although the implementation steps are described elsewhere (see the Search and Drilldown to Details Example at the end of this chapter, and the List of Values topic in Chapter 4), it's worth noting that the LOV can be implemented as a special kind of shared region (you can also create a single-use LOV): You create a reusable List of Values using the same procedure as you would for any other other shared region, although it does not require an associated controller. When you want to use the shared LOV in a page, you do not extend it as described above. Instead, you set the base page field's External LOV property and configure the data exchange between the base page and the LOV.
Shared Pages
A page is really just a shared region whose top-level region happens to be designated as a pageLayout component. As such, a shared page should follow all the region creation standards and instructions described above. If you want to reuse a standalone page or page flow, simply create a new menu function and point it to the main page (menu functions are discussed below). If you want to insert a shared page into another page flow with a different root application module, you must create a new page, and then extend the shared page's contents below the pageLayout region. Remember to set the correct root application module on your new page.
Shared Items
97
You can also extend individual items from any region, although we recommend that you place items that you intend to share in a reusable region. Sharing the containing region will help ensure that someone doesn't change properties in any arbitrary item without realizing that the change could adversely impact pages using the item. In the JDeveloper Structure pane, select the item that will extend another item. Place your cursor in the item's Extends field in the Property Inspector and select the ... button to open the component browser. Search or browse as you prefer, select the item you want to extend from the results list, and select OK to make your choice. JDeveloper enters the fully qualified name of the item in the Extends field (for example, /oracle/apps/fnd/framework/toolbox/tutorial/webui/PoSummaryRN.OrderTotal). Note that you can edit most of the extended item's properties, but you can't change its Item Style. Save your work.
Sharing Logistics
Oracle Applications product teams should produce internal ARUs to share reusable objects. For teams with a large number of sharable objects that are still changing rapidly, please contact the OA Framework team to investigate the possibility of leveraging the OA Framework daily freeze process.
Attribute Sets
Attribute sets are named, reusable collections of properties (prompt, maximum display length, data type and so on as appropriate for the attribute set type) that can be used by any type of OA component, including regions, items, and other attribute sets. They are designed to facilitate the reuse of these components throughout Oracle Applications, which yields a significant cost savings to both Oracle and its customers: Oracle saves in translation and maintenance costs. Customers can make quick, global personalizations to their applications. Additionally, fewer UI elements translates to less middle-tier memory consumption, and ultimately, this means better performance and scalability. In general terms, attribute sets are organized into OA component packages (individual XML package files), where you have one package file per database table in your application: The package name matches the underlying database table name without underscores. For example, in the OA Framework ToolBox, we have a table called FWK_TBX_PO_HEADERS. The corresponding attribute set package is named FwkTbxPoHeaders. Individual attribute sets are created for each displayable column in the table. TL translation column attribute sets are included with the base table, as are the displayable values for lookup codes (for example, if a table includes a lookup code for freight terms, the package would include an attribute set for the FreightTerms displayed value). Column-based attribute sets are named for the corresponding column. For example, in the FWK_TBX_PO_HEADERS table we have a HEADER_ID column. The corresponding attribute set is named HeaderId (this is always used in the context of the fully qualified package name as shown below, so you don't have to worry about multiple tables having HeaderId attribute sets). If there are multiple attribute sets for the same column (so the value is commonly used in several different contexts with different prompts, for example) they are differentiated with prompt suffixes as illustrated for the HeaderId case in the FwkTbxPoHeaders example below. The most common use case for the header id uses the prompt "Purchase Order." The HeaderId_Order attribute set's prompt is "Order" and the HeaderId_Num prompt is "Number." The table attribute set package may also include attribute sets for common region headers and buttons, which are named for their associated labels. Figure 1: Attribute sets in the FwkTbxPoHeaders.xml package.
98
See Creating Attribute Sets for detailed instructions if you need to create or maintain your own attribute sets.
In the JDeveloper Structure pane, select the item for which you want to specify an attribute set. Place your cursor in the item's Attribute Set field in the Property Inspector and select the ... button to open the component browser. Search or browse as you prefer, select the attribute set you want to extend from the results list and select OK to make your choice. JDeveloper enters the fully qualified name of the attribute set in the Attribute Set field (for example, /oracle/apps/fnd/attributesets/Buttons/Apply). Although you can override attribute set properties when you associate them with your items, you should avoid doing this for translated values. If you find, for example, that you need a variant of a preexisting attribute set to display a new prompt, you should create an additional attribute set as described in the Creating Attribute Sets document. Overriding something like a display width is fine. To clear an attribute set, place your cursor in the Attribute Set field and select the Property Inspector's Set to Default toolbar button. Programmatic Access to Attribute Sets You can also access attribute sets in your controller . For example, the following code shows how to obtain a translated prompt from the common Create button attribute set: import oracle.apps.fnd.framework.webui.AttributeSet; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); AttributeSet attrSet = new AttributeSet(pageContext, "/oracle/apps/fnd/attributesets/Buttons/Create"); String createPrompt = (String)attrSet.getAttributeValue(pageContext, PROMPT_ATTR); }
OAWebBeanValues.RETURN_TO_MENU_URL. {@@RETURN_TO_PORTAL} -- Can be used exactly as shown to specify the Destination URI property of an application component if you want it to return the user to a launching Portal page. If you need to specify this when performing a JSP forward, the corresponding constant for this is OAWebBeanValues.RETURN_TO_PORTAL_URL.
Encoding
Any value that you specify for a request parameter must conform to HTTP syntax rules. For example, you can't pass a URL parameter value with a blank space ; the following parameter value would cause a runtime error when the corresponding URL is accessed:buyerName=John Doe. To fix this, we encode these values, meaning that the encoding routine replaces problematic characters with standard substitutions as shown in this example:buyerName=John%20Doe. When the OA Framework adds parameters to the request (form field values, for example), it automatically encodes them. When you put parameters on the request during a call to a setForward* method, the OA Framework automatically encodes these values. When you put parameters on a URL that you assemble yourself (if, for example, you set a bean's URL by calling its setDestination method), you must encode any part of the String that could include invalid characters. To do this, you pass the String to an encode method on the oracle.apps.fnd.framework.webui.OAUrl utility class. Tip: If you manually set a URL parameter value that can't include invalid characters (for example, "value=Y") then you don't need to bother with the encoding step. When you put values on the request using OAPageContext.putParameter, you must encode the String if necessary. The OA Framework automatically decodes parameter values when you call the OAPageContext.getParameter* methods, except for the following cases: When you use the "#" character for Javascript function tokens, the OA Framework encodes the token values, but it does NOT automatically decode them when you call pageContext.getParameter("<tokenName>"). To do this yourself, you'll need to use the OAUrl decode method on the value that getParameter returns. When you call putParameter with an encoded value, the OA Framework does not decode it. You must also use the OAUrl decode method in this case on the value the getParameter returns.
Encryption
Encryption is the process of obfuscating data to make it illegible. Since URL request parameter values may be visible to the user (and hidden form field values if the user opts to view the HTML page source), you should always encrypt sensitive data if stored in a URL parameter or a hidden field. In addition to the declarative, token-based encryption described above, the OA Framework also provides methods in oracle.apps.fnd.framework.webui.OAPageContext for manually encrypting and decrypting any parameter values that you put on the request programmatically.
Style Sheets
One of the reasons why OA Framework applications have a pleasing, uniform user interface is the look and feel for each and every page is defined by the Oracle corporate Browser Look and Feel (BLAF) style sheet (blaf.xss). See the BLAF UI Guideline: Text and CSS Standards [ OTN Version ] for a quick reference to the styles.
Using Styles
All of the regions -- and most of the items -- that you add to the page have their styles set automatically; you don't need to do anything extra (nor should you). As described above, you should be setting region and item properties ONLY if you must override the default behavior. That said, there are several cases where you must set the CSS Class property for your items: If you create a staticStyledText item to be used for instruction text, you must set its CSS Class to 101
OraInstructionText. For any text entry fields, checkboxes, poplists and radio buttons you must set the CSS Class to OraFieldText. Do not use OraPromptText for your radio buttons and checkboxes. If you create a messageStyledText item for displaying read-only data, you must set the CSS Class to OraDataText for the data to render in bold (note that you don't need to set this value for table columns) Tip: New OA Framework developers often make the mistake of trying to significantly change "native" component rendering by changing the CSS style. If you find yourself falling into this trap (and you're frustrated because your style settings don't appear to have any impact on the bean's runtime appearance): Make sure you're using the right bean (region or item style) for the job. If you're certain you're using the right bean, check to see if it publishes a method that lets you achieve the desired result. For example, an oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean inherits a setSize(int size) method that lets you control the size of the header text (which is useful when rendering headers in Home page "At a Glance" regions or in side navigation "Search" regions, for example). You cannot achieve this effect by trying to set the header's CSS Class to OraHeaderSubSub as some are tempted to try after reading the BLAF specification that the beans implement.
Creating Styles
Customers The OA Framework automatically sets custom.xss to be its main style sheet. Any customizations that you have should be added to this style sheet. For detailed information about style sheets (including customization instructions), see Style Sheets. E-Business Suite Application Developers The custom.xss style sheet mentioned above includes oa.xss, which in turn includes blaf.xss. The oa.xss style sheet is intended to include any extensions that you have to the BLAF style sheet (contact the OA Framework team if you have additions that have been approved by the UI Design and Usability team). You should NOT try to create your own style sheet.
Accessibility
OA Framework applications are accessible, meaning they can be used by people with disabilities such as blindness, low-vision, color blindness and deafness. In simple terms, accessible products comply with the following guidelines: the product must be usable without a mouse (keyboard only) the product must be usable by a blind user (with a screen reader or Braille reader) there must be no reliance on sound there must be no reliance on color there must be no reliance on animation or timing To create accessible pages: Oracle Developers must follow the Oracle Global HTML Accessibility Guidelines (OGHAG). The Oracle Global HTML Accessibility Guidelines checklist is a combination of United States Access Board Section 508 Standards and Web Content Accessibility Guidelines (WCAG) that Oracle has adopted to follow. To adhere to specific standards in those guidelines, you must comply with the accessibility guidelines described in the OA Framework View Coding Standards. You must also test your product for accessibility standards compliance before shipping it. See Testing OA Framework Applications for additional information. Customers may follow the Section 508 Standards and the Web Content Accessibility Guidelines (WCAG).
Internationalization
OA Framework applications are designed be fully localized. For the most part, this is transparent to you as long as you comply with all the internationalization standards outlined in Chapter 8. Also see 102
the Internationalization document in this chapter for detailed information about language, time zone, date and number support in the OA Framework.
Model Interaction
Assuming you have specified the appropriate data source bindings, the OA Framework automatically reads data from the model for display in the view, and writes user-entered data in the view back to the model. You don't need to write a single line of code (except for any validation you want to perform in the underlying entity objects, of course).
103
1. The user selects the "Search" region's "Go" button to populate search results in the "Suppliers" table. 2. The "Search" region's controller handles the button press by invoking a search method in the root application module, which in turn delegates to the SuppliersVOImpl class so it can query itself. 3. Within the executeQuery method, the SuppliersVOImpl view object performs its SQL SELECT in the database. 4. For each row returned in our example result set, the view object instantiates a SupplierEOImpl entity object and sets its attribute values with the query results. Note: Entity object-based attribute values aren't actually stored anywhere in the view object. They "live" in the entity object, and are retrieved as needed by the view object. "Calculated" (meaning the values 104
are simply selected from a SQL statement and have no relationship to an entity object) or "Transient" view object attribute values are stored on the SuppliersVORowImpl object. See Chapter 5: Implementing Java Entity Objects for additional information about the entity object cache. 5. During page rendering (after all the query processing), the OA Framework uses the view object data bindings defined for each web bean to call the corresponding SuppliersVORowImpl object's getAttribute("<attributeName">) which in turns calls its get<AttributeName> method. 6. The SuppliersVORowImpl get<AttributeName> method in turn calls the corresponding SupplierEOImpl get<AttributeName> method to retrieve the value. For the "calculated" OnHoldDisplay attribute, the view object row retrieves the value from its own cache.
Note: The following steps assume that the entity object for the row has already been successfully instantiated and initialized (such as in the create method on the underlying view object for the page when the user originally comes into a Create page. The view object create method calls the corresponding create method on the entity object behind the scenes). 1. UIX performs onSubmit Javascript validation (required fields, data types, formats) and issues the POST request only if this validation succeeds. 2. The browser sends a POST request and the OA Framework calls the processFormData methods on all the web beans in the hierarchy as described in Anatomy of an OA Framework Page. 3. Within processFormData, the OA Framework automatically calls setAttribute(String name, Object 105
value) on the current row of the underlying view object for each bean. This executes any attribute-level validation that you've written in the view object row. 4. Within this setAttribute method, the view object row automatically calls the corresponding set<AttributeName> method in the underlying entity object. This executes any associated attribute-level validation in the entity object. 5. Once all the attribute values have been set, the OA Framework calls the view object validate for each row it modified to execute any associated row-level validation. 6. Finally, within the validate method, the view object row calls validateEntity for the underlying entity object which executes any associated entity-level validation. Note: The OA Framework automatically displays error messages for any exceptions thrown by the model layer during processFormData and does not proceed to the next phase of calling processFormRequest. See Error Handling for additional information about how the OA Framework displays error messages. Bypassing Validation As described above, the OA Framework writes model data for every form submit -- which means that all your attribute and entity level validation is executed. There are times when you need to "short-circuit" this process so errors aren't reported to the user at an inappropriate time. See Implementing the Controller: Model Interaction for specific instructions on preventing this. Defaulting When you create a new row to be used in a "Create" page as shown in Figure 3 above, you can specify default values in three places: [ Model ] If your view object is based on one or more entity objects, you can override their create() method to programmatically set attribute-level defaults. See the Java Entity Objects Create topic for additional information. [ Model ] You can also declaratively associate defaults with entity object attributes using the BC4J entity object wizard. Note that Oracle's internal E-Business Suite developers should not use this option. [ View ] Alternatively, you can set default values for individual items by setting their Initial Value property in the Oracle9i JDeveloper OA Extension. The advantage of this approach -- for static values that can be determined at design time -- is customers can easily personalize these defaults. This feature can be used with items that do, and do not, map to an underlying view object. For example, you could use this for a search criteria field even though it does not have an associated view object instance. If a default value is specified in the view (whether in the OA Extension or as personalization), the OA Framework sets the value according to the following rules: If the item has no associated view object data source, the OA Framework sets the value directly on the item when the page is rendered. If the item has an associated view object, the OA Framework sets the value when you call createRow() on your view object. The following code example shows typical code for creating a new row: public void createSupplier() { OAViewObject vo = getSuppliersVO(); // The OA Framework applies UI defaults during the scope of this // method call. Row row = vo.createRow(); vo.insertRow(); // As specified in OA Framework Model Coding Standards, // always set the new row state to STATUS_INITIALIZED // after you create it. row.setNewRowState(Row.STATUS_INITIALIZED);} Specifically, the createRow() method calls create() on each ViewRowImpl. In the scope of the create() call, the OA Framework calls the attribute setter for each UI-specified default it needs to apply. This ensures that any view row attribute validation -- and associated entity object attribute validation -- is executed as described in Figure 3 above. The OA Framework then resets the state of your view row 106
to STATUS_INITIALIZED so it appears untouched to BC4J. This ensures that users can navigate to and leave pages having only default values without being warned about the potential loss of work. Any validation exceptions detected during the defaulting process are displayed as normal. Tip: Defaults are applied once and only once when the row is created. If you have a multipage flow with regions that bind to the same underlying view object -- and each region specifies a different Initial Value for one of the view attributes -- only the default associated with the first region that renders when the row is created is applied. The others are ignored. Similarly, if you create a new row on Page A, and then navigate to Page B where you have an Initial Value set for one of its attributes, the default isn't applied because the row was created before Page B renders (note that creating a row before navigating to the page where the user actually enters values for the new row is not consistent with the recommended Back button implementation for a Create flow). Assuming defaults are using each of these three approaches, the OA Framework observes the following precedence priority: 1. (Highest) Declarative item property defaults as specified in the OA Extension or in the Personalizations module 2. Programmatic entity object attribute defaults (these are applied during the scope of the vo.creatRow() method call which in turn delegates to your entity object's create() method) 3. (Lowest) Declarative entity object attribute defaults If you want to ensure that a default value is always set regardless of what values might be specified declaratively, you can override the insertRow() method in your view object row as shown below: public void EmployeesVOImpl extends OAViewObjectImpl { ... public void insertRow(Row row) { // Always call super.insertRow() first. super.insertRow();
// Now call whatever attribute setters you need to call to ensure // that your defaults always take precedence. row.setAttribute("<attributeName>", <attributeValue>); ... } }
Within this basic model, you are free to choose from a range of valid design options based on your 107
application's complexity and expected usage patterns (when you're ready to start designing menus for your application, consult the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Tabs/Navigation [ OTN Version ] first for a detailed introduction to the various menu configurations). This menu structure serves two distinct purposes in an OA Framework application: It organizes content into meaningful units. It lets users navigate easily between these meaningful units.
Menu Implementation
Behind the scenes, an OA Framework menu is actually comprised of Oracle Applications functions and menus. Navigation Functions Navigation functions represent the individual pages within your application; each page that a user accesses at runtime is associated with a predefined function, which is used solely for the purpose of navigating through your application. Perhaps most importantly, this function includes the Web HTML Call for the page. For example, in the ToolBox Tutorial Application, when the user selects the Lesson 3 menu entry, the Purchase Order Search page is displayed. We created a function for this page, and set its Web HTML Call to point to the XML page we want to display : OA.jsp?page=/oracle/apps/fnd/framework/toolbox/webui/PoSearchPG When the user selects the Lesson 3 menu entry, the request is routed to the OA.jsp which initializes an oracle.apps.fnd.framework.webui.OAPageBean object to process the corresponding page XML file as described in Anatomy of an OA Framework page (in case you're wondering, OA.jsp is the only JSP that is invoked when accessing any OA Framework application page). Note: A single page can be called by many functions (each potentially passing different parameters through the URL), which means it can be used in many different menus. Navigation Menus Navigation menus are reusable groupings of functions and submenus that ultimately create the tab structure that we described above. Each OA Framework menu that you create has an associated Type that determines how it should be rendered. For example, the Lesson 2 tab in Figure 1 above is of type "HTML Tab." Navigation menus include all functions that can display in your application. You can also selectively grant access to individual functions within this navigation menu. This is described more fully below in the Application Security section. For detailed instructions on designing and creating OA Framework navigation menus, see Chapter 4: Tabs/Navigation.
Application Security
The features of Application security are broad; in this introductory chapter we'll touch on some key concepts so you have a general idea of what is supported as it relates to menu definitions. When you're ready to start designing your application, we recommend familiarizing yourself with these features by reviewing Page Security in Chapter 4. Users and Responsibilities An Oracle Applications reponsibility is a collection of tasks that is granted to one or more users as a set. For example, you might create a Benefits Manager and a generic Employee responsibility, each with the appropriate HR-related applications. You would then assign these responsibilities to individual users to quickly grant access to these modules. All responsibilities are associated with the single top-level navigation menu for your application. As described above, the navigation menu ultimately includes all the tabs supported by your application. Prior to 11.5.10, a responsibility was the primary mechanism for grouping users into role-based sets. You would then assign menus to responsibilities, and create security rules by excluding individual menu functions from your responsibility. At runtime, the current responsibility, organization and security group together comprised the security context. With 11.5.10, the concept of responsibility has been expanded to a more generic role. Users can belong to one or more roles. All users assigned to a particular responsibility are also assigned to a correponding role. Security rules are based on permission grants instead of function exclusion rules. At runtime, these grants 108
are evaluated for the current security context, which now includes roles (also known as a "grantee") in addition to responsibility, organization and security group. The OA Framework recommends using permissions roles and grants for your security setup instead of responsibilities and exclusion rules. Grants and Permissions In addition to creating Navigation Functions, you must also create Authorization Functions (known as "permissions") for each of your pages. You then group these permissions into a "flat" menu structure (known as a "permission set") for the purpose of granting user access to the associated pages. The simplest way to introduce the use of permission sets is by walking through a small use case. For example, assume you have a very simple Benefits application including the following four pages: Page Administer Benefits Create Benefit My Benefits Update Beneficiaries Description View, update, approve and discontinue benefits. Create a new benefit. View current benefit selections and make new selections as appropriate. Update designated beneficiaries. Benefits Manager Access? Yes Yes Yes Yes Employee Access? No No Yes Yes
As described above, you would create Navigation Functions for each of these pages and organize them into a comprehensive Navigation menu. To ensure that users have access to the right pages, you would then proceed as follows: Step 1 : Create permissions. Just like the Navigation functions, permissions are FND form functions, but in this context, they are used exclusively for application security. In our example, we can use the Navigation Functions that we created for each page as permissions. There is no need to create additional permission functions. Step 2 : Create roles or grantees. A grantee can either be a user (FND_USER), or a user group (also known as role), or "global". User identities are created in FND_USERS, and should map one-to-one with individual humans or systems. Users can belong to groups or roles that are formed by grouping organizational or position relationships modeled in products such as Human Resources. Roles are defined in WF_ROLES, and in future can map to user groups in a customer's LDAP system. Although its membership is not explicitly populated, there is a Global group which includes "everyone". You need two user roles for the example above: one that groups all managers into a manager role, and another that groups all employees. Since all employees includes everyone, you can use a Global role for this purpose. Alternately, you can create a responsibility that is assigned to all managers, and use that for your grants setup. We will discuss both the above alternatives when we proceed to Step 4 to create the grants. Step 3: Create permission sets. Permission Sets are implemented as menus, but they are exist solely to group a flat list of permissions into sets for easy access granting. Ideally, you should group permissions that are required by a role into one or more permission sets. You need two permission sets for the example above: A Manager Permission Set for all the tasks to which only managers should have access. This includes the navigation functions "Administer Benefits", and "Create Benefit". A Global permission set with permissions that are accessible by everyone. This includes the navigation functions "My Benefits" and "Update Beneficiaries". Step 4: Create Grants 109
A Grant defines security rules that allows only certain users of your system access to specific functions or pages within your application. A grant gives a grantee access to the permission sets described above. In simple terms, grants link your grantees to your permission sets. You need two grants for the example above: A Manager Grant to associate the manager permission set with the manager role. An Employee Grant that is associated with your Global permission set with a global grantee. Since this grant is associated with a global grantee (in other words, everyone) and has no additional security restrictions (in other words it is not restricted to any responsibility, organization or security group), it can also be called a global grant. In addition to specifying a grantee, you could also restict your grant further with additional security context. This includes the current user's responsibility, organization and security group. So, for example, to restrict the manager grant to a specific organization, you can associate an organization context with the grant. Instead of granting the manager permission set to the manager role, you can grant it to a global grantee. You can then restrict it to managers alone by associating a security context with the responsibility to which only managers have access. However note that the OA Framework recommends the use of role based grants instead of responsibilities. At runtime, a user is granted access to a page if the permission associated with the page is granted access to the current user's security context. The user's security context as described above includes the user's role, responsibility, organization and security group. Page Security If you look at the example above, we mention that you can link the permissions with your pages to restrict access. This is one of the cases where you need to secure the rendering of your page with a permission. Other cases where you may want to secure the rendering of your page with a permission include anonymous login pages, pages that require auto responsibility setting or switching, and shared/reusable pages. For detailed instructions please look at Chapter 4: Page Security. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
110
Contents
Designing an OA Controller Creating an OA Controller Handling an HTTP GET Modifying Bean Properties Creating Beans Programmatically Handling an HTTP POST (Form Submit) Model Interaction Disabling Validation Error Handling Javascript
Prerequisite Reading
This document assumes that you have read the following in the OA Framework Developer Guide: Building "Hello, World!" JSP Application Primer Anatomy of an OA Framework Page OA Framework State Management Implementing the Model Implementing the View
Designing an OA Controller
As described in Anatomy of an OA Framework Page, the OA Controller is where you define how web beans behave. Specifically, you write controller code to: Manipulate/initialize the UI at runtime (including any programmatic layout that you are unable to do declaratively) Intercept and handle user events like a button press Controllers should never include any kind of business logic; this belongs in your model classes.
Necessity
In general, before tackling the question of how to design your controller, it's important to consider whether you even need to create a controller. As a rule, you should write controller code only if it is absolutely essential. If you can create your page declaratively, do not instantiate regions and items programmatically. Programmatically created web beans cannot be personalized, reused or extended. Furthermore, some hard-coded layouts may fall out of compliance with the Oracle Browser Look-and-Feel (BLAF) UI Guidelines [ OTN Version ] as they evolve over time. As described in Implementing the View, all top-level regions in a shared component must have an associated controller.
Granularity
111
OA controllers can be associated with any region (any web bean that implements oracle.apps.fnd.framework.webui.beans.OAWebBeanContainer); you cannot associate controllers with items. Many new OA Framework developers wonder just "how big" a controller should be. Should you have one per page, one per meaningful region (like a "Search" region), one per complex web bean (like a table) -- or what? Unfortunately, the answer is it depends. First and foremost, in a really simple page, you might not have any controllers (there is no requirement that you create controllers if they have no work to do). If you do need to write code, you should weigh the following carefully before deciding what controllers to create: the benefits of encapsulation -- ideally, a web bean implements its own behavior component reuse -- if a component is designed to be shared, it must be self-sufficient practical code usability -- although a page comprised of eight regions could easily have eight corresponding controllers (each with a few, trivial lines of code), this "pure" object oriented approach can make code maintenance more difficult, and it can cause unnecessary file bloat in your product With that in mind, there are a few guidelines that might help the decision-making process: Never set properties on a parent/grandparent web bean from a child bean. Always define controllers so they control the regions with which they're associated, or set properties on children/grandchildren of this region. If you want a controller to manage multiple child/grandchild web beans, it should be associated with an appropriate parent/grandparent bean. For the really complex beans (like an OATableBean) you should associate a controller with the bean itself, or perhaps with a simple containing bean if it represents a logical unit of functionality. In general, you should create the fewest number of controllers per page that satisfies the rules and considerations outlined above. For a very simple page, it is very common to associate a single controller with the pageLayout region. For a more complicated page, you might create a few different controllers for meaningful functional components (for example, a searchable summary page typically has a "Search" region controller and a "Results" region controller). Shared regions should obviously have their own controller(s) as appropriate.
Modularity/Reuse
Within any group of related pages, you will typically find opportunities to reuse code. The following are all valid approaches to creating more modular controller code: You can add your own private methods to your controllers. You can create a common controller that subclasses oracle.apps.fnd.framework.webui.OAControllerImpl, and then subclass this as needed for individual pages/regions. You can create helper utility classes to which your controller code can delegate as needed. These classes are not required to subclass/implement any OA Framework classes/interfaces, and should be included in the same package(s) as the controller(s) they help. Note that static methods are a natural fit in these (often procedural) classes, and while it is appropriate to include static methods, you should consider the following: You (and more importantly, the customer) can't effectively subclass static methods. There are packaging implications related to the use of constants and static methods (see the Oracle Applications Java Coding Standards).
Thread-Safety
The OA Framework is designed to support multithreaded web bean access (although this is not yet implemented). Most of this is transparent to you, however, there are a few rules that you must follow in your controller code: If you use static methods in your controllers or helper classes, never include state. Always pass the page's OAPageContext to any web bean accessors (if there is a signature that takes an OAPageContext). For example, choose setText(OAPageContext pageContext, String text) instead of setText(String text).
State Management
112
Never add non-transient member variables to your controllers, or to helper classes if you instantiate them. The OA Framework does not passivate controller member variables, and will therefore be unable to recover these values once JVM failover is supported. You may add static final member variables.
Creating an OA Controller
To create a controller for a region: 1. Select the region in the JDeveloper Structure pane 2. Use the right mouse button to select Set New Controller... 3. In the New Controller dialog, enter the package and class names in accordance with the OA Framework File Standards. Select OK to create the controller and associate it with the selected region. Note that the Controller Class value in the property inspector is a fully qualified class name: oracle.apps.fnd.framework.toolbox.tutorial.webui.HomeSearchCO. JDeveloper creates a template controller for you with the following content. /*===========================================================================+ | Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA | | All rights reserved. | +===========================================================================+ | HISTORY | +===========================================================================*/ package oracle.apps.fnd.framework.toolbox.tutorial.webui; import oracle.apps.fnd.common.VersionInfo; import oracle.apps.fnd.framework.webui.OAControllerImpl; import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.fnd.framework.webui.beans.OAWebBean; /** * Controller for ... */ public class OrderSummaryCO extends OAControllerImpl { public static final String RCS_ID="$Header$"; public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion(RCS_ID, "%packagename%"); /** * Layout and page setup logic for a region. * @param pageContext the current OA page context * @param webBean the web bean corresponding to the region */ public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); } /** * Procedure to handle form submissions for form elements in * a region. * @param pageContext the current OA page context 113
* @param webBean the web bean corresponding to the region */ public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); } } Note: The default template does not include the processFormData(OAPageContext pageContext, OAWebBean webBean) method that is called during the first phase of POST processing. If you find that you need to use this method (a fairly uncommon scenario), you can simply add it to your controller. To copy a controller: 1. In JDeveloper, open the controller that you want to copy. 2. Select File > Save As... from the main menu. 3. In the Save As dialog, be sure to specify the right Location (Java package) and enter the File name (class name). 4. In the new controller file, remember to edit the package declaration (if necessary) and change the class name. To associate a preexisting controller with a region: 1. Select the region in the JDeveloper Structure pane. 2. Place your cursor in the Property Inspector's Controller Class field and select the ... button. 3. In the Controller Class dialog, expand the package hierarchies until you find the controller that you want to select. Select OK to make your choice. To disassociate a controller from a region: 1. Select the region in the JDeveloper Structure pane. 2. Place your cursor in the Property Inspector's Controller Class field. 3. Select the Set to Default button in the Property Inspector's Toolbar (it is not sufficient to manually clear the value from the field) as shown in Figure 1 below. Figure 1: Highlighted Set to Default button in the OA Extension Property Inspector toolbar
Note: You can also associate controllers with regions programmatically. See the setControllerClass(String javaClass) method in OAWebBeanContainer.
bean, and proceeds recursively throughout the entire hierarchy. Code that initializes your page -- or affects the web bean hierarchy in any way (by setting properties, creating web beans and so on) -- belongs in the processRequest() method. Note: The oracle.apps.fnd.framework.webui.OAWebBean parameter passed to the processRequest() method is the region with which the controller is associated. The following example is typical of the processRequest() code that you will write. It illustrates the initialization of a view-only "detail" page based on a request parameter (for a selected purchase order) passed from a "search" page. /** * Layout and page setup logic for region. * @param pageContext the current OA page context * @param webBean the web bean corresponding to the region */ public void processRequest(OAPageContext pageContext, OAWebBean webBean) { // Always call this before adding your own code. super.processRequest(pageContext, webBean); // Get the purchase order number from the request. String orderNumber = pageContext.getParameter("headerId"); // We need to set the page header text to include the PO order number for reference. MessageToken[] tokens = { new MessageToken("PO_NUMBER", orderNumber) }; // Always use a translated value from Message Dictionary when setting strings in // your controllers. String pageHeaderText = pageContext.getMessage("ICX", "FWK_TBX_T_PO_HEADER_TEXT", tokens); // Set the po-specific page title (which also appears in the breadcrumbs. Since this // controller is associated with the page layout region, simply cast the webBean // parameter to the right type and set the title. ((OAPageLayoutBean)webBean).setTitle(pageHeaderText); // Now we want to initialize the query for our single purchase order with all of its // details. OAApplicationModule am = pageContext.getApplicationModule(webBean); Serializable[] parameters = { orderNumber }; am.invokeMethod("initDetails", parameters);} // end processRequest() After calling super.processRequest(pageContext, webBean), the example code gets the value for a request parameter named "headerId" (the purchase order number the search page passed on the request). This value is then displayed in the page title and breadcrumbs as context for the user, and passed to the model so the purchase order can be queried. Figure 2: Example of a dynamically defined page title and breadcrumbs using the page title's value
115
Since all values displayed in the page must be translatable, we created a message named FWK_TBX_T_PO_HEADER_TEXT in the Oracle Applications Message Dictionary with the text "Purchase Order: &PO_NUMBER". The code defines the purchase order number as the replacement value for the token PO_NUMBER, and then obtains a translated version of this message from the oracle.apps.fnd.framework.webui.OAPageContext (which delegates to AOL/J). It then sets the translated String as the page's title. Warning: Never display a hard-coded text value in the user interface. All text values that you display programmatically must be sourced from Message Dictionary as shown. You can also use a value from a web bean that was set declaratively (all displayable bean properties are translated), or you can display a value queried from a multilanguage product table. Finally, this read-only "details" page automatically queries the given purchase order whenever it is rendered. It does this by passing the purchase order number to a method called initDetails() in the page's root application module. The application module then passes this parameter to the appropriate view object, which binds the WHERE clause parameter and executes its query. The Model Interaction section below describes this in greater detail.
} Starting with the controller region's children, the findIndexedChildRecursive(String name)method searches the entire web bean hierarchy looking for the first indexed child with a matching name. If the web bean that you want to modify is a UIX named child (or, if you're not sure whether it is "named" or "indexed"), use the findChildRecursive(String name) method instead. If you need to modify properties on the controller region, simply cast the processRequest() OAWebBean parameter to the right type and call whatever method you need (see the GET code example above for an illustration of this).
tableLayout.addIndexedChild(anotherRow); } You can also instantiate web beans that have been defined declaratively, but require a programmatic association with the parent. For example, in the following code, a stackLayout region named "HomeSearchRN" was defined in JDeveloper, but it must be added to the programmatically created side navigation component. OASideNavBean sideNav = (OASideNavBean)createWebBean(pageContext, OAWebBeanConstants.SIDE_NAV_BEAN, null, // no need to specify a data type "sideNav" // always specify name); OAStackLayoutBean search = (OAStackLayoutBean)createWebBean(pageContext, "/oracle/apps/fnd/framework/toolbox/tutorial/webui/HomeSearchRN", "HomeSearchRN", // always specify name true); // region created in Oracle9i JDeveloper OA Extension sideNav.addIndexedChild(search); Restrictions The OA Framework does not readily support the programmatic addition, removal or replacement of children to any of the "default" regions (for example, an OA Extension defaultSingleColumn region which is instantiated as an oracle.apps.fnd.framework.webui.beans.layout.OADefaultSingleColumnBean). These regions should be defined declaratively. If you absolutely must replace or remove items in a "default" region (you cannot add items), follow these steps: 1. Find the child web bean that you want to remove or replace by calling webBean.findIndexedChildRecursive(). 2. Get the child's parent web bean by calling childWebBean.getAttribute(OAWebBeanConstants.PARENT). Note: The OAWebBeanConstants.PARENT attribute is intended exclusively for OA Framework internal development use (if you look at the OAWebBeanConstants Javadoc, you'll see a warning to this effect). You may leverage this approach only for default regions due to their unique implementation; as a rule, the OA Framework Controller Coding Standards discourage modifying parent web beans from child controllers. Furthermore, the default regions have been deprecated in release 11.5.10, so you should not be using them for new development. 3. Then, perform the replace or remove on the parent bean itself.
pageContext, OAWebBean webBean) method. Assuming no exceptions were thrown during the first processing phase, the OA Framework proceeds to the second phase which involves calling processFormRequest(OAPageContext pageContext, OAWebBean webBean)on each web bean.
processFormData( )
In most -- if not all -- of the pages that you build, you will have no cause to overwrite this method. In fact, the only use case we could think of is extremely unlikely in an OA Framework application: if the data source for a region is not a view object, so the view instance and attribute properties are not defined for the individual web beans, then you could code the region's processFormData() to write the child web bean data to the appropriate data source. Note: The OA Framework implements processFormData() at the item level, but you can overwrite it only at the region level, so you must process all of the region's items if you ever implement anything like this. If you do choose to implement something like this, remember to call super.processFormData(OAPageContext pageContext, OAWebBean webBean) first.
processFormRequest( )
Any code that handles user form submit actions belongs in the processFormRequest() method. The following example is typical of the processFormRequest() code that you will write. It illustrates how to determine that a particular form submit component was selected (in this case, a "Go" button), how to initiate a query in the model code, and how to perform a JSP Forward back to the same page so web bean properties can be changed in the processRequest() method. public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { // Always call this before adding your code super.processFormRequest(pageContext, webBean); // Pressing the Go button causes the search to be executed. If (pageContext.getParameter("Go") != null) { String orderNumber = pageContext.getParameter("SearchOrder"); String created = pageContext.getParameter("Created"); String showMyOrders = pageContext.getParameter("MyOrders"); OAApplicationModule am = pageContext.getApplicationModule(webBean); // All parameters passed using invokeMethod() must be serializable. Serializable[] parameters = { orderNumber, created, showMyOrders }; am.invokeMethod("search", parameters); // Now forward back to this page so we can implement UI changes as a // consequence of the query in processRequest(). NEVER make UI changes in // processFormRequest(). pageContext.setForwardURLToCurrentPage(null, // no parameters to pass true, // retain the AM OAWebBeanConstants.ADD_BREAD_CRUMB_NO, OAWebBeanConstants.IGNORE_MESSAGES); } } // end processFormRequest(); This example shows how to pass request parameters using the setForwardUrl() method, including how to replace a pre-existing parameter value (in this case, with "X" which would be used as an "ignore" value in the target page). import com.sun.java.util.collections.HashMap; import oracle.bali.share.util.IntegerUtils; ... 119
processFormRequest(OAPageContext pageContext, OAWebBean webBean) { // Always call this before adding your code super.processFormRequest(pageContext, webBean); String poEvent = pageContext.getParameter("poEvent"); HashMap params = new HashMap(2); // Replace the current poEvent request parameter value with "X" params.put("poEvent", "X"); // IntegerUtils is a handy utility params.put("poStep", IntegerUtils.getInteger(5));
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/dem/employee/webui/EmpDetails PG", // target page null, // not necessary with KEEP_MENU_CONTEXT OAWebBeanConstants.KEEP_MENU_CONTEXT, // no change to menu context null, // No need to specify since we're keeping menu context params, // request parameters true, // retain the root application module OAWebBeanConstants.ADD_BREAD_CRUMB_YES, // display breadcrumbs OAException.ERROR); // do not forward w/ errors }
Model Interaction
In simple terms, the only model object that you should access directly from your OA controller is the application module. In other words, the only valid model import in your controller code is: import oracle.apps.fnd.framework.OAApplicationModule; You should not access view objects directly to execute queries, iterate the rowset, or interact with the underlying entity object(s). For example, the following code (although technically feasible) is incorrect according to the OA Framework Controller Coding Standards. import oracle.apps.fnd.framework.OAViewObject; ... // Get the root application module OAApplicationModule am = pageContext.getRootApplicationModule(); // Find the view object you want to query OAViewObject vo = (OAViewObject)am.findViewObject("<instanceName>"); ... Instead, if you need to execute a view object query, you should proceed as shown in the following example which illustrates handling a "Go" button press in a "Search" region. First, add a method to the containing application module (in this example, it's the page's root application module) which accepts search criteria and then delegates to the target view object for query execution (see 120
Implementing the Model for information about query execution). public void search(String orderNumber, String created, String showMyOrders) { PoSummarySimpleExpVOImpl vo = getPoSummarySimpleExpVO(); // Always check for the null condition if the VO cannot be found/created if (vo == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "PoSummarySimpleExpVO")}; throw new OAException("ICX", "FWK_TBX_OBJECT_NOT_FOUND", tokens); } vo.initQuery(orderNumber, created, showMyOrders); } // end search() Then, add button handler code like the following to your controller which invokes the correct method in the application module. Note that you should always check for an event source in your processFormRequest() code; never assume that the browser issued a POST request because your item was selected (even in a simple page with just one button, for example). Behind the scenes, the OA Framework often submits for the page form when you might not be expecting it to do this. processFormRequest(OAPageContext pageContext, OAWebBean webBean) { // Check to see if the "Go" button was pressed... if (pageContext.getParameter("gButton") != null) { // Get the search criteria String orderNumber = pageContext.getParameter("SearchOrder"); String created = pageContext.getParameter("Created"); String showMyOrders = pageContext.getParameter("MyOrders"); OAApplicationModule am = pageContext.getApplicationModule(webBean); // All parameters passed using invokeMethod() must be serializable. Serializable[] parameters = { orderNumber, created, showMyOrders }; am.invokeMethod("search", parameters); } } Tip: Whenever you call invokeMethod() on a server-side BC4J component, any parameters that you pass must be Serializable. The example above illustrates the invokeMethod() signature that expects all the parameters to be Strings. If you need to pass other object types, use the version of invokeMethod() that takes an array of parameter types. For example: Class[] parameterTypes = { String.class, Hashtable.class, Number.class ...}; am.invokeMethod("search", parameters, parameterTypes); Similarly, since the view object is the conduit to the entity object -- and you should not interact directly with view objects in your controllers -- it stands to reason that you should also route all entity object actions through an application module also. Note: As described in Implementing the Model, the methods that you add in your application module should be named for the corresponding UI "events." For example, if the user presses a "Create" button, the application module method should be named "create" and so on. Create Example processFormRequest(OAPageContext pageContext, OAWebBean webBean) { OAApplicationModule am = pageContext.getApplicationModule(webBean); 121
am.invokeMethod("create", null);} Delete Example This example illustrates invoking a delete method on a nested application module associated with a shared region as opposed to the page's root application module. processFormRequest(OAPageContext pageContext, OAWebBean webBean) { if (pageContext.getParameter("DeleteYesButton") != null) { // User has confirmed that she wants to delete this purchase order. // Invoke a method on the AM to set the current row in the VO and // call remove() on this row. String poHeaderId = pageContext.getParameter("poHeaderId"); Serializable[] parameters = { poHeaderId }; OAApplicationModule am = pageContext.getApplicationModule(webBean); am.invokeMethod("delete", parameters); } ... Custom Action Example ("Approve") processFormRequest(OAPageContext pageContext, OAWebBean webBean) { if (pageContext.getParameter("Approve") != null) { OAApplicationModule am = pageContext.getApplicationModule(webBean); am.invokeMethod("approve"); } } Commit Example processFormRequest(OAPageContext pageContext, OAWebBean webBean) { // Simply telling the transaction to commit will cause all the Entity Object validation // to fire. // // Note: there's no reason for a developer to perform a rollback. This is handled by // the OA Framework if errors are encountered during the processFormData phase. OAApplicationModule am = pageContext.getApplicationModule(webBean); am.invokeMethod("apply"); }
Disabling Validation
There are times when you need to bypass the normal validation that occurs during the OA Framework HTTP POST processing. For example, if you are implementing an "Add Another Row" button in a table, you may not want error messages to be displayed for incomplete rows when the user opts to add a new row. Similarly, you might want to defer validation in a multistep page flow until the final review and submit page, or while navigating through sub tabs presenting different views of the same underlying object.
modification code in a processRequest() method!): OASubmitButtonBean OATableBean OAAdvancedTableBean OASubTabLayoutBean OANavigationBarBean OADefaultHideShowBean OAHideShowHeaderBean Note: You can also set this declaratively by setting the component's Disable Server Side Validation property to True, and you can disable this validation for links or icon that have been configured to perform a form submit. See the Javascript URL section below for additional information. When the user performs an action on one of these beans that causes the form to be submitted, the OA Framework proceeds through all the HTTP POST processing described above -- including executing all your attribute-level validation logic (entity-level validation is not performed). If oracle.apps.fnd.framework.OARowValException or oracle.apps.fnd.framework.OAAttrValException exceptions (or their deprecated suprclasses) are thrown during processFormData(), the OA Framework simply ignores them and continues processing as if it had encountered no exceptions. Note: The OA Framework does not ignore serious exceptions (like a NullPointerException) thrown in processFormData(). These are displayed as usual, and processing does not proceed to processFormRequest(). Furthermore, any exceptions that you or BC4J throw in processFormRequest() are displayed as usual.
Error Handling
The OA Framework automatically displays any error messages thrown in the model layer; you don't need to do anything in your controller to facilitate this. See Error Handling for information about throwing exceptions in your controller code and displaying Error, Warning, Confirmation and Information messages at the top of a page. See Chapter 4: Dialog Pages for information about displaying a model Error, Warning, Confirmation, and Information dialog page.
Javascript
UIX and the OA Framework are rapidly adding new features to provide a more interactive user experience (partial page rendering, automatic table totaling, and so on). You are certainly encouraged to leverage these features as they are released, however, you should not attempt to implement them yourself before they're ready. In short, Javascript is prohibited without explicit permission from the OA Framework team. Furthermore, you must have confirmation from the corporate UI design team that a Javascript implementation is essential for your product.
Javascript URL
123
Before release 11.5.10, there was one exception to the Javascript prohibition: if you wanted to configure a link or image to submit the page form (because you need an event to handle before navigating to a new page), you could set its destination property to the UIX submitForm Javascript function With release 11.5.10, even this small amount of Javascript is prohibited. Instead, you should configure a fireAction event instead of using the Javascript URL. See the Declarative Submit Form documentation for additional information. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
124
Error Handling
Overview
This document describes how to throw OA Framework exceptions in your model and controller code.
Contents
Exception Types Exception Classes Bundled Exceptions Exception Examples Dialog Pages and Message Boxes
Prerequisite Reading
Implementing the Model Implementing the View Implementing the Controller
Related Information
Implementing Entity Objects Implementing PL/SQL Entity Objects
Exception Types
The OA Framework handles three basic types of exceptions: general, validation and severe. These types are briefly described in this section; specific exception usage instructions are provided below.
General Exceptions
Errors in the BC4J framework are handled by throwing an implicit (runtime) exception of the type oracle.jbo.JBOException. The OA Framework has its own specialization of this called oracle.apps.fnd.framework.OAException . This specialization provides a mechanism for bundling multiple exceptions together, while also translating the exception messages using Oracle Applications Message Dictionary, so that useful messages can be displayed. In any of your code, you can throw an OAException for general, page-level exceptions.
Validation Exceptions
Validation exceptions are thrown from entity objects and view objects for both row and attribute level validation failures. oracle.apps.fnd.framework.OAAttrValException - specialization of OAException used for attribute level validation failures oracle.apps.fnd.framework.OARowValException - specialization of OAException used for row (entity) level validation failures The OA Framework displays error messages to the user as follows: Attribute-level exceptions are visually indicated on the error item(s) and at the top of the page Row-level exceptions are visually indicated on the error row(s) and at the top of the page Page-level exceptions are visually indicated at the top of the page
Severe Exceptions
Severe (or "fatal") exceptions include unexpected system-level errors (like a NullPointerException) and selected JBOExceptions like NoDefException. You can also deliberately throw a severe exception in your code. 125
Since OA Framework release 11.5.57, if a fatal exception occurs, the user is directed to the OAErrorPage (f the fatal exception occurs in the middle of page rendering, the page is partially rendered with a user-friendly error message that includes a link to the detail stack trace). The OAErrorPage also displays a user-friendly error message with a link to the detail stack trace. Note: This is an untranslated message that customers can change on site. Oracle Workflow Notification The OA Framework also ships a seeded business event (oracle.apps.fnd.framework.OAFatalError)which sends a notification to the SYSADMIN user whenever OA Framework page reports a severe or fatal exception. The notification includes the detailed error stack for the fatal exception and information about the user who encountered the exception. If you wish to change the notification's default recipient from SYSADMIN, you need to customize the definition of Item Type OAERROR. The subscription to this business event is disabled by default. To enable the subscription, refer to the Oracle Workflow documentation on how to enable a subscription for a business event. If you are using Oracle Workflow Release 11i/2.6, with the original Oracle Applications user interface, see "To Update or Delete an Event Subscription", Oracle Workflow Guide (for Release 11.5.8 and earlier) or Oracle Workflow Developer's Guide (for Release 11.5.9 and above). If you are using the OA Framework-based user interface for the Business Event System, see "To View and Maintain Event Subscriptions", Oracle Workflow Developer's Guide.
Exception Classes
The OA Framework exception inheritance hierarchy is shown in Figure 1 below. The OAException superclass extends JBOException. OAAttrValException and OARowValException extend OAViewObjectException, a deprecated class that extends OAException. Figure 1: OA Framework exception inheritance hierarchy
126
OAException
OAException is the exception that you would throw in generic error cases (for example, if you encountered an unexpected problem in some controller code as shown): OACellFormatBean shipTermsCell = (OACellFormatBean)webBean.findIndexedChildRecursive("ShipTermsCell"); if (shipTermsCell == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "ShipTermsCell")}; throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", tokens); } Note that we created a message in Oracle Applications Message Dictionary (FWK_TBX_OBJECT_NOT_FOUND) in the AK application. The message was defined with a token (OBJECT_NAME) that we replace with the name of the UI component that we expected to find. The OA Framework will use this information to automatically display a properly translated error message at the top of the page (if you instantiate an OAException, and don't specify the message type, it always renders as an error). Since the OAException is a flexible object that can also be used to display other types of messages to the user (Information, Confirmation and Warning), you can also instantiate it with a message type as shown for the following Confirmation example (see the Dialog Pages and Message Boxes section below for pointers to documents that describe how to use these features to display Information, Confirmation and Warning messages). MessageToken[] tokens = { new MessageToken("SUPPLIER_NAME", name), new MessageToken("SUPPLIER_NUMBER", supplierId) }; OAException confirmMessage = new OAException("AK", "FWK_TBX_T_SUPPLIER_CREATE_CONF", 127
tokens, OAException.CONFIRMATION, null); Message Type The OAException, OAAttrValException, and OARowValException classes all include constructors that accept a message type (byte) parameter. The message type parameter tells OA Framework the type of message to display to a user. Valid options include: OAException.ERROR OAException.WARNING OAException.INFORMATION OAException.CONFIRMATION OAException.SEVERE
OAAttrValException
If any attribute-level validation fails in a view object row or an entity object, you can throw an OAAttrValException as shown below. To instantiate this exception, you must pass the following information: Source object type (OAException.TYP_ENTITY_OBJECT or OAException.TYP_VIEW_OBJECT) Full entity definition name or view instance name as appropriate Primary key of the entity or row Attribute name being validated Attribute value that failed validation Error message application short name Error message name Entity Object Example public void setSalary(Number value) { if (value != null) { // Verify value is > 0 if (value.compareTo(0) <= 0) { throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT, // indicates EO source getEntityDef().getFullName(), // entity name getPrimaryKey(), // entity primary key "Salary", // attribute Name value, // bad attribute value "AK", // nessage application short name "FWK_TBX_T_EMP_SALARY_REQUIRED"); // message name } setAttributeInternal(SALARY, value); } } // end setSalary() View Row Example Also see the Mapping section below for additional information about raising these exceptions from a view row. setDescription(String value) { if("XXX".equals(value) 128
{ throw new OAAttrValException ( OAException.TYP_VIEW_OBJECT, // indicates VO row source ((ComponentObject)getViewObject()).getName(), // view instance name getKey(), // row primary key "Description", //attribute name value, // bad attribute value "FND", //message application short name "ATTR_EXCEPTION"); // message name } setAttributeInternal("Description", value); } // end setDescription()
OARowValException
If any row-level validation fails in a view object row or an entity object, you can throw an OARowValException as shown below. To instantiate this exception, you must pass the following information: Full entity definition name or view instance name as appropriate Primary key of the entity or row Error message application short name Error message name Entity Object Example protected void validateEntity() { super.validateEntity(); if(attr1!=attr2) throw new OARowValException ( getEntityDef().getFullName(), // entity full definition name getPrimaryKey(), // entity object primary key "FND", // message application short name "ATTR_EXCEPTION"); // message name } View Row Example Also see the Mapping section below for additional information about raising these exceptions from a view row. protected void validate() { super.validate(); if(attr1!=attr2) throw new OARowValException ( ((ComponentObject)getViewObject()).getName(), // view Object instance name getKey(), // row primary key "FND", // message application short name "ATTR_EXCEPTION"); // message name }
Line 2-3 <Attribute Prompt>: <Some error message relating to the given attribute in this designated row> To implement this: Step 1: Create a transient view object attribute to include the translated String that you want to display as the row prefix. Step 2: Create a custom property for the view object: Set its Name to ROW_DISPLAY_PREFIX_ATTR_NAME Set its Value to the name of the attribute that you created in Step 1 When processing exceptions related to this view object, the OA Framework will check to see if this custom property is set, and if it is, will use the designated attribute value as the row prefix. Note: For consistency, the OA Framework applies this prefix to any error or warning message that you generate, plus any row-level messages that it generates internally.
Bundled Exceptions
Bundled exceptions let you accumulate "peer" exceptions while proceeding with validation, and then display them as a set when you are done. Since OA Framework Release 11.5.56, these peer exceptions are grouped in a container exception called a bundled exception. Bundled exceptions can include any kind of server-side exceptions (including system-level exceptions, data formatting errors, attribute validation errors, row validation errors, and entity creation errors). Peer Exceptions List 130
To creat a bundled exception, you first must create a list to which you add exceptions as you encounter them: ArryList peerExceptions = new ArrayList(); peerExceptions.add(new OAException(....)); peerExceptions.add(new OAException(....)); ... Bundled Exceptions When you're ready to throw your bundled exception, call OAException.getBundledOAException to create the bundled OAException from the list of peer exceptions that you pass to it or call OAException.raiseBundledOAException to create and throw the bundled OAException immediately. Note that bundling similar APIs are also available on OAAttrValException and OARowValException. See the various accessors published by the OA*Exception classes for interacting with bundled exceptions (remember that the bundled exception itself is simply a container including the peer exceptions array). During entity and row validation, if you don't want to do your own bundling, you can also register exceptions. These exceptions will be thrown when validation completes, or when an exception is explicitly thrown as illustrated in the examples below (see the Javadoc for oracle.apps.fnd.framework.server.OAEntityImpl and oracle.apps.fnd.framework.server.OAViewRowImpl). BC4J Bundled Exception Mode When this mode is disabled, all exceptions thrown by the entity attribute setters are thrown right away to the calling view row, which then throws the exception to the caller. When you enable bundled exception mode, BC4J stacks exceptions thrown from the entity attribute setters, and throws them end of valdiateEntity, or when validateEntity throws an exception. All of these exceptions are bundled into a single exception that is returned to the caller. You can enable this mode by calling: OADBTransaction.setBundledExceptionMode(true); By default, this mode is disabled. We recommend that you do not use this feature as the OA Framework collects all exceptions on your behalf without this.
Exception Examples
Example 1
The following code example illustrates how to catch exceptions and throw them as a single bundled exception. public void foo() { ArrayList exceptions = new ArrayList(); for(int ...; ...; ...) { if(.....) { exceptions.add(new OAException(.....)); } } OAException.raiseBundledOAException(exceptions); }
Example 2
The following code caches exceptions thrown during validateEntity(), and then throws the cached exceptions as one bundled exception. protected void validateEntity() { super.validateEntity(); 131
ArrayList exceptions = new ArrayList(); //check for duplicate Filter Name if (getEntityState() == STATUS_NEW) { String value = getFilterName(); OADBTransaction tx = getOADBTransaction(); OAApplicationModule vam = getMyValidationAM(); FiltersVOImpl vo = vam.findViewObject("filtersViewUsage"); if (vo == null) { vo = vam.createViewObject("filtersViewUsage","oracle.apps.qrm.filter.server.FiltersVO"); vo.setMaxFetchSize(-1); vo.initQuery(value,"C"); Row r = vo.first(); if (r != null) { exceptions.add( new OAAttrValException ( OAException.TYP_ENTITY_OBJECT, // Entity attribute exception. getEntityDef().getFullName(), //Entity full def name getPrimaryKey(), //Row primary key "FilterName", //Attribute Name value, //Bad Value "QRM", //Message Application Short Code "QRM_UNIQUE_FILTERS_ERR")); //Message Code } } //check for empty filters(no conditions) EntityDefImpl def = EntityDefImpl.findDefObject("oracle.apps.qrm.filter.server.QrmFilterConditionsEO"); Iterator iterator = def.getAllEntityInstancesIterator(getDBTransaction()); String flag = "no"; while (iterator.hasNext()) { QrmFilterConditionsEOImpl fcEO = (QrmFilterConditionsEOImpl)iterator.next(); // only check rows in valid state if ( fcEO.getEntityState() != STATUS_DELETED && fcEO.getEntityState() != STATUS_DEAD ) { flag = "OK"; } } if (flag.equals("no")) { exceptions.add( new OARowValException ( getEntityDef().getFullName(), getPrimaryKey(), //Row primary key "QRM", //Message Application Short Code "QRM_NO_CONDITIONS_ERR")); //Message Code } OAException.raiseBundledOAException(exceptions); }
Example 3
132
The following code example caches exceptions thrown in a view object method, and then throws the cached exceptions as one bundled exception. public void checkUsed() { String ifSelected = null; String name; ArrayList exceptions = new ArrayList(); FiltersVORowImpl row = (FiltersVORowImpl)first(); while (row != null) { ifSelected = (String)row.getAttribute("SelectFlag"); if ("Y".equals(ifSelected)) { name = (String)row.getAttribute("FilterName"); OAViewObjectImpl vo = (OAViewObjectImpl)getApplicationModule().findViewObject("IsFilterUsedVO"); vo.setWhereClause(null); vo.setWhereClauseParams(null); vo.setWhereClauseParam(0,name); vo.executeQuery(); Row r = vo.first(); //if there are analyses, then use them if (r != null) { String msg= (String)r.getAttribute("AnalysisName"); String flag ="f"; while (r != null) { //change flag if it was the first row,if not append analysis name if (flag.equals("f")) flag = "N"; else msg = msg +", "+ (String)r.getAttribute("AnalysisName"); r = vo.next(); } MessageToken[] tokens = {new MessageToken("FILTER_NAME",name), new MessageToken("ANALYSIS",msg)}; exceptions.add( new OARowValException( ((ComponentObject)getViewObject()).getName(), row.getKey(), "QRM", "QRM_FILTER_REMOVE_ERR", tokens)); } } row =(FiltersVORowImpl)next(); } OAException.raiseBundledOAException(exceptions); }
Example 4
The following code example registers a validation exception in set<Attribute>() so BC4J can throw this exception later during the entity validation. public void setAmount(oracle.jbo.Number amnt) 133
{ // Clears any old exceptions for a fresh start. clearAttributeException("Amount"); if(amnt < 0) { OAAttrValException attrEx = new OAAttrValException( OAAttrValException.TYP_ENTITY_OBJECT, getEntityDef().getFullName(), getPrimaryKey(), "Amount", amnt, "QRM", "QRM_AMOUNT_IS_NEGATIVE"); registerAttributeException(getEntityDef().getAttributeDefImpl("Amount"),amnt, attrEx); } }
Example 5
This code example registers exceptions thrown during validateEntity()so BC4J can throw these exceptions when validation completes. protected void validateEntity() { super.validateEntity(); // Clears all Row and Attribute exceptions registered in validateEntity() for a fresh start. clearAttributeException("FilterNAme"); clearRowExceptions(); //check for duplicate Filter Name if (getEntityState()==STATUS_NEW) { String value = getFilterName(); OADBTransaction tx = getOADBTransaction(); OAApplicationModule vam = getMyValidationAM(); FiltersVOImpl vo = vam.findViewObject("filtersViewUsage"); if(vo == null) { vo = vam.createViewObject("filtersViewUsage", "oracle.apps.qrm.filter.server.FiltersVO"); } vo.setMaxFetchSize(-1); vo.initQuery(value,"C"); Row r = vo.first(); if (r != null) { OAAttrValException attrEx = new OAAttrValException ( OAException.TYP_ENTITY_OBJECT, // Entity attribute exception. getEntityDef().getFullName(), //Entity full def name getPrimaryKey(), //Row primary key "FilterName", //Attribute Name value, //Bad Value "QRM", //Message Application Short Code "QRM_UNIQUE_FILTERS_ERR")); //Message Code registerAttributeException(getEntityDef().getAttributeDefImpl("FilterName"), value, attrEx); } 134
} //check for empty filters(no conditions) EntityDefImpl def = EntityDefImpl.findDefObject("oracle.apps.qrm.filter.server.QrmFilterConditionsEO"); Iterator iterator = def.getAllEntityInstancesIterator(getDBTransaction()); String flag = "no"; while (iterator.hasNext()) { QrmFilterConditionsEOImpl fcEO = (QrmFilterConditionsEOImpl)iterator.next(); // only check rows in valid state if ( fcEO.getEntityState() != STATUS_DELETED && fcEO.getEntityState() != STATUS_DEAD ) flag = "OK"; } if (flag.equals("no")) { registerRowException( new OARowValException ( getEntityDef().getFullName(), getPrimaryKey(), //Row primary key "QRM", //Message Application Short Code "QRM_NO_CONDITIONS_ERR")); //Message Code } }
135
Contents
Designing Attribute Sets Creating Attribute Set Packages Creating Attribute Sets Deploying Attribute Sets
Prerequisite Reading
This document assumes that you have read the following in the OA Framework Developer Guide: Anatomy of an OA Framework Page Implementing the View
Need-By Date - Date by which line items must be delivered. Promise Date - Date by which supplier promises to deliver line items. Receipt Date - Date on which line items were received. VARCHAR2, DATE, DATETIME, Required for Specify only for transient items that has Data Type NUMBER, or BOOLEAN (might change transient no mapping to a data entity. Otherwise to JAVA like types in the future) items must default to data type of associated data attribute. Document See the OA Framework File / Package / Required Name Directory Structure standards. Height Display height Optional Use for multi-line input text only. Number of characters to display, should Length Item display Length Optional be between 1 and maximumLength value Maximum Maximum number of characters allowed Required for Specify only for transient items that has Length in the item value. transient no mapping to a data entity. Otherwise items must default to value length of associated data attribute. Prompt Item's prompt Required Tip Message Message Dictionary message Optional, Specify if applicable Appl Short application short name. depends on Name tipType Tip Message Message Dictionary message name. Optional, Specify if applicable Name depends on tipType dateFormat, longMessage, shortTip, and Optional Tip Type Specify if applicable none. For longMessage and shortTip, you must specify the Tip Message Appl Short Name and the Tip Message Name. Required for Specify only for transient items that has Required Is runtime form value required? transient no mapping to a data entity or when items overriding a not-required value corresponding to a persistent data entity. Button Template The following is a list of the properties that may be used to define button attribute sets. Property Description Additional Text Used for bubble help and tooltips. Describes attribute set Comments usage Document Name Prompt Button label Region Header Template 138 Required Specific Guidelines Required Required for buttons per Accessibility standards. Required Must include the context in which the attribute set is used. Required See the OA Framework File / Package / Directory Structure standards. Required
The following is a list of the properties that may be used to define header attribute sets. Property Additional Text Comments Document Name Icon URI Maximum Length Prompt Description Required Used for bubble help and Optional tooltips. Describes attribute set Required usage Required Header icon Maximum number of characters allowed in the item value Header text Specific Guidelines
Must include the context in which the attribute set is used. See the OA Framework File / Package / Directory Structure standards. Optional Populate only if applicable to most uses Required for Specify only for transient items that has no mapping transient items to a data entity. Otherwise must default to value length of associated data attribute. Required
139
Internationalization
Internationalization
Overview
Contents
User Preferences Language Timezone Dates Numbers/Currency Text and Component Alignment Localized Layouts
Prerequisite Reading
Implementing the Model Implementing the View Implementing the Controller
Related Information
OA Framework Naming / File / Package / Directory Structure Standards OA Framework View Coding Standards
User Preferences
Most OA Framework application pages include a standard global Preferences button that users can select to change the following locale-related session settings: Language Territory Timezone Client character encoding Date format Number format When a user logs in, locale information is stored in ICX_SESSIONS (see OA Framework State Management for additional information about the Oracle Applications User Session). The OA Framework automatically considers these settings when rendering pages and handling data. However, you must use the OA Framework methods described below if you will be doing any explicit manipulation of locale-sensitive data so it can be converted and formatted correctly according to user's preferences and cultural conventions, and not the default locale setting and default encoding. Note that you can easily obtain the locale information like country, language, date/number format and so on by calling the getUserLocale() and getUserLocaleContext()methods on oracle.apps.fnd.framework.OANLSServices (which itself can be retrieved from an oracle.apps.fnd.framework.webui.OAPageContext in a controller, or an oracle.apps.fnd.framework.OADBTransaction in model code).
Language
In short, all text that is displayed to a user must be fully translatable. This section describes how you ensure this for an application. 140
Note: When we say that a value is "eligible for translation," we mean that it will display in the correct language for the user assuming a translation is present. If not, the value is displayed in American English regardless of the user's language preference.
OA Component Definitions
All the displayable properties that you define declaratively in the Oracle9i JDeveloper OA Extension are also eligible for translation. At runtime, the OA Framework displays these values in the user's language (assuming, of course, that a translation for that language has been completed). Some web beans let you declaratively specify a message name for long text. This message is defined in an Applications repository called Message Dictionary, and it is fully translatable. At runtime, the OA Framework displays the appropriate text for the user's language. Tip: For information about creating messages using Message Dictionary, see the Oracle Applications Developer's Guide. You can also define lists of attribute/value pairs (known as "Lookup Codes") for use in the UI when you want to display translated values to the user while your code deals with the static attributes. Tip: For information about creating lookup codes, see the Oracle E-Business Suite Lookups online help.
Code
Any other text that you display yourself (in exceptions, programmatically defined beans and so on) MUST be retrieved from a translated data source ( Message Dictionary, a translated product table, or from a declaratively defined web bean whose displayed values are translated). NEVER display hard-coded text strings in the UI! Note: Oracle Applications developers using the OA Framework do not use Java resource bundles. To retrieve a product specific message from Message Dictionary, use OAPageContext.getMessage() as shown in the following example: MessageToken[] tokens = { new MessageToken("PO_NUMBER", orderNumber)}; String pageHeaderText = pageContext.getMessage("AK", "FWK_TBX_T_PO_HEADER_TEXT", tokens); To set a message for bundled exceptions or validation exceptions, use the oracle.apps.fnd.framework.OAAttrValException and oracle.apps.fnd.framework.OARowValException classes as illustrated in Error Handling. To display the translated text for a static styled text item, for example, simply call its getText() method as shown (remember to always use any web bean accessor signatures that take OAPageContext as a parameter): OAMessageStyledTextBean styledTextBean = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("itemName"); String itemText = styledTextBean.getText(pageContext);
Timezone
With global e-business, customers from one timezone can place orders that are created in a server in a different timezone. In this case, the time difference (encompassing both the time zone and Daylight Saving Time) must be reconciled between the client and the server (see Profile Options for information about the Oracle Applications client and server timezone profile options). Again, the OA Framework automatically reconciles this difference for you. For example, all queried date-time values are displayed in the user's time and written in the server's time. If you need to manually convert values based on the client and server timezones, OALNSServices publishes a number of methods for this purpose.
Date and time information can be represented as a String in Java Date/Time Format, a String in Oracle Date/Time Format, a Java Date/Time Object, or as an Oracle Date Object. You need to know what kind of format they are dealing with, and call the right methods to convert from one type to another. Some of the most common conversion methods are listed below; see the OANLSServices and oracle.apps.fnd.framework.OAFwkUtils Javadoc for additional information. To convert a String in user specified date/time format (Oracle date/time format) to a Java Object, use the OANLSServices methods: public Date stringToDate(String text); public Timestamp stringToDateTime(String text); To convert a Java Date/Time object to a String in the user specified date/time format ( Oracle date/time format), use the following OANLSServices methods: public String dateTimeToString(Date dateTime); public String dateToString(Date date); To convert from Oracle Date/Time Format to Java Date/Time Format, use the following OAFwkUtils methods (you can retrieve the user specified date/time format mask by calling OANLSServices.getDateFormatMask()): public static String oracleToJavaDateFormat(String userDateFormatMask); public static String oracleToJavaDateFormat(String userDateFormatMask, boolean isNumeric); public static String oracleRRRRToJavaDateFormat(String userDateFormatMask); public static String oracleRRRRToJavaDateFormat(String userDateFormatMask, Boolean isNumeric); Note: These methods support only a subset of the Oracle formats. For unsupported Oracle formats, the MM/dd/yyyy or mm/dd/yy Java format will be returned. Also, the conversion between Oracle Date/Time Format and Java Date/Time Format is currently hardcoded, so adding a new format for conversion requires an OA Framework code change. In the future, the implementation will be changed to store conversion information in a flexible mapping table. Warning: there is a mismatch between the Java Date Oracle Date formats when the month format mask is MON. In this case, the to_date function might return an error. To avoid this, always set any WHERE clause bind variables with Date data. The following example illustrates converting a String date to an appropriate format for use as a WHERE clause bind variable: initQuery(String submittedDateString) { Vector parameters = new Vector(1); StringBuffer whereClause = new StringBuffer(100); // where clause for ViewObjects. if ((submitedDateString != null) && (submitedDateString.length() != 0)) { java.sql.Date javaSqlDate = transaction.getOANLSServices().stringToDate(submitedDateString); whereClause.append("DATE_COLUMN_NAME = :1"); parameters.addElement(javaSqlDate); } setWhereClause(whereClause.toString()); Object[] params = new Object[1]; parameters.copyInto(params); setWhereClauseParams(params); 142
executeQuery();
Numbers/Currency
Numbers
When a Number is rendered as a String in the browser, the OA Framework automatically formats it based on the user's number format preference (numbers can be displayed with different grouping size, grouping separators as well as different decimal separators (for example,. "," or ".")). If you need to perform your own conversions between Java Numbers, Oracle SQL Numbers and Strings, you can use OANLSServices without having to worry about the user's locale (the OA Framework handles this for you). For example, to convert a String number representation to a Java Number or an Oracle SQL Number object, you should use the following APIs. Warning: Do NOT use Java functions like Integer.parseInt() or Double.parseDouble() because those functions do not take the locale related number formatting into consideration when they do String parsing. public Number stringToNumber(String text); public Number stringToNumber(String text, String formatMask); To convert a Java Number object to a String number representation use: public String NumberToString(Number num); public String NumberToString(Number num, String formatMask); The following code illustrates correctly converting a Double to a String: java.lang.Double num = new java.lang.Double(123456.7890); String strNumber = pageContext.getOANLSServcies().NumberToString(num,"###,###,##0.00000;###,###,##0.00000");
Currency
In addition to the basic number formatting, with a currency value you must also display the correct symbol for the currency code and locate it properly in relation to the value. To convert a Number (a Java Number or an Oracle SQL Number) to its String currency representation, call OANLSServices.formatCurrency(Number num, String currencyCode). To parse a String representation of a currency value to produce a Java Number, call OANLSServices.parseCurrency(String text, String currencyCode). The following example shows how to properly format a currency number value: java.lang.Double num = new java.lang.Double(123456.7890); String currencyFormattedNumber = pageContext.getOANLSServcies().formatCurrency(num,"USD");
Localized Layouts
143
Unfortunately, the OA Framework APIs do not currently provide standard web beans for common localized layouts like name and address (this is planned for a future release). In the interim, you must implement appropriate layouts yourself. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
144
Related Information
Chapter 8: OA Framework Files / Package / Directory Standards
* Tip: Source controlling your workspaces and projects so people don't need to track down all the files that comprise a given module makes collaborative development easier. If you do want to source control your workspaces and projects, you should include all of the files listed here.
Java
Source Control UI Controller Java controllers associated with UI regions. Required Java implementation for each BC4J component that you Required BC4J Implementations: create. Application Module Entity Object View Object View Row Entity Expert A special class associated with entity objects. Required Any supplemental classes that you create for use by Utility Classes Required other model or controller code. Type Description Package/Ship Required Required
XML
Type UI Definitions Page Reusable Region Attribute Sets Package UI Components Package BC4J Definitions Application Module Association Object Entity Object View Object View Link BC4J server.xml Description XML definition for each UI component file that you create. A file can include a complete page definition or a shared region. You can also create "packages" for attribute set definitions and related UI components (for example, all the pages/shared regions in a multistep transaction flow). Source Package/Ship Control Required Required
Required Required
Automatically maintained by JDeveloper for each BC4J package that you create.
Required Required
Seed Data
Although an OA Framework application can include any standard Oracle Applications seed data (concurrent program definitions, attachments, flexfields, profile options, lookup types/codes and so on) menus, messages and page flow Workflow definitions are listed separately since they are particularly common in any OA Framework application (the menu definition is required, and it is almost certain that you will create translatable messages). Type Menus (.ldt) Description Source Control Required Package/Ship Required
Messages (.ldt) Page Flow Workflow Definitions (.wft) Others Security (Users, Responsibilities) Sequential Numbers Attachments Concurrent Program Libraries, Definitions and so on Profile Options and Values 146
All menu definitions associated with an OA Framework application. Translatable text strings defined Required in Message Dictionary. Item type for an OA Framework Required UI page flow. Standard Oracle Applications Required seed data as required for any application.
Multilanguage/Currencies/Territories Lookup Types and Lookup Codes Flexfields Functional Workflow Definitions Online Help Navigation Trees
Images
OA Framework pages can include a rich visual vocabulary. However, all images are created by the Oracle User Interface Design and Usability team and deployed centrally in special OA Framework Image ARUs, so individual applications do not include image files.
JSPs
Alll OA Framework page URLs are routed through a single, central JSP (OA.jsp) which is provided by the OA Framework. There is no need for an OA Framework application to create additional JSPs, although external JSPs can be embedded in an OA Framework page (see Embedded Pages for additional information).
Style Sheets
All OA Framework applications use a single style sheet which is provided by the OA Framework. Oracle's internal E-Business Suite Development teams cannot ship additional, product-specific style sheets (you can, however, add styles to the central style sheet). See Working with Style Sheets additional information about this. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
147
148
In Windows, users exercise the accelerator keys by selecting Alt + <char> from the keyboard. For buttons, the accelerator key "activates" the widget. For example, typing Alt + p on the page shown in Figure 1 selects the Apply button and submits the form. For message beans, the accelerator key sets the focus to that bean. For example, if you designate "2" as the numeric accelerator key for a messageTextInput, then typing Alt + 2 moves your cursor to that text field. Accelerator keys are automatically provided for subtabs. At runtime, users can quickly move focus to the next or previous subtab by selecting Alt + > and Alt + < from the keyboard. Selecting Enter displays the subtab contents.
4. Select the Search button to find the matching attribute set in /oracle/apps/fnd/attributesets/Buttons. For example, Searching for "Apply" should return the attribute set /oracle/apps/fnd/attributesets/Buttons/Apply. Tip: A Perl upgrade script will be provided in OA Framework release 11.5.10E to help you quickly set the correct attribute sets for preexisting code (if needed). See the OA Framework 11.5.10 Release Notes for additional information.
Runtime Control
If you need to programmatically set the prompt for a common button (there should be little or no reason to do this), you may call the setText(String) method with an ampersand character (&) immediately before the character to serve as an accelerator key. For example, UIX will assign"r" as the accelerator key for the String value Sea&rch. Note that you must also explicitly set the short description to an appropriate value by calling the setShortDesc(String). For example, if the prompt is set to "Sea&rch", then the short description should be set to "Search" or something similar. Tip: The character & itself can be included in the prompt by using the value &&. Any values that you set when calling setText or setShortDesc must be translated (you cannot use untranslated, static Strings). Although you could obtain the values from message dictionary for this, a better approach would be to use the values set in the corresponding attribute sets. For example, you could reuse the prompt definition from the /oracle/apps/fnd/attributesets/Buttons/Apply attribute set. See Programmatic Access to Attribute Sets in Implementing the View.
Declarative Implementation
Step 1: Create an item with one of the following styles: button submitButton any message* style Step 2: Set the Access Key property to a value of 0 - 9 by selecting it from the property's poplist. Note: Limit your access key implementation to product-specific buttons where execution speed is absolutely essential for high-frequency users. So, for example, you don't need product-specific button access keys in a self-service application that is likely to be used once a year.
Runtime Control
If you need to set the access key programmatically, call setAccessKey(char) on any of the supported beans. Warning: You MUST use a value of 0 - 9. Do not use letters as these are reserved for use by UIX for the common accelerator keys.
Personalization Considerations
None.
Known Issues
None
Related Information
BLAF UI Guideline(s) Keyboard Shortcut [ OTN Version ] 150
151
Attachments
Overview
As described in the Oracle Browser Look-and-Feel (BLAF) UI Guidelines: Attachments Templates [OTN version] and Attachments Flows [OTN version], the attachments feature allows you to associate a URL, file content, or text with an object, such as an expense report, contract, or purchase order. To enable the attachments feature, you should first understand the concept of an entity. An entity is an object within Oracle Applications data, such as an item, an order, or an order line (note that it is not related to BC4J Entity Objects). The attachments feature must be enabled for an entity before users can link attachments to the entity. In the context of attachments, an entity can be considered either a base entity or a related entity. A base entity is the main entity of the region. A related entity is an entity that is usually related to the region by a foreign-key relationship. An entity consists of a set of view attribute names (declared through your OA Extension region items) which are the primary keys for the view object related to your region. When an attachment is stored, the values of these primary keys and the Entity ID are stored so the attachments can be uniquely retrieved. Several regions can access the same entity, providing a consistent view of attachments throughout your application. OA Framework also supports multiple entities associated with a region item, with functionality similar to the core functionality of attachments in Oracle Applications Forms-based functions. For instance, a purchase order has a PO Header and PO Lines. At the line level, you can add attachments pertaining to the entity PO_LINES. Note that you usually enter an item number in PO Lines. When you create the item in the master Item form, you can add an attachment, such as a picture of the item, that gets stored with a different entity, such as MTL_SYSTEM_ITEMS. With multi-entity support, when you view the attachments for a PO Line, you can see the attachments for both entities, that is, PO_LINES and MTL_SYSTEM_ITEMS.
Contents
Enabling Attachments in a Region Attachments User Interface Enabling the Attachments Feature for an Entity Declarative Implementation Runtime Control Personalization Considerations Known Issues Related Information
Display the Attachments Table on the Page of a Single Row Region For a single-row region, you can choose to render the Attachment Table region on the product page directly as shown in the figure below. The Attachment Table region is identical to the Attachments Page used to launch the attachments flow.
Display Inline Links of Attachments in a Single Row Region For a single-row region, rather than display a View List link or an Attachments table in the region, you may 153
choose instead to display in the region, inline links to the first few attachments for the row as shown in the figure below. The inline links allow users to easily view the first few attachments without navigating from the current page and is generally used in the Workflow Notification Details page, as described in the Oracle Browser Look-and-Feel (BLAF) UI Guidelines: Notification Page Templates [OTN version]. Users can also view additional attachments if there are any, or perform further operation on the attachments by selecting the More link that follows the attachment links. The More ... link takes the user to the Attachments page. If the attachments are not updateable, and the number of attachments that exist is equal to or less than the number of links that are allowed to be displayed (as set when you enable this feature), the "More ..." link does not appear.
If the attachment type of the inline link is File, then when you select the link, a dialog box opens in your Browser. You can either open the file and display the content or save the file. If you choose Save, the file is created and saved to your client machine. If the attachment type of the inline link is Text, then when you select the link, you navigate to the View Attachment page, where you can view the content of the text. If the attachment type of the inline link is URL, then when you select the link, you navigate to the destination URL. Display an Attachments Column in a Multi-Row Table Region You may also enable attachments in a multi-record table region by displaying an Attachment column at the end of the table. Each row in the table that contains an attachment displays an Attachments icon, that navigates to the Attachments page when selected, and an Add icon, that navigates to the Add Attachment page when selected. The following figure illustrates a multi-row region with an Attachment column, containing Attachments and Add icons in the table:
154
155
If the list of attachments is long, you can use the Hide/Show search region to list specific attachments by description, category, last updated by and/or last updated date. You may select the Add Attachments button above the table to add attachments using the Add Attachment page. If you select the Return... link at the bottom of this page, you return to the product page from which you launched the Attachments flow. View Attachment Page To view the content of an attachment, select a File Name link in the first column of the table on the Attachments page. If the attachment is a web page, you navigate to the specified URL when you select the link. If the attachment is a file, a dialog box opens in your Browser when you select the link. You can either open the file and display the content or save the file. If you choose Save, a file with the content is created and saved to your client machine. If the attachment is text, a View Attachment page appears, as shown below, displaying the text content.
156
When you select the Return... link on this page, you return to the Attachments page. Adding Attachments You can add attachments to the current record using the Add Attachment page. The Add Attachment page varies depending on whether you enable the Document Catalog when you implement attachments in a page. If you: Enable Document Catalog - an Add poplist control appears at the top of the Add Attachment page. The Add poplist displays two choices: Desktop File, Text, URL - selecting this choice updates the Add Attachment page so you can add a file, text, or URL as an attachment. From Document Catalog - selecting this choice updates the Add Attachment page so you can add an attachment from the Document Catalog. Disable Document Catalog - an Add poplist control does not appear at the top of the Add Attachment page, and you can only add a file, text, or URL as an attachment. Add Attachment Page When you add an attachment, you need to specify a category for the attachment. A category is a label that users apply to individual attachments and documents. When you set up a region to be attachment-enabled, you must assign a category for the documents that can be attached. The Attachments page can query only those documents that are assigned to the category to which the calling page's entity is associated. A "Miscellaneous" category is seeded to provide easy visibility of a document across pages. If you do not assign a category to the documents that can be attached, the category defaults to Miscellaneous.
Adding a Desktop File, Text, or URL as an Attachment
In the Add Attachment page, select "Desktop File/ Text/ URL" from the Add poplist to add a new attachment. Specify a description and category, followed by the attachment type (File, URL, or Text) and attachment information (file name, URL, or the text itself) for the new attachment, as shown below. If your attachment is of type Text, you can specify a label to identify the text in the field below the Text input area. Attention: As of OA Framework 11.5.10H, all Text attachments are added as "Short Text" type, with a maximum length of 2000 bytes. Text attachments previously added using earlier releases of OA Framework are still stored as "Long Text" type. You can continue to update or delete these "Long Text" attachments, but if you need to add an attachment that is longer than 2000 bytes, you should put the text into a text file and add the attachment as a File.
157
In the Add Attachment page, you can select Cancel to cancel and return to the previous Attachments page, select Add Another to add another attachment, or select Apply to insert the rows into the view object and return to the Attachments page. Note that the new attachments are not committed until a submit is performed by the associated parent region. Clicking Apply on the Add Attachment page does not commit the changes by default. If you want a commit to occur when clicking Apply, refer to the Runtime Control section called "Committing Changes" for additional information.
Adding an Attachment from the Document Catalog
Oracle Applications keeps a catalog of documents that have so far been attached to applications data records. You can take advantage of this catalog to attach an existing document to another data record. In other words, you can use this document catalog to copy an attachment from another record. To add an attachment from the Document Catalog, select "From Document Catalog" in the Add poplist of the Add Attachment page. Use the search region to specify search criteria to locate one or more specific attachments. The results of your search are displayed in a table. The figure below displays all attachments last updated by "MFG", currently stored in the document catalog:
158
The table lists the name of the document, its type, description, category, who it was last updated by, when it was last updated, and its usage. You can select the document name link to display the document in the View Attachment page. The usage type indicates how the document may be used. There are three usage types: Template - the document is meant to be modified before use. When you select a Template usage document in the Document Catalog, a copy of the document is created and the document usage of the copy is set to One-Time. The copy is also updateable. If you delete an attachment that has a usage type of Template, the document content, as well as the association of the document to the record is deleted. Documents that appear in the Document Catalog with a usage type of Template, are created from the Documents Window screen in Oracle Applications. See the Oracle Applications User's Guide for additional information. One-time - the document is meant to be used only once. When you select a One-time usage document in the Document Catalog, a copy of the document is created and the document usage of the copy is set to One-time. If you delete an attachment that has a usage type of One-time, the document content, as well as the association of the document to the record is deleted. Note that all documents that you add 159
using the Add Attachment page will have their usage type set to One-time. Standard - the document is a standard document that can only be referenced. When you select a Standard usage document in the Document Catalog, a copy of the document is not made. As a result, the document is not updateable. If you delete an attachment that has a usage type of Standard, the document content is not deleted, only the association of the document to the record is deleted. Documents that appear in the Document Catalog with a usage type of Standard, are created from the Documents Window screen in Oracle Applications. See the Oracle Applications User's Guide for additional information. Once you locate the document(s) of interest, use the select checkbox to select the attachment(s). Choose Apply to attach the document(s) to your record and return to the Attachments page. You may also select Cancel to cancel and return to the Attachments page. Editing an Attachment In the Attachments page, you can choose the Update icon to update a particular attachment. The Update icon displays the Update Attachment page. The figure below shows the Update Attachment page for a Text attachment:
Note that you can only edit the information as it pertains to the attachment. You can not change the attachment type in this page. For example, if an attachment is a web page, you can update the URL that is associated with this attachment, but you can not change the attachment type to a file. In the Update Attachment page, selecting Apply updates the necessary rows in the view object and returns the user to the Attachments page. Note that changes to attachments are not committed until a submit is performed by the associated region. Clicking Apply on the Update Attachment page does not commit the changes by default. If you want a commit to occur when clicking Apply, refer to the Runtime Control section called "Committing Changes" for additional information. 160
Deleting an Attachment Lastly, you can choose the Delete icon to disassociate an attachment from a record. If the usage type of the attachment is Template or One-time, a warning confirmation also appears as this action will delete the document content.
a. Enter the main table name that your view object references. This is just informative for users. OA Framework does not actually use this piece of information. b. Enter the Entity ID. This is used to identify your entity and you need to reference this when you define 161
your region item in OA Extension. c. From Step 3, enter the view attribute names for the region items that you defined in OA Extension that can be used as primary keys. Please note that the view attribute names that you enter into the Entity definition need to be able to uniquely identify a record of the specified entity. Note: The E-Business Suite interface for defining entities in the AK Entities form is at: OA.jsp?akRegionCode=AK_ENTITY_VIEW_PAGE&akRegionApplicationId=601 Note: If you want to download the entities you define in FND_DOCUMENT_ENTITIES, you need to use FNDLOAD. The usage of FNDLOAD is as follows: FNDLOAD logon 0 Y mode configfile datafile [ entity [ param ...] ] where logon - username/password[@connect] mode - UPLOAD or DOWNLOAD configfile - configuration file datafile - data file entity - an entity name or - to specify all values in an upload param - a NAME=VALUE string used for parameter substitution Step 5: If your region is a single row region, create a nested item with one of the following item styles in OA Extension: attachmentTable - to render an Attachments table below the current region. attachmentLink - to render the View List link and Add button below the current region. Users need to select the View List link to display the Attachments page. messageInlineAttachment to render a list of inline attachment links. Users can select the More link to navigate to the Attachments user interface to perform further operations on attachments. Note The messageInlineAttachment item style should only be added to layout style containers such as messageComponentLayout, header, and so on. It should not be added to any table family members, such as table, advancedTable, hGrid or gantt. If you have a multi-row table region, define a region item with the item style attachmentImage nested in the table or in the column of an advanced table. This creates an attachment column in the table. In the attachment column, you select the Attachment icon to display the Attachments page or Add icon to display the Add Attachment page. Step 6: Specify the following properties for the attachment region item you just created: ID - a unique ID for the attachment region item. View Instance - the name of the view instance for the entity you are attachment-enabling. Rendered - set to True. Enable Document Catalog - set to True to enable adding attachments from the document catalog or False to disable access to the document catalog. The default is True. Refer to the Adding Attachments section for further details. Render Search Region - set to True to render the Search region for the Attachments page or region. The Search region allows you to query for a specific set of attachments. If the item style is attachmentLink, set these additional properties: Prompt - a label for the attachment region item. If this property is null, the prompt defaults to "Attachments". Link Text - text for the Attachment link, if you select attachmentLink as the item style. If this property is null, the link text defaults to "View". If the item style is attachmentTable, set these additional properties: Text - a display name for the Attachments table. Icon URI - a gif file containing the image to display next to the Attachments table display name. If the item style is messageInlineAttachment, set this additional property: Prompt - a label for the attachment region item. If this property is null, the prompt defaults to "Attachments". 162
Links Displayed - the maximum number of inline attachment links to display. The default is 5. If the item style is attachmentImage, set this additional property: Prompt - a label for the attachment column. If this property is null, the prompt defaults to "Attachments". Step 7: By default, changes made to the Attachments table or page are saved (committed) only when a user selects the Apply button on the base page from which Attachments is launched. See the Runtime Control section. If you want changes to the Attachments table or page to commit automatically, without requiring a user to select Apply in the base page, you can turn on "auto-commit" by setting the Automatic Save property to True for the attachmentLink, attachmentTable, or attachmentImage item. With "auto-commit" turned on, each action ("Add", "Update", "Detach") performed by the user in the Attachments table or page is automatically committed. Step 8: In the Structure pane, select the default entityMap that is created under the attachment region item you just created in the previous step. Select the entityMap in the Structure pane. In the OA Extension Property Inspector, enter a unique ID for the entity map and one of the following values for the Entity property: If you performed Step 4 and defined an entity in the AK Entity form to share between the Oracle Forms and OA Framework interfaces, specify the Entity ID you defined in the AK Entity form. If you skipped Step 4 because you are enabling attachments only to be viewed from the OA Framework interface, enter a unique arbitrary value for Entity. Select the Entity Map named child in the Structure pane. Under New in the context menu, select primaryKeys to create a primary key named child for the entity map. Select the primaryKey named child in the Structure pane. Enter a view attribute name for the primary key in the OA Extension Property Inspector. Note Many regions can share an entity; in fact, if you want the same attachment(s) to be viewable from different regions, those regions must share the same entity. In addition, the attachment region items of those different regions must have the same view attribute name and reference the same view instance. Step 9: If you want to make the Attachments table or page read-only, so that it does not display the Update and Detach columns, select the Entity Map named child for the attachment region item in the OA Extension Structure pane. Set the Insert Allowed, Update Allowed, and Delete Allowed properties in the Property Inspector to False. Note that you can set any combination of these properties to False to better control the level of change you want users to have in the Attachments table or page. Note: The OA Framework oracle.apps.fnd.framework.webui.beans.layout.OAAttachmentTableBean setUpdateable(boolean updateable) method (which is specified by setUpdateable in interface oracle.apps.fnd.framework.webui.beans.OAWebBeanAttachment), to make an Attachments table read-only, has been deprecated as of OA Framework 11.5.10. Use the oracle.apps.fnd.framework.webui.beans.OAAttachmentImageBean setEntityMappings(Dictionary[] entityMaps) method instead if you need to maintain backwards compatibility. Step 10: Create a category map to specify the category of documents that can be associated with the attachment. Document categories provide security by restricting the documents that can be viewed or added as an attachment. In the Structure pane, select the entity map you just defined. Select New > categoryMap from the context menu to create a Category Map named child. Select the Category Map in the Structure pane and in the Property Inspector, specify a unique ID for the category map and enter a Category for your entity. Note that the value of Category must be a predefined Name (internal name, rather than display name) from the FND_DOCUMENT_CATEGORIES table, such as MISC. Once you define a categoryMap and if the showAll property on the entityMap is set to false, then only the attachments that are assigned with the same category as specified in your categoryMap(s) can be queried or added from the Attachments page. Note A property called setDefaultMiscCategoryEnabled creates a default category map and sets the category to MISC, if one is not already defined. As a result, if the showAll property on the entityMap is set to False and you do not define a category map for the entity, OA Framework creates a default category map for the entity and sets the category to MISC. If the showAll property is set to True, however, it disregards the category maps, as all categories are available. If you change the setDefaultMiscCategoryEnabled property to False, and you do not create a category map before running your attachment-enabled page or the category map has only one category defined, the Category poplist does not display in the Search region of the Attachments table or in the Add Attachment page. 163
This property is set by default to True. To change the value of this property to False, you must use the following API: attachBean.setDefaultMiscCategoryEnabled(false);
Runtime Control
In general, there are no runtime control steps necessary to enable attachments for an entity. However, you can refer to the following sections if you wish to programmatically secure attachment documents to a particular context or control when to commit changes made to attachments. Securing Documents to a Particular Context If you want to secure your attachment documents with a particular context, such as organization, set of books, or business unit, you can do so using these two APIs in the oracle.apps.fnd.framework.webui.beans.OAWebBeanAttachment interface: setSecurityType(int securityType) setSecurityId(int securityId) Typically, attachments in financial applications are secured by sets of books, attachments in manufacturing applications are secured by organization and attachments in human resource applications are secured by business unit ID. The following example illustrates how to use these APIs to secure documents by organization ABC. This should be included in the controller code for the page that launches the Attachments feature: attachmentBean.setSecurityType(1); // security type 1 = Organization, 2 = Sets of Books, // 3 = Business Unit, and -1 = No security type attachmentBean.setSecurityId(123); // org id: 123 = company "ABC" As a result of the above code, when a user creates an attachment for the application page, the document is automatically secured to organization ABC. The Attachments UI displays documents that have this security context, as well as documents that are not secured. If you do not set a security context when you enable the Attachments feature for a page, the attachment documents that get created will have a security type of "None" and can be shared across different security context. Committing Changes By default, changes made to the Attachments table or page are saved (committed) only when a user selects the Apply button on the product page from which the Attachments flow is launched. The Automatic Save property on the attachment web bean is set to False in this case. This means that in the processFormRequest method of the controller object, you need to capture the event of this submit button and call commit() explicitly. If you want changes to the Attachments table or page to commit automatically, without requiring a user to select Apply in the base product page, you can turn on "auto-commit" by setting the Automatic Save property on the attachment web bean to True. With "auto-commit" turned on, each action ("Add", "Update", "Delete") performed by the user in the Attachments table or page is automatically committed.
Personalization Considerations
See a summary of Attachments personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
164
BLAF UI Guideline Attachments Templates [OTN version] Attachments Flows [OTN version] Javadoc File oracle.apps.fnd.framework.webui.beans.layout.OAAttachmentTableBean oracle.apps.fnd.framework.webui.beans.OAAttachmentImageBean oracle.apps.fnd.framework.webui.beans.message.OAMessageAttachmentLinkBean oracle.apps.fnd.framework.webui.beans.message.OAMessageInlineAttachmentBean oracle.apps.fnd.framework.webui.beans.OAWebBeanAttachment Lesson Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
165
Auto-Repeating Layouts
Overview
You can auto-repeat the layout of children web beans in a container, based on the rows in a view object by using a process called Child View Usage. The process attaches a data source (view object) to a container web bean, which then replicates its children web beans based on the number of data objects or rows in the source. Each replica of the container's children reflects a different row in the data source, similar to what you see when you render a table or advanced table web bean.
Contents
Auto-Repeating Layout Variations Usage Restrictions Declarative Implementation Creating a One-Level Auto-Repeating Layout Creating a Two-Level Auto-Repeating Layout Runtime Control Personalization Considerations Known Issues Related Information
Usage Restrictions
You cannot implement an auto-repeating layout in the following container regions: Table Advanced Table Hide/Show Switcher HGrid SubTabLayout You cannot replicate the above container regions indirectly. For example, you cannot create a header region, add a Table region beneath it, and expect to replicate the header region (and the underlying Table region). This is not supported. You cannot implement a two-level auto-repeating layout with a list containing Form Elements. OA Framework does not support view objects (for the Child View Usage) with composite primary keys. The view object should have a single-column primary key. 166
Declarative Implementation
This section describes how to declaratively implement an auto-repeating layout for your page.
Child View Attribute - set to an attribute in the inner view object that uniquely identifies a row (the primary key). View Link Instance - set to the view link defined between the inner and outer view objects. Based on the example in Step 2, you would set the Child View Instance to EmpVO, the Child View Attribute to Deptno, and the View Link Instance to DeptEmpVL. Note In case a view object does not have a primary key, you can use RowId as the Child View Attribute.
Runtime Control
There are no programmatic steps required for implementing an auto-repeating layout region. The child view usage set on the container web beans is automatically queried when the page renders. If you wish to turn off auto-execution of the query, set the oracle.apps.fnd.framework.webui.OAWebBeanConstants attribute, CHILD_VIEW_AUTO_QUERY_ATTR, to Boolean.FALSE, as illustrated in the following code example: containerBean.setAttributeValue( OAWebBeanConstants.CHILD_VIEW_AUTO_QUERY_ATTR, Boolean.FALSE)
Personalization Considerations
See a summary of Auto-Repeating Layout personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guideline Javadoc File oracle.apps.fnd.framework.webui.OAWebBeanConstants Lesson Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
168
Bound Values
Overview
Data binding allows you to map data from UIX web beans to BC4J components and back, bridging the gap between the two so you can create HTML pages that generate dynamic content for each user. As mentioned in the Anatomy of an OA Framework Page, OA Framework web bean attributes are implemented as data bound values, so that the underlying data source (BC4J) is not resolved to the component (by the UIX framework) until rendering time. OA Framework uses UIX's oracle.cabo.ui.data.BoundValue, oracle.cabo.ui.data.DataObject and oracle.cabo.ui.data.DataObjectList interfaces to perform data binding at runtime. A table content Switcher, on the other hand, is a region with two or more display alternatives. The display alternatives are predefined items of which only one is selectively rendered at any given time.
Contents
Bound Values Why Use Bound Values? Data Binding in OA Framework Data Binding for Fields Outside a Table Data Binding for Fields in a Table Declarative Implementation Runtime Control Personalization Considerations Known Issues Related Information
Bound Values
Why Use Bound Values? Since it is possible to write custom code to populate the contents of an HTML page, as well as derive UI content from certain metadata specified in the OA Extension Property Inspector, why bother to use bound values? There are several reasons, the main reason being that bound values simplify the code needed to fetch values from a data source at rendering time. 169
In the case of interdependent attributes, where the value of one attribute depends on the value of another, the use of bound values eliminates the need for a lot of duplicate code. Consider the example, "If data type is NUMBER, right align". Without data binding, you would have to write code such as: public void setDataType(String type) { if (NUMBER.equals(type)) { setAttributeValue(HALIGN_ATTR, HALIGN_RIGHT); setAttributeValue(DATATYPE_ATTR, type); } } public void setHAlign(String hAlign) { if (NUMBEREquals(getAttributeValue(DATATYPE_ATTR))) { setAttributeValue(HALIGN_ATTR, HALIGN_RIGHT); } else { setAttributeValue(HALIGN_ATTR, hAlign); } } public String getDataType() { return getAttributeValue(DATATYPE_ATTR, type); } public String getHAlign() { if (NUMBEREquals(getAttributeValue(DATATYPE_ATTR))) { return HALIGN_RIGHT; return getAttributeValue(HALIGN_ATTR, hAlign); } } By implementing bound values, you can reduce this code to: bean.setAttributeValue(HALIGN_ATTR, new HAlignBoundValue(bean)); with HAlignBoundValue defined as: public class HAlignBoundValue implements BoundValue { private OAWebBean mOAWebBean; HAlignBoundValue(OAWebBean bean) { mOAWebBean = bean; } public Object getValue(RenderingContext context) { if ("NUMBER"Equals(bean.getDataType())) { return HAlignRight; } } } 170
Note that bound values are especially relevant when the value of the "depended on" attribute can change at any point up until rendering time. See the Runtime Control section for another example. Another occasion when bound values are desirable is in the case of tables, where you have a handful of columns, but an unknown number of rows. Rather than consider a bean for each row and column, which does not scale, or reuse the bean hierarchies, you can bind the data in each column to a data source, such as a view object. Data Binding in OA Framework To understand how bound values work, let us take a look at the structure of a typical web bean. It can consist of indexed children, named children, and attributes. Attributes derive their values from a data dictionary of name/value pairs. Some name/value pairs are static values, such prompt /"Employee" or style/"OraTipText", and are specified at design time in the OA Extension Property Inspector. Others are implemented as data bound values, such as the text attribute (TEXT_ATTR) on message beans, where the value is retrieved from the data source at rendering time. For attributes such as TEXT_ATTR, UIX calls the OABoundValue class, an OA implementation of the UIX BoundValue interface. The class contains a single method: public Object getValue(RenderingContext context); Before examining how a value is fetched from a BoundValue object, note that OA Framework creates a named DataObject for each data source and then caches the DataObject on oracle.cabo.ui.RenderingContext. A data source is identified by the viewName set on the web bean. OA Framework then gets the value from the DataObject using the viewAttr attribute on the bean as a lookup key. Oracle Application implementations of the UIX DataObject interface are: OADictionaryDataViewObject, OADictionaryDataRow, and OADictionaryDataString. At rendering time, when UIX uses the BoundValue object to retrieve the value for TEXT_ATTR,the getValue method in the BoundValue object constructs a key using viewName and viewAttr and gets the named DataObject that is cached on RenderingContext. The logic in the BoundValue object then invokes selectValue, the only method in the UIX DataObject interface, which in turn calls the getAttribute method on the underlying view object to retrieve the value. That value is put on the BoundValue.getValue method, and is the value returned for the attribute at rendering time. Attention To guarantee thread-safety in a multi-threaded enviroment, OA Framework uses data bound values (OABoundValue) for web bean attribute values. Classes that implement OAWebBean use the data bound values wherever necessary. If these web bean classes provide multiple versions of a method such as setText(String text) and setText(OAPageContext pageContext, String text), then to use data bound values, be sure to select the one that has the OAPageContext parameter. The method without OAPageContext is usually inherited from the super class. For example, use OAMessageTextInputBean.setText(OAPageContext page context, String text) instead of OAMessageTextInputBean.setText(String text). Avoid calls like setAttributeValue(TEXT_ATTR, "<hardcoded string>"), as the attribute value is not a data bound value in this case. If you intend to set your custom attribute value through the setAttributeValue method, you should set the attribute value to your own custom data bound value object. Attention When you want to get an attribute value from a bean, use the getAttributeValue(RenderingContext, AttributeKey) signature whenever possible to ensure that the attribute value is resolved correctly. Simply calling the attribute accessor or the getAttributeValue(AttributeKey) method without the RenderingContext parameter, may return incorrect results if the attribute was set as a bound value. For example, use: getAttributeValue(pageContext.getRenderingContext(), RENDERED_ATTR); The public Oracle Applications bound values that you can use are as follows and are discussed in more detail in the Runtime Control section: OADataBoundValueAppModule OADataBoundValueViewObject OAFunctionSecurityBoundValue Data Binding for Fields Outside a Table When OA Framework implements bound values for fields outside of a table, the named dictionary of DataObjects is maintained with the current context. The data object name for each bean is defined by: 171
Application module name and view object instance name - for view object data NON_VIEW_OBJECT_DATA (static variable in oracle.apps.fnd.framework.webui.OAWebBeanConstants interface) - for non-view object data The data attribute name for each bean is defined by: View attribute name - for view object data Region code, item name, etc. - for non-view object data Data Binding for Fields in a Table When you implement bound values for fields in a table, OA Framework generates a DataObjectList instead of a single DataObject. A DataObjectList is simply a list of DataObjects. UIX iterates through the list, setting the "current DataObject" for each iteration. As a result, the bound value on the text attribute (TEXT_ATTR) uses the "current DataObject" to fetch its value, as described above.
Declarative Implementation
Certain attributes (the Required, Rendered, Disabled, and Read Only properties in the Property Inspector) can be bound to values declaratively using SPEL binding. For other attributes where there is currently no means for declaratively implementing bound values, a later release of OA Framework will provide more general declarative data binding support.
Runtime Control
OA Framework provides three implementations of bound values that you can use: oracle.apps.fnd.framework.webui.OADataBoundValueViewObject, oracle.apps.fnd.framework.webui.OADataBoundValueAppModule and oracle.apps.fnd.framework.webui.OAFunctionSecurityBoundValue.
OADataBoundValueViewObject
You can use the OADataBoundValueViewObject class to bind a web bean's property with a view object attribute. To do this, set the attribute, representing the web bean's property, to: new OADataBoundValueViewObject(webBean, viewAttrName) At rendering time, the attribute value becomes the value of the viewAttrName of the view instance associated with the web bean (which defaults to the OA Extension View Instance property). If you wish to override this default view instance, you can use the alternate constructor that allows specification of the view usage name: new OADataBoundValueViewObject(webBean, viewAttrName, viewUsageName) You can also indicate whether or not to format the output of a bound value. Specify OADataBoundValueViewObject as follows, to bind attributes that need to be formatted and rendered on the page (such as TITLE_ATTR, TEXT_ATTR, PROMPT_ATTR, ...). The output that results is always a string, formatted according to the data type of the web bean or view attribute: OADataBoundValueViewObject(OAWebBean webBean, String lookupName, String viewUsageName)OADataBoundValueViewObject(OAWebBean webBean, String lookupName) Specify OADataBoundValueViewObject as follows, to bind attributes that do not need to be formatted and rendered on the page (such as RENDERED_ATTR, READONLY_ATTR, DISABLED_ATTR, ...). Pass formatToString as 'false'. OADataBoundValueViewObject(OAWebBean webBean, String lookupName, String viewUsageName, boolean formatToString)
Example The following code shows how to bind the currency code attribute of the Total bean to display a formatted total according to the currency code attribute value of each row in a table: // Now format the order total value based on the PO's currency code. // "CurrencyCode" is the name of the attribute in the POSimpleSummaryVO // that this table is referencing. OAMessageStyledTextBean orderTotal = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("OrderTotal"); if (orderTotal !== null) { orderTotal.setAttributeValue(CURRENCY_CODE, new OADataBoundValueViewObject(orderTotal, "CurrencyCode")); }
OADataBoundValueAppModule
You can use the OADataBoundValueAppModule class to bind a web bean's property with a value returned from an application module. To do this, override initializeWebValues(Hashtable paramValues) in the application module to put values into the Hashtable keyed by a lookupName. For example, to have a specific web bean's prompt derived from one of the values returned by the application module, put (lookupName, "Value of the prompt"). Then set the attribute, representing the property of the web bean to: new OADataBoundValueAppModule(webBean, lookupName) At rendering time, the attribute value is fetched from the web values Hashtable based on lookupName.
OAFunctionSecurityBoundValue
OAFunctionSecurityBoundValue is a bound value that returns Boolean.TRUE or Boolean.FALSE based on whether the current session user is authorized to access a specific function. Use this class to check whether a certain function is granted based on specific data context. For example, you can bind the RENDERED_ATTR attribute to a function so that the bean is hidden if the function is not granted //Hides the customer name bean if function 'ShowCustomerNameFunction' is not granted. ... OAFunctionSecurityBoundValue fSBoundValue = OAFunctionSecurityBoundValue("ShowCustomerNameFunction"); custNameBean.setAttribute(pageContext.getRenderingContext(), RENDERED_ATTR, fSBoundValue); ... Other UIX Bound Values UIX provides many other useful bound values. The following table lists the bound values that support some basic operations. Operations Arithmetic Comparison Type Conversion Matching Attribute Values Among Beans UIX Bound Values AddBoundValue, ConcatBoundValue ComparisonBoundValue, AndBoundValue, OrBoundValue, NotBoundValue ToBooleanBoundValue, ToDateBoundValue, ToCharacterBoundValue, ToIntegerBoundValue, ToStringBoundValue NodeAttributeBoundValue
For a complete list of UIX bound values, refer to the oracle.cabo.ui.data.bind package. Example 1 The following code shows how to bind a property based on the value of another property. In this case the total 173
bean is not rendered if the salary bean is not rendered: OAMessageStyledTextBean totalBean = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("totalBean"); OAMessageStyledTextBean salaryBean = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("salaryBean"); if(totalBean!=null && salaryBean!=null) { totalBean.setAttribute(RENDERED_ATTR, new NodeAttributeBoundValue(salaryBean, RENDERED_ATTR)); } Example 2 The following code shows how to use UIX standard bound values to achieve more complex or compound binding. In this example, the name attribute is concatenated with the description attribute at rendering time: OAHeaderBean headerBean = (OAHeaderBean)webBean.findIndexedChildRecursive("headerBean"); if (nameBean!==null && descBean!=null && headerBean!=null) { headerBean.setAttributeValue(TEXT_ATTR, new ConcatBoundValue(new BoundValue[] {new OADataBoundValueViewObject(concatBean,"Name", viewUsage), new OADataBoundValueViewObject(concatBean, "Description", viewUsage)}); } Form Submit Bound Values See Submitting the Form for additional information about bound values that can be used in specific cases where you need to force a form submit when a component is activated.
Personalization Considerations
See a summary of Bound Values personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guideline(s) None Javadoc oracle.cabo.ui.data.BoundValue oracle.cabo.ui.data.DataObject oracle.cabo.ui.data.DataObjectList oracle.cabo.ui.RenderingContext oracle.apps.fnd.framework.webui.OAWebBeanConstants oracle.apps.fnd.framework.webui.OADataBoundValueViewObject oracle.apps.fnd.framework.webui.OADataBoundValueAppModule oracle.apps.fnd.framework.webui.OAFunctionSecurityBoundValue OA ToolBox Tutorial / Sample Library Delete Lab Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
174
Branding
Overview
As described in the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Branding [ OTN Version ], every OA Framework page reserves the upper left-hand corner for either: Basic (Non-Contextual) Branding - includes corporate ("Oracle") and product brand names In-Context Branding - includes user-selected contextual information in addition to the corporate and product brand names All OA Framework pages must provide basic branding support as described below. In-Context branding may be used in select cases (see Oracle Branding Options in the guideline for specific use case recommendations).
Figure 2: FND: Branding Size Profile Option Value set to "Regular" (corresponds to BLAF "Large" Layout)
Figure 3: FND: Branding Size Profile Option Value set to "Medium" (corresponds to BLAF "Medium" Layout)
Regular Layout
175
Pages Launched from the E-Business Suite Personal Home Page If your OA Framework page is launched from the Navigator in the E-Business Suite Personal Home Page, the OA Framework automatically sets the branding text for you based on the current selected responsibility and page link. This ensures consistency for the user between the options presented in the Navigator, and the branding text displayed on the application page. Note: The default branding is set only if the FND:Framework Compatability Mode profile option value is set to 11.5.10. For example, as shown in the Navigator in Figure 4, the user has selected the responsibility Workflow Administrator Web (New). The top-level menu associated with this responsibility has two submenus with prompts: Administrator Workflow and Transaction Monitor. If the user selects a link beneath one of these submenus (the corresponding function must be of type JSP or INTEROPJSP), the OA Framework automatically sets the branding text to the parent submenu's prompt. If the user selects the Business Events in the example below, the OA Framework sets the branding text to Administrator Workflow. If the user selects the Transaction Monitor link in the example below, the OA Framework sets the branding text to Transaction Monitor (if the Transaction Monitor link label were to be changed to "My Monitor," the branding text would still be set to Transaction Monitor since the link prompt has no effect on this). Figure 4: E-Business Suite Personal Home Page Navigator
If you attach a function directly to the responsibility main menu instead of a grouping submenu, the branding text defaults to the responsibility name. For example, assume you have the following structure based on the Workflow use case shown above. Note that the new "Worklist" function is attached directly to the main menu. When this page renders, the branding text will be Workflow Administrator Web (New). Workflow main menu // root menu associated with the Workflow Administrator Web (New) responsibility | -- Worklist (function)| -- Administrator Workflow (grouping menu) | -- Home (function) | -- Developer Studio (function) | -- Business Events (function) | -- Status Monitor (function) | -- Notifications (function) | -- Transaction Monitor (grouping menu) | -- Transaction Monitor (function) In this case, you can either add a grouping menu to your main menu and move the function accordingly, or you can use the manual override instructions provided below. Small Branding Override If the default behavior is unacceptable, you can override it by following these instructions: Step 1: Define a form function to represent your branding text (see Tabs / Navigation if you need information on creating application functions and menus). Note that the User Function Name value must be set to the branding text that you want to display in the upper left-hand corner of your application's pages. For example, in 176
the OA Framework ToolBox Tutorial, we defined a function with the following properties. The value "OA Framework ToolBox Tutorial" displays in the branding area. Function: FWK_TOOLBOX_BRAND User Function Name: OA Framework ToolBox Tutorial Step 2: Associate this function with your application's "Home Page" navigation menu. Note: It's important that you do not specify a prompt when you associate your branding function with the menu. Figure 3 shows the FWK_TOOLBOX_BRAND function properly associated with the ToolBox Tutorial's "Home Page" navigation menu. Figure 3: OA Framework ToolBox Tutorial "Home Page" menu with branding function
Step 3: Set the request parameter OAPB to the name of the function that you created in Step 1. You should specify this wherever you set the menu context OAHP request parameter (see Tabs / Navigation if you need information about this). For example, if you access your application from a test JSP, the page link should include the OAPB parameter in addition to the OAHP and the OASF menu parameters. This is illustrated in the URL below from the OA Framework ToolBox Tutorial test_fwktutorial.jsp: <a href="<%=URLMgr.processOutgoingURL("OA.jsp?OAFunc=FWK_TOOLBOX_HELLO &OAPB=FWK_TOOLBOX_BRAND&OAHP=FWK_TOOLBOX_TUTORIAL_APP &OASF=FWK_TOOLBOX_HELLO&transactionid=" + transactionid + "&dbc=" + dbcName, macKey) %>">Hello,World!</a><br> Alternatively, you can specify the product branding on the page itself: Step 1: For each page in your application, select the pageLayout region in the JDeveloper structure pane, right-click and select New > productBranding. Set the corresponding item's Style to formattedText. Assign the formattedText item a standards-compliant ID, and set the Text property to product name that you want to display in the branding area. The following matrix describes the precedence order for the different sources of the Small branding text value. The OAPB parameter, if specified, always prevails. The declarative page setting also overrides the automatic setting of the grouping menu value. The responsibility name displays only if no other options are available. OAPB Parameter Declarative Product Branding Grouping Submenu Result: Branding Source Specified Not specified Not specified Grouping Submenu Specified Not specified Specified OAPB Specified Not specified Specified Declarative Product Branding Specified Specified Specified OAPB 177
Not specified
Not specified
None
Responsibility
Once the branding context is set, it remains unchanged until you explicitly reset the OAPB parameter value. Options for resetting this value include: Defining in in a URL associated with a item Defining it in a navigation function's Web HTML call Passing it as a parameter in a JSP forward or client redirect method call Tip: If you support switching application contexts at runtime, remember to change your brand! Pages Launched from Forms For OA Framework pages launched from a form, the branding text should render as the display name of the current form function. To do this, call fnd_function.user_function_name in your form and set the OAPB branding parameter to this value when you open the OAF page. For additional information about opening OA Framework pages from Forms, see the Forms / OA Framework Integration document. For OA Framework pages launched from a link in the Forms Navigator, the branding text should render as the display name of the associated form function. So, when you define this form function's Web HTML Call, set the OAPB parameter value to the current function name.
Large Layout
Declarative Implementation To provide support in your application for the large branding option: Step 1: For Oracle E-Business Suite applications: if you have not already done so, request a branding image from the corporate UI Design and Usability team (the branding image includes a collage and your product's brand name). When your branding image is ready, the OA Framework team automatically includes it in the next regularly scheduled "images" ARU. Note: The UI team will create two versions of your branding image: one for use in the Large layout (this the image you must specify) and a smaller one for use if the Medium FND: Branding Size profile option is set at the customer site. Step 2: For each page in your application, select the pageLayout region in the JDeveloper structure pane, right-click and select New > productBranding. JDeveloper creates a pageLayoutComponents folder containing a productBranding item. Step 3: Set this item's Style to image and assign it a standards-compliant ID. Step 4: set the Image URI property to the name of your product's branding image (for example, FNDBRAND.gif), and set the Additional Text property to the name displayed in the image (for example, Payroll Administration). Note: If the Additional Text property is not set, the OA Framework displays the name of the branding image as the ALT Text. Runtime Control Although you can change the branding for a page at runtime (see the oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean Javadoc), there is usually no reason to do so.
In-Context Branding
The in-context brand includes the corporate and product brand images. Additionally, contextual information renders below the corporate and product information as shown in Figure 4. Figure 4: Example of in-context branding
Note that this style of brand is intended to be used only for cases where the user makes a contextual selection 178
when starting work that remains unchanged for the life of the application or task.
Declarative Implementation
Step 1: For each page in your application, select the pageLayout region in the JDeveloper structure pane, right-click and select New > productBranding. Set the corresponding item's Style to formattedText instead of "image" as you did above. Assign the formattedText item a standards-compliant ID, and set the Text property to product name that you want to display in the branding area. Step 2: Select the pageLayout region again, right-click and select New > inContextBranding. Set the corresponding formattedText item's ID and set the Text property to the context you wish to display (for example, this would be "Customer <b>Sun Microsystems - Menlo Park</b>" in Figure 4 above). Note: Creating an inContextBranding component without a productBranding component is invalid. The OA Framework throws a Developer Test Mode error for this condition if you work with this test mode enabled.
Runtime Control
If you need to change the contextual information programmatically, you can do the following: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAFormattedTextBean inContextTextBean = (OAFormattedTextBean)createWebBean(pageContext, FORMATTED_TEXT_BEAN); // Remember that you must pass a translated value obtained from message dictionary, // not a static String as shown here. inContextTextBean.setText("Text for In-Context Branding"); // Ensures the correct CSS style is applied. inContextTextBean.setStyleUsage(IN_CONTEXT_BRANDING_STYLE); OAPageLayoutBean page = pageContext.getPageLayoutBean(); page.setInContextBranding(inContextTextBean); }
Personalization Considerations
See a summary of Branding personalization considerations in the Oracle Applications Framework Personalization Guide. You can also refer to the section called Personalizing Your System: Branding in the Oracle Applications Framework Personalization Guide for additional information.
Known Issues
The default Small branding text does not display in a mobile page.
Related Information
BLAF UI Guidelines Branding [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
179
Bulleted List
Overview
Simple, HTML bulleted lists appear in numerous BLAF UI Guideline specifications. For example, they are routinely used in content containers as shown below: Figure 1: Example of a content container with a bulleted list.
As implemented in the OA Framework, the bulleted list is a container that can hold any kind of children (although, for all practical purposes, most bulleted lists are simply comprised of plain text or links). Each region item is rendered with a bullet. The bulleted list can be split into columns by specifying the maximum number of rows (bullet items) that should render in a column before starting another until the 3 column maximum is reached. Once the total number of rows would exceed 3 columns using the specified multiplier, all rows are allocated as evenly as possible to 3 columns.
Declarative Implementation
To add a bulleted list to your page, follow these steps. The OA Framework will create an oracle.apps.fnd.framework.webui.beans.layout.OABulletedListBean. Step 1: Create a region item set its style to bulletedList. Step 2: Set the region's ID property in accordance the OA Framework FIle Naming Standards. Step 3: Add one or more items to the bulletedList. They can be of any item style. Step 4: (optional) Set the Height property to determine how many items should render before a new column is created. Step 5: Save your work.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate See the oracle.apps.fnd.framework.webui.OAControllerImpl Javadoc for other createWebBean*() signatures. Note: Always choose a signature that lets you specify the web bean's internal name. import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.layout.OABulletedListBean; ... processRequest(OAPageContext pageContext, OAWebBean webBean) { ...
180
// Create the list bean container OABulletedListBean bullets = (OABulletedListBean)createWebBean(pageContext, OAWebBeanConstants.BULLETED_LIST_BEAN, null, "bulletList"); // Create and add a link, plain text and an image to the bulleted list OALinkBean link = (OALinkBean)createWebBean(pageContext, OAWebBeanConstants.LINK_BEAN, null, "linkEx"); OAStaticStyledTextBean text = (OAStaticStyledTextBean)createWebBean(pageContext, OAWebBeanConstants.STATIC_STYLED_TEXT_BEAN, null, "textEx"); OAImageBean image = (OAImageBean_createWebBean(pageContext, OAWebBeanConstants.IMAGE_BEAN, null, "imageEx"); bullets.addIndexedChild(link); bullets.addIndexedChild(text); bullets.addIndexedChild(image); ... Control Visual Properties To set the multiple after which the rows are split into columns, get a handle to the bulleted list bean and call setRows(int). The default split size is 10. You can also pass the value Integer.MAX_VALUE as the parameter if you want all your bullet items to render in a single column, regardless of their number.
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guideline Content Containers in a Page [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.layout.OABulletedListBean ToolBox Tutorial / Sample Library oracle.apps.fnd.framework.toolbox.samplelib.webui.SampleBrowserPG.xml Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
181
Buttons (Action/Navigation)
Overview
As described in the BLAF UI Guideline: Buttons (Action/Navigation) [ OTN Version ] specification, action/navigation buttons can be used to: Perform actions without navigating the user off the page (the page redraws with evidence that an action has been performed) Navigate the user to another page without performing any actions Perform an action and navigate the user to another page Action/navigation buttons can be placed as follows within a page. In relation to a single field, poplist, or text area In relation to a group of standard widgets In relation to a table In relation to the entire page (as individual action buttons, or within a multistep navigation control) Figure 1: BLAF UI Guidline illustration of all possible action/navigation button usages within a page
182
183
This document describes how to implement each of the following: Action (Submit) Buttons Navigation (Link) Buttons It also describes how to position buttons in different page locations (for example, page-level buttons). For information on implementing buttons for navigating multistep transaction flows, see the Locator Element: Page/Record Navigation document.
Declarative Implementation
To add a submit button to your page (regardless of its location) follow these steps. The OA Framework will instantiate an oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean with the name you assign the region item in Step 1. Step 1: Create a region item and set its style to submitButton Step 2: Set the region item's ID property in accordance the OA Framework File naming standards. Step 3: (optional): I you're adding a common button (like the "Apply," "Go," or "Cancel" buttons, or a standard button for your product), specify an attribute set. For example, the standard OA Framework "Go" button attribute set is: /oracle/apps/fnd/attributesets/Buttons/Go See Implementing the View for additional information about using attribute sets. Step 4: (assuming no attribute set): Specify the button label by setting the Prompt property. Step 5: (assuming this isn't inherited from the attribute set): Specify the ALT text by setting the Short Description property. This value is required for assistive technologies, and is also displayed as tooltip text when a mouse moves over the button.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically-created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate To instantiate an OASubmitButtonBean, call the appropriate createWebBean() factory method in the oracle.apps.fnd.framework.webui.OAControllerImpl class. If you select a signature that requires a constant to determine what kind of bean to create, use oracle.apps.fnd.framework.webui.OAWebBeanConstants.BUTTON_SUBMIT_BEAN. Control Visual Properties The only visual property of a button that you might change at runtime is its text. To do this, get a handle on the OASubmitButtonBean and call its setText(pageContext, String) method. Remember when setting String values displayed in the user interface to always obtain the value from Applications Message Dictionary first. Never set a hard-coded value. Control Behavior and Data In rare cases, the BLAF UI Guidelines allow for buttons to be disabled. To disable a button, get a handle on OASubmitButtonBean and call its setDisabled(boolean) method. You might also want to turn off Javascript onSubmit validation when the button is pressed (for example, you have a submit button that might be pressed before a page's data is fully entered by the user, and you don't want to annoy him with premature validation errors). In your controller's processRequest() method, get a handle to the OASubmitButtonBean and call its setUnvalidated(Boolean) method. Finally, you can also turn off server-side validation when a submit button is pressed. In this case, all page data will be pushed to the underlying view object(s) (and corresponding entity objects) where server-side validation will be performed, however, any exceptions will be ignored so code that you write in processFormRequest() will 184
proceed as if there had been no validation performed in the processFormData() phase. To implement this in your controller's processRequest() method, get a handle to the OASubmitButtonBean and call its setServerUnvalidated(Boolean) method. For additional information about the submit processing phases, see Implementing the View. For information about bypassing validation, see Implementing the Controller. Tip: If you define a button and you don't want it to perform either client or server-side validation (a transaction "Cancel" button is a common example if you don't need to implement special processing when it's pressed), consider making it a plain navigation button instead. Handle Button Press Events When the user selects a submit button, the browser performs an HTTP POST while adding the button's name to the request (note that this name is set to the button's ID property, or the name value specified when creating the web bean programmatically). To ascertain whether a particular submit button has been pressed , add the following code to a controller associated with a region above the button in the page's bean hierarchy. public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { ... // Check to see if a submit button named "Go" has been pressed. if (pageContext.getParameter("Go") != null) { ... If the action button that you're implementing should also navigate the user to another page after performing an action (or you need to forward back to the current page so you can edit the web bean hierarchy in processRequest()), use the setForward*() methods in the oracle.apps.fnd.framework.webui.OAPageContext.
Declarative Implementation
To add a plain, link-like button to your page (regardless of its location) follow these steps. The OA Framework will instantiate an oracle.apps.fnd.framework.webui.beans.nav.OAButtonBean with the name you assign the region item in Step 1. Step 1: Create a region item and set its style to button. Step 2: Set the region item's ID property in accordance the OA Framework File Standards. Step 3: (optional): If you're adding a standard button for your product, specify an attribute set. See Implementing the View for additional information about using attribute sets. Step 4: (assuming no attribute set): Specify the button label by setting the Prompt property Step 5: (assuming no attribute set): Specify the ALT text by setting the Short Description property. This value is required for assistive technologies, and is also displayed as tooltip text when a mouse moves over the button. Step 6: Specify the Destination URI property as shown in the following examples: OA.jsp?OAFunc=FWK_TBX_EMPLOYEE&retainAM=Y OA.jsp?page=/oracle/apps/fnd/framework/toolbox/tutorial/webui/PoDetailsPG See Implementing the View for additional information about specifying URL parameters.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically-created web beans cannot be personalized, reused, or extended easily. 185
See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate To instantiate an OAButtonBean, call the appropriate createWebBean factory method in the OAControllerImpl class. If you select a signature that requires a constant to determine what kind of bean to create, use OAWebBeanConstants.BUTTON_BEAN. Control Visual Properties The only visual property of a button that you're likely to change is whether it's displayed or not. To do this, get a handle to the OAButtonBean and call its setRendered(boolean) method. You can also change its prompt by calling its setText(pageContext, String) method, and its ALT text by calling setShortDescription(String). Remember when setting String values displayed in the user interface to always obtain the value from Applications Message Dictionary first. Never set a hard-coded value. Control Behavior and Data In rare cases, the BLAF UI Guidelines allow for buttons to be disabled. To disable a button, get a handle the OAButtonBean and call its setDisabled(Boolean) method. If you need to set the button's destination programmatically, always specify the URL in relation to the document root node. For example: Handle Button Press Events When the user selects a plain navigation button, the browser issues an HTTP GET request to display the new target page. There is no need to write any code to ascertain whether the button is pressed. If you must handle the button press before navigating to a new page, create an OASubmitButtonBean instead.
Declarative Implementation Note: You must specify a page title for your page if you want the page-level action/navigation buttons to appear at the top of the page. If you don't set this value, they will appear only beneath the "ski." See Headers and Subheaders for additional information about specifying a page title. 186
To add page-level action/navigation buttons: Step 1: Select the pageLayout region and add a region beneath it with the style pageButtonBar. The OA Framework will an instantiate an oracle.apps.fnd.framework.webui.beans.nav.OAPageButtonBarBean. Step 2: Add one or more buttons to the pageButtonBar region (follow the instructions above for adding specific button types). Add them in ascending sequence as you want them to appear from left to right. So, for example, if you have a "Cancel" and "Apply" button on your page, and you want them to render with "Apply" being the rightmost button as specified in the UI Guidelines, add the "Cancel" button first. Note: The OA Framework automatically adds the correct amount of space between buttons when you add them to the pageButtonBar. Runtime Control Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. To instantiate the OAPageButtonBarBean for page-level action/navigation buttons, follow this example showing an OASubmitButtonBean "Apply" and an OAButtonBean "Cancel": import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.form.OASubmitButtonBean; import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean; import oracle.apps.fnd.framework.webui.beans.nav.OAButtonBean; import oracle.apps.fnd.framework.webui.beans.nav.OAPageButtonBarBean; ... processRequest(OAPageContext pageContext, OAWebBean webBean) { ... // Assuming the controller is associated with the pageLayout region OAPageLayoutBean page = (OAPageLayoutBean)webBean; // Remember to use Message Dictionary for UI Strings; never hard-code Strings as shown here. // Always use the createWebBean signatures that let you specify the component's internal name, // unless you're creating a web bean defined in JDeveloper. OAPageButtonBarBean buttons = (OAPageButtonBarBean)createWebBean(pageContext, OAWebBeanConstants.PAGE_BUTTON_BAR_BEAN, null, "pbBar"); OASubmitButtonBean applyButton = (OASubmitButtonBean)createWebBean(pageContext, OAWebBeanConstants.BUTTON_SUBMIT_BEAN, null, "applyButton"); applyButton.setText("Apply"); OAButtonBean cancelButton = (OAButtonBean)createWebBean(pageContext, OAWebBeanConstants.BUTTON_BEAN, null, "cancelButton"); cancelButton.setText("Cancel"); // Now add the buttons to the page button bar. Remember to add them as you want them // to display from left to right (in an American UI). buttons.addIndexedChild(cancelButton); buttons.addIndexedChild(applyButton); // Finally, set the page button bar on the page layout. This example assumes the 187
Region-Level Buttons
Buttons that relate to a region render right-justified immediately below the region header as shown below. Figure 3: example of a region-level button
For a reference implementation, select the Buttons (Action/Navigation) option in the ToolBox Sample Library.
For a reference implementation, select the Buttons (Action/Navigation) option in the ToolBox Sample Library.
Component Button
A button that relates to a single component (like a field or poplist) renders immediately to the right of the component as shown below. A "Go" button for a single search field is a common example. Figure 5: example of a button in relation to a single widget
For a reference implementation, select the Buttons (Action/Navigation) option in the ToolBox Sample Library
Table Button
Buttons that relate to an entire table render right-justified immediately above the table as shown below. A button for creating objects displayed in the table is a common example. 188
For a reference implementation, select the Buttons (Action/Navigation) option in the ToolBox Sample Library. Buttons that perform actions on a selected table row are a special case. See the tables (classic or advanced) documentation for additional information about implementing control bar buttons and poplists.
Known Issues
None
Related Information
BLAF UI Guideline(s) Buttons (Action/Navigation) [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean oracle.apps.fnd.framework.webui.beans.nav.OAButtonBean oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean oracle.apps.fnd.framework.webui.beans.nav.OAPageButtonBarBean OA Framework ToolBox Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
189
Buttons (Global)
Overview
As described in the BLAF UI Guideline: Buttons (Global) [ OTN Version ] specification, global buttons provide access to tasks that apply to an entire application , and as such, are accessible from every page in the application. Global buttons render in the upper right-hand corner of an application above its tabs as shown below: Figure 1: OA Framework ToolBox Tutorial Application global buttons with "Regular" branding
Note: If the FND: Branding Size profile option value is set to Medium or Small (see Branding), the global buttons render as links without the corresponding icon as shown below: Figure 2: OA Framework ToolBox Tutorial Application global buttons with "Medium" branding
For information about Application Switchers (which appear with the global buttons) see Switchers (Application, Context, Table Content).
Declarative Implementation
Global buttons are included in an application's menu definition; they are not defined as an OA component region in JDeveloper. Customers can disable global buttons for specific responsibilities and users by leveraging the Application Object Library function security features. Tip: Menus are cached. If you change a menu for an application that you're running within JDeveloper, remember to terminate the OC4J server (Run > Terminate) and re-run your .jsp page to see your menu changes. If you change a menu for a deployed application (as opposed to one that you're running within JDeveloper), remember to bounce the web application server's listener and JVM to see your menu changes.
190
Diagnostics and Personalize Global Buttons There are two additional "standard" global buttons that render only if corresponding profile options are set: As shown in Figure 1 above, the Diagnostics button gives users the ability to view log messages for a page (customers generally use this feature under the guidance of an Oracle Support representative). To enable this global button, set the FND: Diagnostics profile option value to Yes at the appropriate level for your needs. See Logging for additional information. The "Personalize" button gives users the ability to personalize the current page. To enable this global button, set the Personalize Self-Service Defn profile option to Yes at the appropriate level for your needs. See the Personalization Guide for additional information. Help Global Button When a user selects the global Help button, the OA Framework uses the Application Object Library iHelp technology to present page-level context-sensitive help content. To enable context-sensitive Help for a page, you must specify the Help Target property in JDeveloper for the pageLayout region. The Help Target value must be unique. The Help Target value must start with an alpha character, and may not be longer than 40 characters. The Help Target must comply with the following syntax: <appShortName>_<packageFunctionalComponent>_<pageName> (for example, FND_tutorial_HelloWorldPG and FND_labsolutions_HelloWorldPG). The package functional component in this context helps to clearly differentiate pages given that you could have the same page name in different packages owned by the same product. If necessary, you may abbreviate the functional component name. Never abbreviate the product short code; abbreviate the page name only as a last resort. Remember to coordinate with your technical writer so she can incorporate the target in the page's documentation. For detailed information about defining and deploying iHelp content, see the Oracle Applications System Administrator's Guide. Oracle's internal E-Business Suite developers should also review the Applications Documentation Operations web site for other instructions. 191
For Oracle's in-house E-Business Suite developers: If you think you have content to add to the General Preferences menu, please contact the OA Framework team. The following instructions assume you know how to create menus and functions. If not, please read Tabs / Navigation first. Step 1: Create a menu of type PREFERENCES ("App Pref Menu Container"), and add it to your responsibility root menu. Be sure to leave the prompt null. For example: FWK_TOOLBOX_TUTORIAL_APP (responsibility root menu) ICX_STANDARD_GLOBAL_MENU FWK_TOOLBOX_PREFERENCES (Application-specific Preferences container, prompt = "") FWK_TOOLBOX_HELLO_TAB (Tab menu, prompt = "Hello, World") FWK_TOOLBOX_SEARCH_TAB (Tab menu, prompt = "Search") Step 2: Create one or more submenus (of any type; the OA Framework ignores whatever value you set here) and add them to the PREFERENCES menu with prompts. The submenu prompts render as peers to the General Preferences as shown for the Application link in Figure 4 above. Add page-level functions to these submenus. For example, to include an application-specific preferences menu entry called "ToolBox,", we would create the following menu structure for the ToolBox Tutorial. Note that this example creates two different preferences pages under the "ToolBox" menu entry. FWK_TOOLBOX_TUTORIAL_APP (responsibility root menu) ICX_STANDARD_GLOBAL_MENU 192
FWK_TOOLBOX_PREFS_CONTAINER (Application-specific Preferences container, prompt = "") FWK_TOOLBOX_PREFERENCES (Peer to "General Preferences", prompt = "ToolBox") FWK_TOOLBOX_PREF_FUNC1 (prompt = "Some Page") FWK_TOOLBOX_PREF_FUNC2 (prompt = "Another Page") FWK_TOOLBOX_HELLO_TAB (Tab menu, prompt = "Hello, World!") FWK_TOOLBOX_SEARCH_TAB (Tab menu, prompt = "Search") Note: Although you can have nested submenus in your PREFERENCES menu, the UI Guidelines recommend that you create as flat a menu as possible. Furthermore, if you want to display only a single page, you can add a function for this page directly to the PREFERENCES menu. Specify a prompt in this case. Warning: If you cloned the OA Framework ICX_STANDARD_GLOBAL_MENU, the new PREFERENCES menu will not automatically appear unless you manually add it to your global menu (do not add a prompt). Note that cloning this menu is highly discouraged; you should use the standard global menu instead, and add your application-specific preferences using the approach described above.
Runtime Control
At runtime, the OA Framework reads the global menu definition(s), reconciles the standard buttons with your buttons, and instantiates an oracle.apps.fnd.framework.webui.beans.layout.OAGlobalButtonBarBean, to which it adds indvidual oracle.apps.fnd.framework.webui.beans.layout.OAGlobalButtonBeans. The OA Framework then sets the OAGlobalButtonBarBean on the oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean by calling its setGlobalButtons(UINode globalButtonsNode) method. Instantiate You should not instantiate global buttons yourself; always create them declaratively. Control Visual Properties At runtime, there are rare occasions when you might need to do the following (we say "rare" because, by definition, global buttons are universally applicable, so it is fairly uncommon to disable or hide them if the user has function security access): To hide or disable an individual global button, use the following processRequest code: if (< condition >) { OAPageLayoutBean page = pageContext.getPageLayoutBean(); // You must call prepareForRendering() if the following code is // included in a pageLayout controller. If you add it further down // in the layout hierarchy, the menus will be fully processed so you // don't need to do this. page.prepareForRendering(pageContext); OAGlobalButtonBarBean buttons = (OAGlobalButtonBarBean)page.getGlobalButtons(); // Note the OA Framework automatically assigns global buttons their corresponding // function name, so this is how you find them. OAGlobalButtonBean button = (OAGlobalButtonBarBean)buttons.findIndexedChildRecursive("<FUNCTION_NAME>"); // Note that you wouldn't do both at the same time... button.setRendered(false); // Hide the global button, or button.setDisabled(true); // Disable the global button so it renders, but is not selectable } To hide all the global buttons, use the following processRequest code: Warning: Hiding all the global buttons is not recommended; you must get UI team approval before doing this, 193
and you must verify that there isn't a declarative alternative (for example, you could create multiple "Home Page" menus for your application and alternate between the one with and the one without global buttons). if (< condition >) { OAPageLayoutBean page = pageContext.getPageLayoutBean(); page.prepareForRendering(pageContext); page.setGlobalButtons((UINode)null); // Must come after prepareForRendering() // And, if for some reason, you don't want to display any tabs, // do the following. page.setTabs(null); } Tip: If you want to create a page with no "chrome" ( no tabs, global buttons and so forth -- typically required when you display content in a secondary browser window), it would be better to create the page without a pageLayout region. In this case, simply create the page starting with a stackLayout, a header with a messageComponentLayout, or whatever other layout you need for your content. If the page has form elements, you must remember to add a form to your page. For example, a typical layout might look like: stackLayout // top region for the page |-- form | -- everything else Without a pageLayout region, the OA Framework won't try to display any menu components, so you don't need to programmatically hide them. Handle Standard Global Button Selection In some cases, you might need to incorporate custom processing when a user selects a standard global button (the "Logout" button is a common case). Since there is no event point for handling this (for example, selecting the standard "Logout" button forwards to the OALogout.jsp), you should programmatically change the destination URL on the "Logout" global button so you can intercept the selection as shown in the following sample code. Note: The following code is provided to assist in cases when it's absolutely essential that you intercept these standard button actions (and any UI deviations have been approved by the UI Design and Usability team). As a rule, this should be avoided. Warning: You must preserve the original destination URL of the standard logout JSP, and your custom JSP should foward to this destination URL when it completes its processing. If you don't preserve the correct URL, or you forget to forward to OALogout.jsp, you may cause a memory leak (the application module will not be released) and a hung session (the session will not be invalidated). processRequest(...) { // Assume you create a JSP called "MyLogout.jsp" to implement your custom processing. String myLogoutDestination = "MyLogout.jsp&<someParam>=...&<someOtherParam>=..."; myLogoutDestination = new OAUrl(myLogoutDestination).createURL(pageContext); String oldLogoutDestination = null; // Find global logout button OAGlobalButtonBean logoutButton = findGlobalButton("ICX_LOGOUT"); // Save old destination url oldLogoutDestination = logoutButton.getDestination(); saveLogoutDestination(oldLogoutDestination); //Set the new destination url logoutButton.setDestination(myLogoutDestination); ... ... 194
// do some custom processing // Always redirect to OALogout.jsp when you're done String finalDestination = getOldLogoutDestination(); <jsp:forward page="<%= finalDestination %>" />
Personalization Considerations
See a summary of Buttons (Global) personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
See a summary of key global button issues with suggested workarounds if available
Related Information
BLAF UI Guideline(s): Buttons (Global) [ OTN Version ] Developer's Guide Tabs / Navigation Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAGlobalButtonBarBean oracle.apps.fnd.framework.webui.beans.layout.OAGlobalButtonBean oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean OA Framework ToolBox Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
195
Contents
The following topics are covered in this document: Overview A Chart and Graph Primer About Graphs About Gantt Charts Supported Chart and Graph Types Bar Graphs Line Graphs Area Graphs Pie Graphs Combination Graphs Secondary Graph Types Scatter Graph Stock Graph Gantt Chart Graphs Declarative Implementation Runtime Control Laying Out Graphs in a Matrix Personalization Considerations Known Issues Charts Declarative Implementation Usage Notes Runtime Control Adding Dependency Lines Using FireAction on the Project Column Using Save Model on the Hierarchy Column Personalization Considerations Known Issues Related Information
yourself with the following graph vocabulary. Figure 2: A Sample Graph with labeled components
197
Familiarize yourself with the following Gantt chart vocabulary. Figure 3: A Sample Gantt Chart with labeled components
In a Gantt chart: The Project column is the tree component of the HGrid and lists the project(s) and project tasks. The Resource column identifies additional information such as who is responsible for the task. This column is set as an indexed child of the Gantt web bean; you can add as many resource columns as 198
needed. The last column in the HGrid displays the graph area of the Gantt chart. A row in a Gantt chart HGrid provides the whole visual representation of a single task. The Calendar axis is a date table appearing at the top of the last column of the HGrid. Horizontal bars, or markers, representing tasks, are positioned relative to this axis. The Minor scale determines the calendar increments shown on the second row of the Calendar axis. Valid choices are: days, weeks, months, quarters, half years and years. In Figure 3 above, the Minor scale is months. For the minor scale, you can specify a Start Time and an End Time. The Major scale determines the calendar increments shown on the first row of the Calendar axis. It has the same valid choices as the minor scale. In Figure 3 above, the Major scale is years. A Start Time and an End Time define the time span of the chart. A Primitive is a visual component defined by its geometric shape, color and pattern. A Marker is a graphical representation of a task in the graph area. It is composed of up to three primitives representing the task's start, middle and end. A marker's start time and end time are bound to the task's DataObject keys. For example, the marker for a default "normal" task type spans the time returned by the GanttConstants.START key to the time returned by the GanttConstants.END key. A Task Type is the type of graphical representation assigned to a task. It is represented by one or more combination of markers. For example, the default "milestone" task type is drawn with a single "milestone" marker that is defined as a black diamond primitive. There are 4 task types in the default set, they are: "normal" (TaskTypeMap.NORMAL_TASK), summary" (TaskTypeMap.SUMMARY_TASK), "milestone" (TaskTypeMap.MILESTONE_TASK) and "variance" (TaskTypeMap.VARIANCE_TASK). milestone normal without percentage complete specified normal with percentage complete specified summary variance You can also add customized Task Types to the TaskTypeMap. The customized Task Type may be constructed with a customized marker. For example, you can define a customized Marker called CRITICAL_MARKER, which is red in color, and use it in the customized Task Type, "criticalTask", as such: criticalTask Primitive red_bar = new Primitive(Primitive.FULL_BAR, Primitive.SOLID, Color.red); Marker critical = new Marker(null, red_bar, null, CRITICAL_START, CRITICAL_FINISH); map.addMarker(CRITICAL_MARKER, critical); // get default set of Task types TaskTypeMap type_map = TaskTypeMap.getDefault(); type_map.addType(CRITICAL_TASK, new Object[]{CRITICAL_MARKER, MarkerMap.PROGRESS_BAR}); A Dependency Line is a black line that connects two or more tasks together to show a dependency between these tasks.
combination graph horizontal clustered bar horizontal percent bar horizontal stacked bar percent area percent line pie stacked area stacked line vertical clustered bar vertical percent bar vertical stacked bar Secondary Graph Types (Secondary graph types are special usage or less common graphs that are associated with particular data types or ways to display unique cases of data. Do not use secondary graph types if the data can be adequately represented by a primary graph type.) point scatter vertical high-low-close stock gantt (***see exception note below) Note: This is a significantly smaller list than the graph types supported by the BI Bean. Attention: All the above graphs are created with the graphTable region style, with the exception of Gantt charts, which are created with the gantt region style. The following section provides you with thumbnail examples of each graph type, including Gantt charts. Note: All images in this section are thumbnail images, and are only intended as sample representations of real graphs. It is not recommended that graphs be this small. Bar Graph A standard graph with vertical and horizontal axes where data is represented as a series of bars. Subtypes include: clustered bar graph, stacked percentage bar graph, absolute percentage bar graph, and dual-Y graph. Graph Thumbnail Graph Type Vertical and Horizontal Cluster Bar Graph Description Each cluster of bars represents a column of data, for easy comparison of the values in a column. Usage Notes Trends over time. Comparison of items at the same time. Percentage or changes in percentage. Relationship of parts to the whole. Changes in all parts of a whole. See Cluster Bar Graph. Useful when viewing proportions of a total percentage. See Cluster Bar Graph Useful when showing accumulations or cumulative data.
Vertical and Horizontal Stacked Percentage Bar Graph Vertical and Horizontal Stacked Absolute Bar Graph
200
Line Graph A standard graph using vertical and horizontal axes where data is represented by a line, or by series of data points connected by a line. It is optional to display the marker points. If the graph contains only marker points (and no line), then it is a point graph. Subtypes include: stack line graph, percentage line graph, absolute line graph, and dual-Y graph. Graph Thumbnail Graph Type Vertical Stacked Line Graph Description A graph in which the lines are stacked. The values of each series are added to the values for previous series. The size of the stack represents a cumulative total. Usage Notes
Shows trends over time. Shows comparisons of items at the same time. Shows rate of data change See Pie Graph for more examples. Lines are stacked and always add up To show differences or trends in parts of a whole. Shows cumulative relationship to 100%. between the data (out of 100% or total data values) rather than exact data values. See Vertical Stacked Line Graph Useful when showing accumulations or cumulative data.
Vertical A graph in which each data marker Absolute Line reflects the exact data values Graph
Area Graph A standard graph using vertical and horizontal axes where data is represented as a filled in area. Subtypes include: stacked area graph, percentage area graph, absolute area graph, and dual-Y graph. Graph Thumbnail Graph Type Vertical Stacked Area Graph Description Area markers are stacked. The values of each series are added to the values for previous series. The size of the stack represents a cumulative total. Usage Notes Shows trends over time. Shows rate of data change. Shows percentage or changes in percentage. Shows relationship of parts to the whole. Shows changes in all parts of a whole. Useful when viewing proportions of a total percentage.
Area markers show the series percentage and always add up to 100%.
201
Pie Graph A graph in which data is represented as sections of one or more circles, making the circles look like sliced pies. Subtypes include: pie, multiple-pie graph, pie bar, ring, multiple-ring, and ring bar graph. Graph Thumbnail Graph Type Pie Graph Description Graph in which one group of data is represented as sections of a circle, making the circle look like a sliced pie. Usage Notes Shows relationship of parts to a whole. Shows percentage or change in percentage. Shows changes in all parts of a whole
Combination Graph A graph in which data is represented in a combination of two graph types against a single Y axis. Subtype includes: dual-Y graph. Graph Thumbnail Graph Type Description Combination Emphasizes one or more graph series of data. Must have at least two series to use this graph type. Shows the relationship of one series to another. Usage Notes A single graph with one or more graph types. You can have a combination of one or more graph types, where each series plotted as "data" is assigned a combination graph type (bar, line or area). For example, with two series plotted as "data", the first series can be set as bar graph type and the second series can be assigned a "line" type. Most often used as a Dual-Y graph, where not only do different series correspond to a different graph type, but also to different Y axes.
Scatter Graph A graph in which data is represented by the location of markers in an area bound by horizontal and vertical axes, where one measure is plotted against another to show correlation. Graph Thumbnail Graph Type Scatter Graph Description Data is represented by the location of data markers. Usage Notes Shows correlation between two different measures, or two dimension members in the same measure. Especially useful with a number of data items to show the general relationship between them.
A graph specifically designed to show, at a minimum, 3 values for each stock (high low close) during a certain time period. A stock graph may additionally show opening stock value and volume. For displaying stock prices over long time periods, it may be preferable to use a line graph, alone or in combination with a stock graph. Graph Thumbnail Graph Type High-LowClose Stock Graph Description Usage Notes
Data shows the high, low and closing prices of a Use to show the high, low stock. Each stock marker displays three separate and closing prices of a values. stock.
Gantt Chart A graph used extensively in project management applications to track individual events and the overall progress of a complex project.
Graph Thumbnail
Description Data is represented by the location and size of data markers. Location indicating a date, and size indicating duration.
Usage Notes Useful for visualizing project planning and scheduling information.
Graphs
Declarative Implementation
To add a Graph web bean to your page, follow these general instructions. Note: All code that you write (and declare) must comply with the OA Framework Standards and Guidelines in Chapter 8. Please pay special attention to the performance standards. Step 1: Create an application module for your Graph web bean, if a root UI application module does not already exist. If a root UI application module exists, your work can be done there, or you can create a new application module and nest it within your root UI application module. Step 2: Create a view object for your Graph web bean, and add it to the application module defined in Step 1. Note that the graph and the data table (if used) must be based on the same view object. All graph columns must also be based on the same view object. As an example, the following query could be used for a graphrelated view object. SELECT position_code, count(position_code) FROM fwk_tbx_employees GROUP BY position_code In this example, position_code defines the column to plot on the X-axis, and count(position_code) defines the column to plot on the Y-axis. Note: A graph does not have to plot all columns specified for the graphTable. When you want to render multiple graphs, you can specify each graph to pick a different subset of columns to plot. Step 3: Add your graph to a page. Select the parent region in the OA Extension Structure pane, then choose New > Region from the context menu. (You can alternatively create this as a reusable region). Note: OA Framework does not support graphs under the Detail Disclosure region of a table, under a table or Advanced table region or under a layout region beneath a table or Advanced table region. 203
Set the following properties on the new region: Give the region a standards-compliant ID. Set the Region Style property to graphTable. Set the Graph Render Style property to one of the following: graph - to display only a graph. If you define multiple graphs, the graphs render one below the other. both - to display a data table as well as a graph, with the graph rendering below the table. If you define multiple graphs, a poplist of graph titles below the table lets you choose the graph to display. The first graph defined is displayed by default under the graph table. Create a controller and specify it in the Controller Class property. (See the Runtime Control section.) A default graphs container is automatically created. Figure 4: Sample structure panel after creating a graphTable region
Step 4: OA Extension automatically adds a graph to the graphs container. You can also add other graphs to the graphs container by selecting the graphs container in the Structure pane, and choosing New > Graph from the context menu. Set the following properties on the graph. Required properties are marked with an asterisk (*). Give the graph a standards-compliant *ID. Set the *Title property to the title you want to display for the graph. Long titles are truncated and appended with an ellipse (...). Set the Size property to the graph size you wish to display: very-small - generates a graph of 200 x 125 pixels (width x height). small - generates a graph of 295 x 250 pixels. (The default size.) medium - generates a graph of 375 x 295 pixels. large - generates a graph of 450 x 325 pixels. custom - generates a graph of custom size, based on the values, in pixels, that you must specify for the width and height properties. Set the *Graph Type property to the graph type you wish to define. Valid values are: absolute area absolute line horizontal clustered bar horizontal percent bar horizontal stacked bar percent area percent line pie point scatter stacked area stacked line vertical clustered bar - default vertical high-low-close stock 204
vertical percent bar vertical stacked bar Set the *Y Axis Label and the X Axis Label properties as appropriate. You can optionally set the Aggregate Function property to apply an aggregate function on all columns defined as data, after they are grouped by the specified groupLabels. Valid values are: none avg max min sum Set the Display Data Markers property to True if you wish to plot the data markers on the graph. The default is False. Set the Display Data Bubble Text property to True if you wish to display bubble text when a user moves the mouse over a data point on the graph. When this property is set to True, the image map for the graph is generated. The bubble text for each data point includes the following: Group, Series, and Value. The default is True. For a combination graph with multiple series of data plotted as a combination of graph types against a single Y axis, also set the Allow Combination Graph property to True. For non-combination graphs, set this property to False. Note that you can only set the Graph Type property to one of the following for a combination graph: horizontal clustered bar vertical clustered bar horizontal stacked bar vertical stacked bar absolute line stacked line absolute area stacked area graph Attention: If the Allow Combination Graph property is set to True on a graph with a Graph Type other than the ones listed above, OA Extension displays a warning at design time and you will also get a run time Exception. For a dual-Y combination graph with multiple series of data plotted as a combination of graph types against two Y axes, also set the Allow Combination Graph property to True and the Display Secondary Axis property to True. For non-combination graphs, set this property to False. Note also that you can only set the Graph Type property to one of the allowed graph types for a combination graph. For a dual-Y (non-combination) graph with multiple series of data plotted as one graph type against two Y axes, also set the Display Secondary Axis property to True and enter a value for the Secondary Y Axis Label property. Note also that you can only set the Graph Type property to one of the following for a dual-Y (non-combination) graph: horizontal clustered bar vertical clustered bar horizontal stacked bar vertical stacked bar absolute line stacked line Step 5: Define the columns of the graphTable (graphData) by expanding the default dataMap container beneath the graph in the Structure pane. OA Extension automatically creates two default graphData columns for you and labels them graphDataN. Select a graphData column and in the Property Inspector: Give the column a standards-compliant ID. Set the View Instance and View Attribute properties to the appropriate view object and view object attribute from which this column gets its data. 205
Set the Purpose in Graph property to one of the following valid values: data - indicates that this column is to be plotted on the Y-axis. You must define one or more data columns. If you define a column as data, you can optionally enter a value for the Prompt property. The value of the Prompt property is used for the legend when multiple data columns are defined or when no seriesLabels column is defined. See the Notes About Graph Columns for more details. groupLabels - indicates that this column is to be plotted on the X-axis as the group labels. When there are many groupLabels, the graph attempts the following options in the order listed to prevent the labels from overlapping: 1. Stagger labels. 2. Rotate labels. 3. Skip labels. seriesLabels - indicates that this column determines the Series in the graph. The View Attribute property for this column defines the values for the legend. For high-low-close stock graphs, set the Stock Value Type property to high, low, or close as appropriate. For all other graph types, set the Stock Value Type property to none. For a combination graph with multiple series of data plotted as a combination of graph types against a single Y axis, you must map at least two data columns. Set the Combination Graph Type property to bar, line or area and optionally specify a value for the Prompt property. Then set the Combination Graph Type property to bar, line or area for the second data column and optionally specify a value for the Prompt property. Repeat the latter step for other data columns that you may have. For a dual-Y combination graph with multiple series of data plotted as a combination of graph types against two Y axes, you must map at least two data columns: For the first data column, set the Combination Graph Type property to bar, line or area, optionally specify a value for the Prompt property and set the Secondary Axis property to True or False. For the second data column, set the Combination Graph Type property to bar, line or area, optionally specify a value for the Prompt property and set the Secondary Axis property to True or False. Just be sure that at least one column has the Secondary Axis property to True. Repeat the latter step for other data columns that you may have. For a dual-Y (non-combination) graph with multiple series of data plotted as a a single graph types against two Y axes, you must map at least two data columns: For the first data column, set the Secondary Axis property to True or False and specify an optional value for the Prompt property. For the second data column, specify an optional value for the Prompt property and set the Secondary Axis property to True or False. Just be sure that at least one column has the Secondary Axis property to True. Repeat the latter step for other data columns that you may have. Make certain you have at least one column defined as data, and only one column defined as groupLabels. If you need to define another column as seriesLabels, select the dataMap container and choose New > graphData from the context menu. Set the properties as described above. Figure 5: Sample structure panel after creating a graph
206
Pie Graphs - Only two columns are required to plot a pie graph: data and groupLabels. Values returned by the groupLabels column are plotted as pie slices. Combination Graphs and Dual-Y Graphs - No column can be mapped as seriesLabel since the series have to be derived from the explicitly defined multiple data columns for the combination graph, rather than the resulting rows of any view object attribute. Scatter Graphs - By definition, the two columns, data and groupLabels, required for the scatter graph must be number columns. Legend Labels - The space that a legend area can occupy is one-fourth the size of the graph. If there are too many legends, the legend text is truncated and appended with an ellipse (...). The legend displayed for a graph is dependent on its graph column definitions. There are three possible scenarios from which legend labels can be derived: From static data - If no seriesLabels column is defined for the graph and a column is defined as data, then the value specified in that data column's Prompt property appears as the legend label. Note that if no value is specified for the Prompt property, then the value returned from the data column's View Attribute property is used as the legend label. From query data - If a column is defined as seriesLabels, the values returned from the View Attribute property of this column is used as the legend. If a single data column is also defined, it's Prompt property value, if defined, is ignored. From both query and static data - If a seriesLabels column and multiple data columns, with Prompt property values are defined for a graph, the legend label is a concatenation of the values specified in the Prompt property and the view attribute value returned by the seriesLabels column. For example, if you have 2 data columns with Prompt set to Salary and Commission, and one seriesLabels column, returning view attr values of slvaN the concatenation looks like: "Salary, slva1", "Salary, slva2", "Commission, slva1" and "Commission, slva2" Step 6: If you want to add a data table to your graph, select your graphTable region in the Structure pane, and choose New > tabularFormat from the context menu. OA Extension automatically creates a table region for you under the tabularFormat container. Figure 6: Sample structure panel after creating a tabularFormat showing the table created
Step 7: For the data table, you can define new columns in the table or extend from an existing table. To extend from an existing table, select the table region in the Structure pane, and in the Property Inspector, set the Extends property to the table you want to reference. To create a new table, add columns to the table region by selecting the table region and choosing New > Item from the context menu for each column you wish to create. For each item (or table column), set the following properties: Give the item a standards-compliant ID. Set the Item Style property to messageStyledText. Set the Prompt property. Set the View Instance and View Attribute properties. These table columns should be a superset of the information shown in your graph. For more information about tables, see Tables - Classic. Figure 8: Sample structure panel with items in table
207
Runtime Control
To complete your graph implementation: Step 1: Create a controller and associate it to your graphTable region in the Property Inspector by specifying the controller name in the Controller Class property. Warning: It is mandatory for the view object associated with the graph to be executed. If it is not executed, a runtime exception is thrown. Step 2: In the processRequest method of this controller class, add an initQuery method for the view object you defined for the graph. Any parameters that are set must be bound before executing the query. Step 3: Add an initGraphQuery() method (you may name this whatever you would like) to the application module you defined for your Graph web bean. In this method, call your view object's initQuery() method. For example: public void initGraphQuery() { PositionGraphVOImpl vo = getPositionGraphVO1(); if (vo == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME","PositionGraphVO1")}; throw new OAException("ICX", "FWK_TBX_OBJECT_NOT_FOUND",tokens); } // Per Back Button guidelines, never do a blind query without first checking // to see if it's necessary. if (!vo.isPreparedForExecution()) { vo.initQuery(); } } // end initGraphQuery() Step 4: In your controller's processRequest method, invoke the AM's initGraphQuery() method. Destination URI You can programmatically define a destination URI on a graph, that allows users to drill down to additional information. If the Destination URI property is defined on a graph, the URI specified is used as the drill-down URL. The Destination URI can be an absolute URL or a relative URL to an OA Framework page. The group and series values for each data point are appended to the specified destination URI, so that the resulting URL is specifically associated to a particular data point plotted in the graph. The group and series values can be obtained by the destination page using the parameters OAGgroup and OAGseries. For the drill down feature to work, you must also set the Display Data Bubble Text property on the graph to True. Enabling this property generates an image map, which is required for the drill-down feature to work. When a user selects any data point in the graph, the specified URL is launched. The following sample code can be added to the processRequest method in your controller if you wish to 208
programmatically set the drill-down property: //for FWK_TEST_GRAPHSERVLET -Programmatic test for drill down and image map if(webBean.getUINodeName().equals("region2")) { OAGraphTableBean g1 = (OAGraphTableBean)webBean; //Test -If image map is disabled, drill down should not work g1.setDisplayToolTip(0,false); g1.setDrillDownUrl(0,"http://www.oracle.com"); } //Test image map and drill down if(webBean.getUINodeName().equals("region3")) { OAGraphTableBean g2 =(OAGraphTableBean)webBean; g2.setDisplayDataMarkers(0, true); g2.setDrillDownUrl(0, "OA.jsp?page=/oracle/apps/ak/pages/FWK_TEST_AGR_SUM&akRegionApplicationId=601& sal={@Salary}"); //Test line graph with data markers and drill-down g2.setDisplayToolTip(1,true); g2.setDisplayDataMarkers(1, true); g2.setDrillDownUrl(1,"http://www.oracle.com"); }
Suppose you define five graphs in your graphTable region and you set Graph Render Style to graph and Graphs per Row to 2 on the region. When the region renders, it will display two graphs in the first row, two graphs in the second row, and one graph in the third row. Note The matrix layout for graphs is not applicable if Graph Render Style is set to both. When this property is set to both, only one graph displays beneath the data table, along with a poplist of available graphs.
Personalization Considerations
See a summary of Charts and Graphs personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Charts
Declarative Implementation
To add a Gantt chart to your page, follow these instructions. 209
Note: All code that you write (and declare) must comply with the OA Framework Standards and Guidelines in Chapter 8. Please pay special attention to the performance standards. Step 1: Create an application module for your Gantt chart web bean, if a root UI application module does not already exist. If a root UI application module exists, your work can be done there, or you can create a new application module and nest it within your root UI application module. Step 2: Create 2 view objects and 1 view link for your Gantt chart, and then add them to the application module discussed in Step 1. The first view object should query the Project/Task Name list. For example, it may look like this: SELECT project_id, name, start_date, completion_date, start_date start_from, 'summary' task_type, completion_date end_to, '' text_right FROM pa_projects_all WHERE project_id in (2667, 2225) The second view object should query the details of each task. For example, it may look like this: SELECT project_id, top_task_id, task_id, task_number, task_name, scheduled_start_date start_from, scheduled_finish_date end_to, task_manager_name text_right, decode(scheduled_start_date, scheduled_finish_date, 'milestone', decode(top_task_id, task_id, 'summary', 'normal')) task_type FROM pa_tasks_v The view link should link the tasks (first view object) with the task details (second view object), as shown in the example below: Figure 10: Example of View Link SQL
210
Step 3: Add your Gantt chart to a page. Select the parent region in the JDeveloper Structure panel, then choose New > Region from the context menu (note that you can alternatively create this as a reusable region). Set the following properties on the new region: Give the region a standards-compliant ID. Set the Region Style property to gantt. The following property values are examples, and are set based on values from our sample view objects shown above. Set the Task Start Date View Attribute property to the attribute that returns the start date for the marker. In the example shown in Step 2, this would be the StartFrom view attribute. Set the Task End Date View Attribute property to the attribute that returns the end date for the marker. In the example shown in Step 2, this would be the EndTo view attribute. Set the Axis Start Date View Attribute property to the attribute that returns the start date for the axis. In the example shown in Step 2, this would be the StartDate view attribute. Set the Axis End Date View Attribute property to the attribute that returns the end date for the axis. In the example shown in Step 2, this would be the CompletionDate view attribute. Set the Bar Type View Attribute property to the attribute that returns the task type for the chart. In the example shown in Step 2, this would be the TaskType view attribute. This is from the standard task types, or any additional custom task types you have added. Set the Right Text View Attribute property to the attribute that returns the text shown to the right of the marker. In the example shown in Step 2, this would be the TextRight view attribute. There are additional properties we don't use in this example, they are: Left Text View Attribute property is for any text added to the left of the marker. Completed Through View Attribute property is the date that designates how much progress has been completed on a task. Percent Complete View Attribute property is the percentage of task complete. Ignored if non-null value is returned for the Completed Through View Attribute property. If null is returned for both properties, the progress bar will not be shown. Actual Start Date View Attribute property is used for variance task types, and is the start date for the actual bar. Actual End Date View Attribute property is used for variance task types, and is the end date for the actual bar. Baseline Start Date View Attribute property is used for variance task types, and is the start date for the baseline bar. Baseline End Date View Attribute property is used for variance task types, and is the end date for the baseline bar. 211
These following properties are not used in this example but allow you to define dependency lines in the Gantt chart. In order to draw dependency lines, a unique ID needs to be assigned to every task in the Gantt chart. For each task that has a dependency on other tasks, the task IDs of those other tasks must be set as predecessors of the original task. This relationship is defined as a view link. Show Dependency Lines - set to True to render dependency lines. The default is False. Task ID View Attribute - specify the view attribute name that returns a unique task ID. Predecessor Accessor - specify the acessor name in the view link for getting the rowset which contains predecessors. Predecessor View Attribute - specify the view attribute in the predecessor rowset for getting the task ID of a predecessor. Note You must have a working Gantt chart before you add dependency lines to the Gantt chart. Set the Auto Scale property to true or false. false is recommended as you set your own scaling with the Axis Major and Axis Minor properties. When set to true, the Axis Major and Axis Minor properties are ignored. Set the Axis Major property to days, weeks, months, quarters, half-years, or years. Set the Axis Minor property to days, weeks, months, quarters, half-years, or years. Set the Show Current Date property to true or false. Set the Show Bubble Text property to true or false. Step 4: At this point, it is important to refer back to Figure 1, and reacquaint yourself with the fact that a Gantt chart is essentially composed of 2 components. The timeline side of the Gantt chart is driven off of the Gantt web bean. The project/task list side of the chart is a HGrid component. You have just created the timeline side, now you must create the HGrid for the project/task list side. Select the gantt region in the Structure pane, and choose New > Tree from the context menu to create a HGrid tree component. For more information, refer to the HGrid tree component documentation. Give the region a standards-compliant ID. Set the Text property to an appropriate value for the column header of your project/task list. For example, use Project/Task Name. Beneath your tree component, a member category is created, along with an initial item in that category labeled as nodeDef1. Set the properties for nodeDef1. This node is going to be the first column you want to add to your HGrid side. In our example, this is the Project/Task Name data from the first view object. Set the View Instance property to your first view object. Set the View Attribute property to the appropriate attribute from your first view object. For example, in our example, this would be Name. Set the Text property to an appropriate value for the column header of your project/task list. For example, use Project/Task Name. Add a new item to the member category. Right-click on members, and select New > childNode. The childNode is going to provide the means to link the tasks with the task details through the view link you created. The childNode is labeled as childNode1. Set the View Link Instance property of childNode1 to your view link instance. Be sure to use the instance, not just the view link name. Add a new item to the childNode1 category. Right-click on childNode1, and select New > members. There are 2 items created, nodeDef2 and childDef2. For our example, set nodeDef2, and ignore childDef2 as it is not needed. Set the View Instance property to your second view object's second instance. This sounds a bit confusing, however, when you add your view link to your application module, both a view link instance (usually VLname1), and a second instance of your base view object (usually VOname2) is created. Since we are tying the data together through the view link, the view object Instance that you must use in this reference is the one used by the view link. Set the View Attribute property to the appropriate attribute from your first view object. In our example, you would set it to TaskName. 212
Finally, because the test data for the Gantt chart resides in another database, change your project settings. Select your project, choose Project Settings from the context menu, then navigate to Common > Oracle Applications > Runtime Connection. Change the following settings to reflect the location of your test data: DBC File Name Username Password Responsibility Key Attention: If you intend to support the Export feature on a Gantt chart, then different viewAttributeNames cannot be used at different levels in the hierarchy column (Project). All levels of the hierarchy column (that is, all nodeDefs) should have the same viewAttributeName. This is analogous to the definition of all other columns of a HGrid or Gantt. This restriction does not apply if the Export feature is not being used. Step 5: To define table actions, select your gantt region in the Structure pane of OA Extension. Display the context menu and under New, choose the tableActions. This automatically creates a tableActions named child consisting of a flowLayout region. Step 6: Specify a standards-compliant ID for the region and leave the Region Style as flowLayout or set it to rowLayout. Suggestion If you have only buttons to add to the table actions area, then you can use either layout styles, flowLayout being preferrable. However, if you are adding message web beans such as messageChoice or messageTextInput, along with buttons to the table action area, then you should use the rowLayout style. Using a flowLayout instead of a rowLayout in this case may cause alignment problems. Step 7: Under the Layout region, layout the children you want to render as table actions, such as submitButton or messageChoice. Select the Layout region, and choose New > Item from the context menu. Select the new Item that is created and set the item style as appropriate.
Usage Notes
Usage in Non-screen reader mode There is a named child under the gantt component, and it is called descriptionColumns. Figure 11: Example of descriptionColumns named child
This named child allows developers to specify information to be displayed for replacing the graphical component in screen reader mode. Developers can specify as many messageStyledText items as they need beneath it. There is an additional property, Render Description Columns, on the gantt component. Developers can set it to true for rendering Description columns. This can be useful even in non-screen reader mode for people with 213
poor vision. Figure 12: Example of 1 description column and Render Description Columns set to true.
If the Render Description Columns property is set to true, and there are no description columns defined, the gantt bean generates a default description for you. Figure 13: Example of a default generated description
Partial Page Rendering (PPR) in a Gantt Chart If you map an updateable column in a Gantt chart to a view attribute that is used for drawing the Gantt chart, PPR can be enabled so that you can automatically refresh the Gantt chart. For example, suppose you add a messageTextInput item to a gantt region and its view attribute is also the "start date" view attribute for drawing the Gantt chart. When a user changes the date in the column, the Gantt chart is automatically re-drawn to reflect that date. Adjusting the Width of the Gantt Chart OA Framework does not support adjusting the width of a Gantt chart by any means. Even though the Gantt chart is based on the HGrid component (which does allow you to set the width), you should not attempt to alter the width of a Gantt chart by any programmatic means as this may cause distortion of the right image column. For example, if you alter the width of the Gantt chart to 100%, which ties it to the width of the browser, the Gantt chart time line gets distorted when you start to alter the dimensions of the browser window.
Runtime Control
214
To complete your Gantt chart implementation: Step 1: Create a controller and associate it with your Gantt chart's parent region. Step 2: Add an initQuery() method to the first view object you used for your Gantt chart. Step 3: Add an initGanttQuery() method (you may name this whatever you would like) to the application module you used for your graph. In this method, call your view object's initQuery() method. For example: public void initGraphQuery() { TaskListVOImpl vo = getTaskListVO1(); if (vo == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME","TaskListVO1")}; throw new OAException("ICX", "FWK_TBX_OBJECT_NOT_FOUND",tokens); } // Per Back Button guidelines, never do a blind query without first checking // to see if it's necessary. if (!vo.isPreparedForExecution()) { vo.initQuery(); } } // end initGanttQuery() Step 4: In your controller's processRequest method, invoke the application module's initGraphQuery() method. Adding Dependency Lines If you wish to add dependency lines to your Gantt chart, you should add them declaratively. If you must add them programmatically, you can do so by adding similar lines of code to the processRequest method of your controller: myGanttChart.setDependencyLinesVisible(true); myGanttChart.setPredecessorsAccessorName("ParentPredecessorsVO"); myGanttChart.setTaskIdViewAttributeName("TaskId"); myGanttChart.setPredecessorsViewAttributeName("TaskId"); Using FireAction on the Project Column If you want to configure the hierarchy (Project) column of a Gantt chart to perform a form submit when selected, see the Using FireAction on the Hierarchy Column section of the Chapter 4: HGrid topic. Using Save Model on the Hierarchy Column If you wish to implement a Save Model ("Warn About Changes" dialog with links), on the hierarchy column of the Gantt chart, you must code it manually, by including the following code example: OATreeDefinitionBean webBean = ... webBean.setAttributeValue(WARN_ABOUT_CHANGES, Boolean.TRUE);
Personalization Considerations
See a summary of Charts and Graphs personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guideline(s) Javadoc 215
oracle.apps.fnd.framework.webui.beans.layout.OAGraphTableBean ToolBox Tutorial Lessons ToolBox Tutorial Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
216
In the OA Framework, PPR technology is automatically implemented for the following components and actions. Assuming the prerequisites listed later in this document are satisfied, the targets of these actions will be rendered using PPR. Table (data set navigation, sorting, totaling, row insertion, row and cell-level Hide/Show toggling) Hide/Show (toggling) HideShowHeader (toggling) List of Values field (populating LOV input) You can also declaratively define your own PPR events for selected components. For example, you can: Configure the selection of a poplist to cause related fields to render, be updateable, be required or be disabled based on the selected value. Configure the value change of a text field to set related field values (if you set a Supplier value and tab 217
out, the dependent Supplier Site defaults automatically). Configure the selection of a master table's singleSelection radio button to automatically query and display related rows in a detail table.
pressing a button, for example), you typically handled the initiating event in a processFormRequest() method and then issued a JSP forward back to the same page so you could make web bean hierarchy changes in processRequest(). With PPR, this is no longer necessary for most of the UI changes you need to make. Whenever possible, you should leverage the declarative PPR features instead of the programmatic solution. Javascript remains a prohibited technology for Oracle's internal E-Business Suite developers (see Implementing the Controller: Javascript). Changing UI Properties Assuming you've added an item to your page with a style in the list above, the following instructions describe how to configure it to generate PPR events so you can control the properties of related items (for example, you can hide or show appropriate fields when a poplist value changes). You can use SPEL binding (the industrystandard "Simplest Possible Expression Language") to declaratively bind the values of certain properties to view object attributes. Tip: In release 11.5.10, the Rendered, Read Only, Disabled and Required properties are the only ones for which you can define SPEL bindings. If you want to control other properties, you can use bound values (for example, you can use an oracle.apps.fnd.framework.webui.OADataBoundValueViewObject to bind a property to a view object attribute). Note: If you want to change page properties based on a user's List of Values selection, you need to follow a slightly different procedure. See Use the LOV as a Context Switcher in the List of Values document for specific instructions after you read this document. Step 1: Select your item in the JDeveloper Structure pane and set the following properties: Action Type - set to firePartialAction to enable a PPR event (the default value is none). Event - set the name of the event the OA Framework puts on the request when a PPR action occurs (the default value is update). The OA Framework does not impose any restrictions on the event name. Submit - set to True if you want the PPR action to submit the form; False if you want it to perform an HTTP GET request (either way, you will handle the event in your processFormRequest() method). Note that, as of release 11.5.10D, False is not a supported value, however, you may experiment with it. Disable Client Side Validation - set to True if you don't want client side validation to be performed when the PPR event is fired (note that this applies only if the PPR item is configured to perform a form submit). See Implementing the Controller: Disabling Validation for additional information about this. Disable Server Side Validation - set to True if you don't want server-side validation errors to be displayed. See Implementing the Controller: Disabling Validation for additional information about this. Step 2: Create the items whose property values should be set in response to the PPR event. For example, assume you have several text fields whose Rendered and Read Only properties are determined by a poplist value. Create these messageTextInput items and configure their standard properties as you normally would. Note: UIX currently does not support the ability to hide components whose direct parent region is a cellFormat or a rowLayout. As a workaround if you need to hide a button in a cellFormat, for example, you could add flowLayout to your cellFormat region first, and then add the button to that. Additionally, if the target component that you want to effect with the PPR event is a table content switcher, you must add a flowLayout to your table first, and then add the switcher region to the flowLayout region. You should then configure the flowLayout region's properties as described in Step 4 below, and not the switcher's properties. Step 3: In the same package where you created the page's root UI Application Module and any UI-specific view objects, create a special "application properties" view object and add it to your page's root UI application module (or, if you're implementing PPR in a shared region, associate this view object with the shared region's application module). Note that this view object should follow the naming convention of: <ApplicationModuleName>PVO. So, an application properties view object created for an EmployeeAM should be named EmployeePVO. Furthermore, each application module should have no more than one application properties VO. Add a Number primary key transient attribute named RowKey (you'll set a default value of 1 in Step 7 below). Be sure to check the Key Attribute checkbox. Add one or more transient attributes for the properties that you want to set in response to PPR events. 219
Configure the view object so that all the transient attributes are passivated (this is the default configuration). See OA Framework State Persistence Model (Passivation) if you need additional information about passivation. Verify that all the attributes are designated as Updateable Always. The transient attributes should be of the following types based on the properties to be set in response to PPR events (note the list of corresponding valid values for reference when you write code to set these attribute values). Property Attribute Data Type Valid Values Required String yes no uiOnly validatorOnly Read Only Boolean Boolean.TRUE Boolean.FALSE Rendered Boolean Boolean.TRUE Boolean.FALSE Disabled Boolean Boolean.TRUE Boolean.FALSE For example, in the ToolBox Sample Library, we created a SampleBrowserPVO (associated with the SampleBrowserAM) with the following transient attributes: PoApproveReadOnly PoApproveRequired PoApproveRender PoApproveReject Although these transient attributes should serve a specific purpose, they should be as abstract as possible to allow use by several different components within a page or shared region. For example, the PoApproveReadOnly property listed above is intended to be referenced by several different components when the PO approval status changes. This approach is more "abstract" than creating a VO property specifically intended to control the updateable property of "component X." Note: Individual attributes should not be set and referenced by multiple pages; each attribute should be used exclusively within a single page. Since each application module should have only one application property view object, and a single root UI application module might be associated with many pages, your application property VO might include attributes for several pages. Step 4: Open the JDeveloper property inspector for each of the PPR event target items you created in Step 2. Set the Rendered, Read Only, Disabled and/or Required property values to bind to the view object attributes you created in Step 3 using the following SPEL syntax: ${oa.<ViewInstanceName>.<ViewAttributeName>} For example, in the ToolBox Tutorial Sample Library, a text field has its Rendered property configured to: ${oa.EmployeePVO1.PoApproveRender) Step 5: In the application module that contains your application properties view object, add a method to set the application property values. For example, in the ToolBox Tutorial Sample Library we have a method called handlePoApprovaChangeEvent() that reads the current value of the PPR event source poplist from the page's underlying entity object, and sets the appropriate property values as shown: public void handlePoApproveChangeEvent() { // Get the special, single-row application properties and make the first // (only) row current. OAViewObject vo = (OAViewObject)findViewObject("SampleBrowserPVO1"); OARow row = (OARow)vo.first(); 220
// Get the value of the view object attribute with the PO Approval // status. OAViewObject poVO = (OAViewObject)findViewObject("PurchaseOrderHeadersVO1"); OARow poRow = (OARow)poVO.getCurrentRow(); String status = (String)poRow.getAttribute("StatusCode"); // Set the application property values based on the PO Approval // status value. if ("APPROVED".equals(status)) { row.setAttribute("PoApproveRender", Boolean.TRUE); row.setAttribute("PoRejectRender", Boolean.FALSE); row.setAttribute("PoApproveReadOnly", Boolean.TRUE); row.setAttribute("PoApproveRequired", "yes"); } else if ("REJECTED".equals(status)) { row.setAttribute("PoApproveRender", Boolean.FALSE); row.setAttribute("PoRejectRender", Boolean.TRUE); } else { row.setAttribute("PoApproveRender", Boolean.TRUE); row.setAttribute("PoRejectRender", Boolean.TRUE); row.setAttribute("PoApproveReadOnly", Boolean.TRUE); row.setAttribute("PoApproveRequired", "no"); } } // end handlePoApproveChangeEvent() Step 6: In an appropriate controller for handling the PPR event source item's actions, add code to the processFormRequest() method to detect the PPR event and invoke the application module method you created in Step 4. The ToolBox Sample Library's controller for the purchase order approval poplist includes the following code. Note that this example is checking for two different PPR events (the second is described below in Coordinating Master/Detail Tables). public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean); String event = pageContext.getParameter("event"); // If the user changes the value of the po approval poplist, call the // event handler in the AM to set the appropriate SampleBrowserPVO // values.
if ("poApproveChange".equals(event)) { am.invokeMethod("handlePoApproveChangeEvent"); } else if ("supplierSelect".equals(event)) { am.invokeMethod("handleSupplierSelectionEvent"); } } // end processFormRequest() Tip: If PPR is disabled (the FND: Disable Partial Page Rendering profile value is Yes), this same code 221
executes when the user selects the PPR event source item's Go button. Step 7: In the application module that contains your application properties view object, add a method to initialize this view object (if this application module already has a page initialization method, simply add this code to it). For example, in the ToolBox Sample Library we have a method called initializePPRExamplePage() that automatically queries a supplier table, creates a purchase order header EO and initializes the application properties VO: public void initializePPRExamplePage() { // Automatically query the "SuppliersVO" master table. SuppliersVOImpl suppliersVO = getSuppliersVO1(); if (suppliersVO != null) { suppliersVO.initQuery(); } else { // throw exception } // Create a purchase order header. OAViewObject poVO = (OAViewObject)findViewObject("PurchaseOrderHeadersVO1"); if (poVO != null) { if (!(poVO.isPreparedForExecution())) { poVO.insertRow(poVO.createRow()); } } else { // throw exception } OAViewObject appPropsVO = (OAViewObject)findViewObject("SampleBrowserPVO1"); if (appPropsVO != null) { // If the VO already has a row, skip its initialization. Note that // calling getFetchedRowCount() won't perform a DB hit on a VO with // no SELECT and only transient attributes.
if (appPropsVO.getFetchedRowCount() == 0) { // Setting the match fetch size to 0 for an in-memory VO // prevents it from trying to query rows. Note that this // method call sets the internal isPreparedForExecution flag // to true, so when you call the isPreparedForExecution // method above, you won't reinitialize the VO unnecessarily. // Calling executeQuery() is a small workaround to a known // BC4J issue that ensures that modified rows in this // transient view object are not lost after commit. See // View Objects in Detail for additional information. appPropsVO.setMaxFetchSize(0); 222
appPropsVO.executeQuery(); // You must create and insert a row in the VO before you can start // setting properties. appPropsVO.insertRow(appPropsVO.createRow()); // Set the primary key value for this single-rwo VO. OARow row = (OARow)appPropsVO.first(); row.setAttribute("RowKey", new Number(1)); }
// Initialize the application properties VO (and the UI) based on the // default PO approval value set on the underlying object. handlePoApproveChangeEvent(); } else { // throw exception } } // end initializePPRExamplePage() Step 8: In your page's processRequest() method, invoke the application module page initialization method you created in Step 7. For example: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean); am.invokeMethod("initializePPRExamplePage"); } // end processRequest() PPR and Tables You can also fire row-level PPR events for items in a table (including advanced tables and table-in-table). First and foremost, configure the items as described above. Note: If you are working with a table-in-table or HGrid that uses view links, you need to modify your SPEL syntax slightly as shown: ${oa.current.viewAttrName}. The inclusion of "current" keyword lets you say "get the value from whatever row BC4J is using to render the current row" since you won't know how to access the view objects and row sets created dynamically for these complex components. To ascertain in which row the column's PPR event was fired, add the following code to your processFormRequest method: public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean); String event = pageContext.getParameter("event"); if ("<ItemPPREventName>").equals(event)) { // Get the identifier of the PPR event source row String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE); Serializable[] parameters = { rowReference }; 223
// Pass the rowReference to a "handler" method in the application module. am.invokeMethod("<handleSomeEvent>", parameters); } } In your application module's "handler" method, add the following code to access the source row: OARow row = (OARow)findRowByRef(rowReference); if (row != null) { ... } Cascading Data Changes If you want to update data values when the user changes the value in a given field (for example, if the user specifies a supplier value you want to set the default supplier site), follow these instructions: 11.5.10 Note: the OA Framework architecture team is still working on the recommended implementation for the data cascading. You can follow these instructions to get a feel for how this works, but this isn't production ready since the random sequencing of BC4J set<Attribute> method calls means this particular EO-based approach for setting these values isn't reliable. Step 1: Configure a messageTextInput item to issue a PPR event (see Step 1 in Changing UI Properties above). When the data value changes and a PPR event is fired, the OA Framework sets the selected data on the underlying view object. Step 2: Assuming the underlying view object is based on an entity object, the entity object setter associated with the PPR source item should implement the logic to call the setters on the associated target entity object attributes. For example, in a purchase order header the setSupplierID() method might call out to the SupplierEOImpl's Entity Expert to obtain the ID for its default supplier site, which it then passes to the setSupplierSiteID() method. Note: In some circumstances, you might want to suppress this behavior in your entity object (imagine, for example, that you're loading data from an XML file and both the supplier and site IDs are specified). This is currently an open design issue; contact the OA Framework team if you need assistance with this. If you're trying to cascade data in a region whose items have no data source (a search criteria region, for example), you should set the downstream item values directly in your controller. In this case, you might still invoke a custom method on the application module thats ask a static Entity Expert for information on what value to set, and returns this value to the controller. To the extent that you can, all data-related logic should be consolidated in the entity objects and their experts. See the OA Framework ToolBox Tutorial for a complete, working example of cascading data changes. Note: If you want a poplist to automatically reflect changes to its data as a consequence of a PPR event, you must specify the Picklist View Instance when you define it (also set by calling setPicklistViewUsageName()) and not the Picklist View Definition (also set by calling setPicklistViewObjectDefinitionName()). In other words, this will not work if you opt to create a poplist that is cached in the JVM. Coordinating Master/Detail Tables If you want to automatically display rows in a detail table based on the selection of a row in a master table, and the tables are displayed on the same page, follow these instructions to comply with the BLAF Master/Detail Page Template [ OTN Version ]: Step 1: If you have not already done so, create an application properties view object as described above. Step 2: Add a String attribute to your application properties view object. Give it a name like DETAIL_TABLE_TEXT. You will need to set this value dynamically to display a contextual title for the details table as shown in Figure 2. In this example from the ToolBox Sample Library, when the user selects a supplier from the master table, the contextual title for the details table indicates that it is displaying supplier sites for the selected supplier. Figure 2: Example of Master / Detail Tables 224
Step 3: Create a message in Message Dictionary to be used for the details table title. It should include a token for the master table unique (user) identifier. For example: &SUPPLIER_NAME: Supplier Sites. Also create a generic message to display when no master rows are selected (in this case, we simply want to display "Supplier Sites"). Step 4: Create the master and detail view objects, and configure and a view link between them as described in Implementing the Model: View Objects and View Links. Add the master and detail view objects (with the detail view object accessed via the view link) to the page's application module. Finally, add an updateable, transient "SelectFlag" column to the master view object to use as a data source for the table's singleSelection radio button item. Step 5: Create the master table as you normally would (see the Advanced Tables documentation for additional information) and include a singleSelection component. Bind the items to the master view object you created in Step 4, and configure the singleSelection item to issue a PPR event (see Step 1 in Changing UI Properties above). Step 6: Create the detail table and bind it to the detail view object you created in Step 4. Step 7: Add a method to the page's application module to handle the singleSelection choice. This code must find a selected row in master view object's data set and simply mark it as the current row. Because of the view link configuration, BC4J automatically queries the detail view objects. This logic also updates the application properties DetailTableText attribute value based on the current master row. For example: import oracle.apps.fnd.common.MessageToken; import oracle.apps.fnd.framework.OAViewObject; import oracle.apps.fnd.framework.server.OADBTransaction; ... public void handleSupplierSelectionEvent() { OADBTransaction txn = getOADBTransaction(); String detailTableText = null; // Find the selected radio button so we can mark the current row. OAViewObject vo = (OAViewObject)findViewObject("SuppliersVO1"); Row [] rows = vo.getFilteredRows("SelectFlag", "Y"); // This check assumes getFilteredRows returns a zero-length array if // it finds no matches. This will also work if this method is changed // to return null if there are no matches. if ((rows != null) && (rows.length > 0)) { 225
// Set the master row and get the unique identifier. Row masterRow = rows[0]; vo.setCurrentRow(masterRow); String supplierName = (String)masterRow.getAttribute("Name"); MessageToken[] tokens = { new MessageToken("SUPPLIER_NAME", supplierName)}; detailTableText = txn.getMessage("AK", "FWK_TBX_SITES_FOR_SUPPLIER", tokens); } else { // If there are no selected rows, display a default generic message. detailTableText = txn.getMessage("AK", "FWK_TBX_SUPPLIER_SITES", null); } // Now set the text message on the DETAIL_TABLE_TEXT attribute in // the application properties VO. SampleBrowserPVOImpl appPropsVo = getSampleBrowserPVO1(); Row appPropsRow = appPropsVo.getCurrentRow(); if (appPropsRow != null) { appPropsRow.setAttribute("DetailTableText", detailTableText); } } // handleSupplierSelectionEvent() Step 8: In your root application module's initialization method where you configure your application properties view object, call the event handler you created in Step 7. This ensures that the header text renders properly when the page first displays before the user makes a selection. For example, in the ToolBox Sample Library, we have the following initialization logic that calls the handleSupplierSelectionEvent() method. ... OAViewObject appPropsVO = (OAViewObject)findViewObject("SampleBrowserPVO1"); if (appPropsVO != null) { // This checkes the in-memory cache (doesn't cause a database hit). // If the VO doesn't include a row yet, create and insert one. if (appPropsVO.getFetchedRowCount() == 0) { // Setting the match fetch size to 0 for an in-memory VO // prevents it from trying to query rows. appPropsVO.setMaxFetchSize(0); appPropsVO.insertRow(appPropsVO.createRow()); // Set the primary key value for this single-row VO. OARow row = (OARow)appPropsVO.first(); row.setAttribute("RowKey", new Number(1)); }
... // Initialize the header text for the supplier sites detail table. handleSupplierSelectionEvent(); ... Step 9: In an appropriate controller for your master table, add code to processFormRequest() to detect the radio button selection and invoke the application module method that marks the current row in the master data set. Step 10: Add the following processRequest() logic to your controller to bind the child table header's Text 226
property to a specially created attribute in the application properties VO. import oracle.apps.fnd.framework.webui.OADataBoundValueViewObject; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { ... // This also works with an advanced table. OAHeaderBean header = (OAHeaderBean) webBean.findIndexedChildRecursive("<RegionName>"); header.setAttributeValue(OAWebBeanConstants.TEXT_ATTR, new OADataBoundValueViewObject(header, "<AttributeName>", "<AppPropertiesViewInstanceName>"); ... } PPR Event Queuing By default, when a PPR event fires, all subsequent events on the page are ignored. So, for example, assume you have a text input field configured to fire a PPR event when the user leaves, and you also have a submit button on the page. The user makes a change to the data in the text input field, and then uses her mouse to select the submit button. In this case, the text field's PPR event fires and the button click is ignored. If you want to change this behavior so the first event generated after the PPR event is processed immediately after the PPR event response is received (so the subsequent event is sent in a separate request), add the following code to your page's controller: import oracle.apps.fnd.framework.webui.beans.OABodyBean; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAWebBean body = pageContext.getRootWebBean(); if (body instanceof OABodyBean) { body.setAttributeValue(OAWebBeanConstants.FIRST_CLICK_PASSED_ATTR, Boolean.TRUE); } ... ... } With this code, the button click described in the example above would no longer be ignored.
Known Issues
None
Personalization Considerations
None
item properties to the "application properties" view object (if you have not already done so, please read Implementing Partial Page Rendering Events above before reading this section). Currently, you can control the following item properties using this approach: Rendered Read Only Disabled Required Note: This section doesn't describe how to create menus, functions or grants; it assumes you know what they are and how to create them. For additional information about these topics, see Tabs / Navigation and Page Security. Step 1: Create a function with a name that describes the rule you want to implement. For example, assume you have a text field whose Read Only property should be True if the user DOES NOT have access to the SUPPLIER_READ_ONLY function when logged in using the BUYER responsibility. Step 2: Create a grant for this function. In this example, we would create a function grant for SUPPLIER_READ_ONLY in the context of the responsibility BUYER. Step 3: Create the items whose Read Only property should be set based on the state of this security grant. Set the Read Only property using the following SPEL syntax: ${oa.FunctionSecurity.<FunctionName>} The test will return False if <FunctionName> is granted to the current user/responsibility; otherwise True. In this example, we would set the Read Only property to: ${oa.FunctionSecurity.SUPPLIER_READ_ONLY} If the user is logged in to the BUYER responsibility and has been granted access to this function, the OA Framework returns False in the function security test. When the Read Only property is set to False, the item is updateable. Expressions and Test Results The following table summarizes the properties you can set and the corresponding results that the OA Framework sets as the property's value. Property Property Internal Name Rendered RENDERED_ATTR Expression Test Result
${oa.FunctionSecurity.<myFunctionName>} Returns True if <myFunctionName> is granted, otherwise False. Read READ_ONLY_ATTR ${oa.FunctionSecurity.<myFunctionName>} Returns False if Only <myFunctionName> is granted, otherwise True. Disabled DISABLED_ATTR ${oa.FunctionSecurity.<myFunctionName>} Returns False if <myFunctionName> is granted, otherwise True. Required REQUIRED_ATTR ${oa.FunctionSecurity.<myFunctionName>} Returns no if <myFunctionName> is granted, otherwise yes. *
* If you want to set one of the other two Required property values (uiOnly or validatorOnly) you must configure the Required property to bind to a String attribute in the application properties VO, and in this attribute's getter, call function security and return the desired property based on the security test result.
If your table column is a Switcher, then you can: Assign a header label for the column by setting the OA Extension Prompt property for each Switcher nested region item. Enable sorting for the item by setting the OA Extension Initial Sort Sequence property for each Switcher nested region item. OA Framework determines the view attribute to sort by using the following list, in order of precedence: 1. Sort By View Attribute of the Switcher nested region item. 2. Sort By View Attribute of the selected child region item, that is, the named child of the switcher that is selected by the decode SELECT statement. 3. View Attribute of the selected child region item. Note: The View Attribute of the Switcher Nested Region item is not reasonable to use for sorting because it simply determines which named child is selected. Switcher Usage You should limit your use Switchers to within tables, particularly when you want to switch between different kinds of web beans, such as a poplist or a checkbox, or when you want to switch between different images. Although you can technically use a Switcher (OASwitcherBean) outside a table, you should use SPEL binding for the Rendered property of the content that you want to conditonally display instead. The image switching case is demonstrated in the ToolBox Tutorial Delete Lab. The tutorial example creates an employee table that contains a Delete column. The Delete column allows you to delete employees from the table, depending on the status of the employee - if the employee is active, the Delete icon is enabled, otherwise it is disabled. However, to meet accessibility standards, ALT text is associated with the enabled icon, as well as the disabled icon. At runtime, to be able to display the enabled Delete icon, with its ALT text, or the disabled Delete icon with its appropriate ALT text, the tutorial uses the convenience of a table content Switcher to switch between the two distinct sets of attribute values for the same web bean type. If you were to use bound values instead of a Switcher in this case, you would bind the image source of the Delete icon to a view object attribute to get the image file name, and bind the alt text to another view object attribute to get the alt text for the image. You can implement a Switcher declaratively by defining two or more items representing your display alternatives and adding these to a Switcher region within your parent table.
Declarative Implementation
Step 1: To add a Switcher to a table region, update the SQL query for the table region's view object to include a "Switcher" column or attribute. The Switcher attribute must return the name of the conditionally displayed item or region to render. Remember that a Switcher region can contain two or more nested region items as display alternatives. You can add this "Switcher" attribute to your view object by including a DECODE statement in your SELECT statement. The DECODE statement determines which child item name to return. For example, in the ToolBox Tutorial Delete Lab, a Delete column is added to a results table in the Employee search page. The Delete column is a Switcher region that can either display the enabled Delete icon and its alt text or the disabled Delete icon and its alt text. The underlying EmployeeSummaryVO query includes the following DECODE statement to determine whether the employee can be deleted based on the employee's status: decode(nvl(to_char(EmployeeEO.END_DATE), 'N'), 'N','DeleteDisabled', 'DeleteEnabled') AS DELETE_SWITCHER Step 2: Create a Switcher region, by right-clicking your table region in the Structure pane and selecting New > switcher from the context menu. Select the Switcher region and update the following properties in the Property Inspector with these values: ID - <the name of the Switcher region> Set in accordance with the OA Framework File naming standards Item Style - switcher Prompt - <the label that appears in the table column> Rendered - True View Instance - <name of the underlying the view instance> 229
View Attribute - <name of the "Switcher" attribute that you added to the view object in Step 1> Step 3: Right-click the default Switcher case that JDeveloper created for you and select New > Item or New > Region from the context menu. Select the item/region and update the ID property with the OA Framework File Standards. Note: The ID must match the corresponding SQL DECODE function return value that determines when this item or region should be displayed. For example, if you were creating a Switcher for the ToolBox SQL snippet shown above, the image item that you define for the disabled Delete icon would have its ID set to DeleteDisabled. Configure other properties as needed for your item or region. Step 4: Add additional cases to represent display alternative for the Switcher region. Right-click the Switcher region in the Structure pane and select New > case from the context menu. Configure your item or region as described in Step 3, and repeat as necessary until all display alternatives are defined. Step 5: (Required only if you add images to a Switcher in a classic table) You must manually center align the images as shown in the code example below: import oracle.cabo.ui.data.DictionaryData; import oracle.cabo.ui.data.DataObjectList; import oracle.apps.fnd.framework.webui.beans.table.OATableBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { // Always call this first. super.processRequest(pageContext, webBean); // This controller is associated with the table. OATableBean table = (OATableBean)webBean; // We need to format the Switcher image column so the image is centered // (this isn't done automatically for Switchers as it is for // plain image columns). We start by getting the table's // column formats. // NOTE!!! You must call the prepareForRendering() method on the table *before* // formatting columns. Furthermore, this call must be sequenced *after* the // table is queried, and *after* you do any control bar manipulation. // We need to get a handle to the table so we can set it's width to 100%. table.prepareForRendering(pageContext); DataObjectList columnFormats = table.getColumnFormats(); DictionaryData columnFormat = null; int childIndex = pageContext.findChildIndex(table, "DeleteSwitcher"); columnFormat =(DictionaryData)columnFormats.getItem(childIndex); columnFormat.put(COLUMN_DATA_FORMAT_KEY, ICON_BUTTON_FORMAT); }
Runtime Control
There are no programmatic steps necessary to implement a Switcher region.
Personalization Considerations
See a summary of Dynamic User Interface personalization considerations in the Oracle Applications Framework Personalization Guide.
Related Information
BLAF UI Guidelines 230
Partial Page Rendering (PPR) [ OTN Version ] Master / Detail Page Template [ OTN Version ] OA Framework Developer's Guide OA Framework State Persistence Model (Passivation) OA Framework File Standards Classic Tables Advanced Tables Tabs / Navigation OA Framework ToolBox Tutorial / Sample Library ToolBox Tutorial Create Lab (PPR) ToolBox Tutorial Delete Lab (table switcher) oracle/apps/fnd/framework/toolbox/sampleLib/webui/PartialPageExamplePG.xml oracle/apps/fnd/framework/toolbox/sampleLib/webui/PartialPageExampleCO.java oracle/apps/fnd/framework/toolbox/sampleLib/server/SampleBrowserAMImp.java oracle/apps/fnd/framework/toolbox/sampleLib/server/SampleBrowserPVO.xml Copyright 2000-2004, Oracle. All rights reserved
231
Contents
Adding Request Submission to Your Product Declarative Implementation Configuring Request Submission with Optional URL Parameters Adding Request Monitoring to Your Product Declarative Implementation Configuring Request Monitoring with Optional URL Parameters Runtime Control Personalization Considerations Known Issues Related Information
Declarative Implementation
To call the first page of Request Submission from your application, registering your function in the Form 232
Functions form with the following URL parameters in the HTML Call field: akRegionCode=FNDCPPROGRAMPAGE akRegionApplicationId=0 Note: The FND seeded function name that contains these parameters is FNDCPSRSSSWA. Configuring Request Submission with Optional URL Parameters If you wish to restrict some of the pages in the Request Submission flow, you can do so by specifying the following parameters in the URL that you specify in the HTML Call field of the Form Functions form: requestURL = <URL value> URL Value is the page to which you want the user to be redirected to when the user selects Cancel or when the request is submitted. If this parameter is not specified, the user is redirected to the View Requests page. programApplName =<program application short name>& programName=<program short name> Use these parameters to allow your users to submit a specific program from your application without having to enter a program name. If these parameters are specified by the calling application, the Request Submission Program Name page will render without the Program Name LOV. The Program Name field will instead display as a text-only item showing the program specified. programRegion=Hide Use this parameter to hide the Program Name page during request submission. Note that if you specify this parameter, you must also indicate the program name to submit by coding the calling application to provide the programApplName and programName parameters. parameterRegion=Hide If the program you are configuring to submit does not require any parameters, you can specify this parameter with the value 'Hide'. This parameter hides the Parameters page during request submission. scheduleRegion=Hide If you do not want to allow users the option of scheduling the request submission, specify this parameter with the value 'Hide' to hide the Schedule page. By default, if the Schedule page is hidden, the request is submitted with the schedule, "As Soon As Possible". notifyRegion=Hide Specify this parameter with the value 'Hide' to hide the Notification page during request submission. printRegion=Hide Specify this parameter with the value 'Hide' to hide the Printer page during request submission. pageTitle=<page title> Specify this parameter to set the page title for the Request Submission flow. Examples 1. To launch the full Request Submission flow: OA.jsp?akRegionCode=FNDCPPROGRAMPAGE&akRegionApplicationId=0 2. To launch the Request Submission flow specifically for the Active Users program (program short name=FNDSCURS): OA.jsp?akRegionCode=FNDCPPROGRAMPAGE&akRegionApplicationId=0 &programApplName=FND&programName=FNDSCURS 3. To launch the Request Submission flow specifically for the Active Users program (FNDSCURS), such that the program is submitted with default values only (that is, you do not want the user to provide any information in the request submission): OA.jsp?akRegionCode=FNDCPPROGRAMPAGE&akRegionApplicationId=0 &programApplName=FND&programName=FNDSCURS&programRegion=Hide ¶meterRegion=Hide&scheduleRegion=Hide¬ifyRegion=Hide&printRegion=Hi de
233
Declarative Implementation
To call the first page of Request Monitoring from your application, registering your function in the Form Functions form with the following URL parameters in the HTML Call field: akRegionCode=FNDCPREQUESTVIEWPAGE akRegionApplicationId=0 Note: The FND seeded function name that contains these parameters is FNDCPVIEWREQUEST. Example To launch the View Requests page: OA.jsp?akRegionCode=FNDCPREQUESTVIEWREGION&akRegionApplicationId=0 Configuring Request Monitoring with Optional URL Parameters If you wish to restrict some of the pages in the Request Monitoring flow, you can do so by specifying the following parameters in the URL that you specify in the HTML Call field of the Form Functions form: printRegion = Hide Specify this parameter with the value 'Hide' to hide the Print region in the Request Details page, so that users do not see the print information for a request. requestID =<request id> Specify this parameter, to search for a specific request based on the supplied request id. requestDesc =<request description> Specify this parameter, to search for request(s) based on the supplied request description. startDate =<startdate> Specify this parameter, to search for request(s) based on the supplied startdate. endDate =<enddate> Specify this parameter, to search for request(s) based on the supplied enddate. progApplShortName =<program application short name>&progShortName=<program short name> Use these parameters to search for requests for a specific program.
Runtime Control
There are no runtime control steps necessary to add request monitoring to your product.
Personalization Considerations
See a summary of Concurrent Processing personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None.
Related Information
BLAF UI Guideline(s) Javadoc File(s) 234
Lesson(s) Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
235
Content Containers
Overview
Per the Oracle Browser Look-and-Feel (BLAF) UI Guideline Content Containers in Page [ OTN Version ], content containers are regions with special graphical characteristics (border, shape and background color) that help set off the information they contain from the rest of the page. They are often used to hold related information or shortcuts as shown in Figure 1. Figure 1: Example of content containers used for related information and shortcuts.
Implementation
Content containers can be added to the side of the page in a dedicated column as shown in Figure 1 (so the page content renders beside them), or within the page content as just another region. The implementation instructions differ somewhat in each case.
the Related Information and Shortcuts content containers shown in Figure 1, you would first add a bulletedList region to the contentContainer, and then add link items to the bulletedList. At runtime, the OA Framework instantiates an oracle.apps.fnd.framework.webui.beans.layout.OAContentContainerBean.
// Instantiate the content container that you defined declaratively. OAContentContainerBean content = (OAContentContainerBean)createWebBean(pageContext, "/oracle/apps/fnd/framework/toolbox/samplelib/webui/ContentContainRN", null, // ignore item for regions true); // using OAExtension // Get the page layout bean, and specify the content container as the // end content. OAPageLayoutBean pageLayoutBean = pageContext.getPageLayoutBean(); pageLayoutBean.setEnd(content); } Note: For information about the "start" and "end" areas in a page (including ensuring that you have the correct amount of horizontal space between your primary page content and anything that you render in the start and end areas), see Page Layout (How to Place Content). Tip: If you want to add multiple content containers to the "end" area, see the Home Page example in the ToolBox Tutorial / Sample Library. Even though the content containers are fully constructed programmatically in the example, it will show you how to place them on a stack layout with vertical space between them. You would follow the same example even if you instantiated declaratively defined content containers as shown above.
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines Content Containers in a Page [ OTN Version ] 237
Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAContentContainerBean Developer's Guide Bulleted List Related Links / Shortcuts Images in Your Pages Page Layout (How to Place Content) OA Framework ToolBox Tutorial / Sample Library Home Page Lab oracle.apps.fnd.framework.toolbox.samplelib.webui.BasicStructPG.xml oracle.apps.fnd.framework.toolbox.tutorial.webui.HomePageCO.java Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
238
Contextual Information
Overview
In a multipage task flow, it is often helpful to remind users of selection(s) made in previous pages by displaying static, contextual information at the top of the page. As described in the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Contextual Information [ OTN Version ] this standard layout appears as follows: Figure 1: Double Column Layout Contextual Information Example
Note that, if page-level action/navigation buttons are present, the contextual information should render in parallel with the top-level buttons (not below them). Furthermore, if page-level instruction text and/or keys are also present, they should render below the blue separator line that indicates the end of the contextual information.
Declarative Implementation
To add a contextual information region to your page: Note: All package, region and item names must comply with the OA Framework Package / File / Directory standards. Step 1: Create your pageLayout region as you normally would; be sure to specify the Title property (represented by the "Page Title" text value in Figure 1). Step 2: Select your pageLayout region in the Structure pane, right-click and select New > pageStatus. JDeveloper automatically creates a pageStatus node and adds a flowLayout default region beneath it. Change this region's Style to messageComponentLayout. Step 3: Set the messageComponentLayout region's Rows and Columns properties as described in the Page Layout (How to Place Content) document. For example, for the double column layout shown in Figure 1 above, set both the Rows and Columns property values to 2. If you want to display two items next to one another, set the Rows property value to 1 and the Columns property value to 2. Step 4: Add the items that you want to display in the appropriate sequence. For example, to achieve the layout shown in Figure 1 above, you would need to add the corresponding items as shown in Figure 2 below. Select the messageComponentLayout region, right-click and select New > messageStyledText. For each messageStyledText item: Specify an Attribute Set in accordance with the attribute set usage guidelines (see Implementing the View for general information about attribute sets, and the OA Framework View Coding Standards). This should set the Prompt and Data Type values correctly; verify that they are correct. Set the CSS Class to OraDataText (for display-only data that should render in bold). Set the View Instance and View Attribute names for the underlying data source. Note that you can use a view object that you explicitly query when this page renders, or you might bind to a cached row if this page shares a retained application module with a previous page. Figure 2: Contextual Information Item Sequence for the Layout in Figure 1 239
Step 5: Select your pageLayout region again, right-click and select New > Item. Set this Item Style to separator. Step 6: Add remaining items and regions to the pageLayout region as needed for your design.
Runtime Control
There are no particular runtime actions associated with these standard components used in this particular context, however, remember to execute the underlying query in a processRequest() method if these fields bind to a task-specific view object (see Implementing the Model and Implementing the Controller for examples of this). Also see the Standard Web Widgets documentation for additional information about working with OAMessageStyledTextBeans, and Page Layout (How to Place Content) for information about using different layout components.
Related Information
BLAF UI Guidelines: Contextual Information [ OTN Version ] Developer's Guide: Separator Standard Web Widgets Page Layout (How to Place Content) Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAMessageComponentLayoutBean oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean OA Framework ToolBox Tutorial / Sample Library See the /oracle/apps/fnd/framework/toolbox/samplelib/webui/ContextInfoPG in the SampleLibrary.jpr. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
240
Contents
Controlling the Look-and-Feel Controlling the Facet
messageStyledText pageLayout separator stackLayout staticStyledText table Note: Any unsupported UI components on the page will not be rendered, however, warnings will be registered in the log.
Example
This example illustrates how to set the minimal look-and-feel when defining a function's Web HTML Call. OA.jsp?page=/oracle/apps/fnd/framework/toolbox/webui/HelloWorldPG&OALAF=minimal
LafConstants.FACET_EMAIL
LafConstants.FACET_PORTLET
portlet
LafConstants.FACET_PRINTABLE printable
Example
See the Printable Page document for a complete example. 242
243
Custom HTML
Overview
In general, you should avoid using custom HTML and design pages using OA Framework components if you can, as they meet the NLS, accessibility, security, and Oracle Browser Look-and-Feel (BLAF) UI guidelines and standards. If you need to write custom HTML, UIX provides two alternatives that you should use instead of the OARawText bean: oracle.apps.fnd.framework.webui.beans.OAHTMLWebBean - helps you create HTML tags to output text. Although HTMLWebBean creates only one tag, and you would have to create a hierarchy of OAHTMLWebBeans to duplicate the HTML achievable with oracle.apps.fnd.framework.webui.beans.OARawTextBean, OAHTMLWebBean does provide the following added features: Automatic escaping Pretty printing XHTML syntax support Debugging assistance oracle.apps.fnd.framework.webui.beans.OAFormattedTextBean - helps you format text using the generic HTML formatting tags. Note that OAFormattedTextBean intentionally cannot accomplish everything that OARawTextBean does because it is designed to block cross-site scripting attacks and to provide only tags for formatting (and links). For Oracle's in-house E-Business Suite developers who have to use the RawText bean, you must get approval from the Oracle BLAF UI team to ensure that your implementation meets UI standards. Your use of the RawText web bean must also conform to the accessibility, NLS, and Oracle Application security guidelines.
<html>User authentication failed.<br>Cause: Invalid password.</html> Note The inline messages that appear in a rendered table do not reflect HTML tags properly. Also inline messages displayed in the Netscape browser do not reflect bold text properly. According to the UIX team, these are known limitations coming from the browser and operating system. UIX is generating the correct HTML syntax in the html output. For Messages in a Dialog Page: Seed your message in the FND_NEW_MESSAGES table with <html>...</html> to enable HTML tags in the dialog page message. 244
The dialog page uses OAFormattedTextBean for the description and instruction messages to enable HTML tags as long as the message text is enclosed in <html>...</html>. The description message still appears in bold text and the instruction message still appears in plain text even when HTML tags are enabled. To have better control over what appears as bold, you can set a null value for the description message and just use the instruction message. Note The OAFormattedTextBean text itself does not require <html></html> enclosing tags, but the HTMLenabled messages in the message box and dialog page do. UIX automatically drops the extra <html></html> upon rendering the formatted text.
Personalization Considerations
See a summary of Custom HTML personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guidelines Javadoc oracle.apps.fnd.framework.webui.beans.OARawTextBean oracle.apps.fnd.framework.webui.beans.OAHTMLWebBean oracle.apps.fnd.framework.webui.beans.OAFormattedTextBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
245
Data Export
Overview
As described in the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Export/Import Page Templates [OTN version], you can implement an Export button that exports data displayed in one or more regions of an OA Framework page to a file. Export saves the data to a .csv (comma separated values) file that can be viewed in Microsoft Excel. When you select the Export button, Microsoft Windows opens a dialog box that lets you view the file either by opening it directly in Microsoft Excel, or by saving it to a designated directory to open later. Note: The program that is launched while saving exported data is dependent on each user's PC's setting. To launch a .csv file in Microsoft Excel, the .csv file type needs to be mapped to open with Microsoft Excel. If you try to open a .csv file that is not mapped to any program, Microsoft Windows will ask you to choose a program with which to open the file. A user can easily determine the file to program mapping on their PC by first selecting a .csv file in Windows Explorer, and then choosing Properties from the right mouse button context menu for that file. In the General tab of the Properties window, Opens With: lists the program that can open the selected file. Only web beans that are rendered on the page are ever exported. If you export data from multiple regions in a page, each region appears in the export file in a tabular format, with a row of column names for that region, followed by rows of corresponding values. Note: Data Import functionality is currently not supported.
Contents
Exporting Data From All Regions On A Page Exporting Data From a Specific Region On A Page Personalization Considerations Known Issues Related Information
Note: When exporting data from a table or advanced table, the data that is exported from the leaf item of the table column may be from a different view attribute than the data displayed. This occurs when the declarative definition of the table column's leaf item has a value specified for its Export View Attribute property. Attention: If you intend to support the Export feature on a Gantt chart or HGrid, you cannot use different viewAttributeNames at different levels in the hierarchy column. All levels of the hierarchy column (that is, all nodeDefs) should have the same viewAttributeName. This is analogous to the definition of all other columns of a HGrid or Gantt. This restriction does not apply if the Export feature is not being used. Note: When exporting data from a page, data from hidden fields (FormValue items) or Switcher regions cannot be exported. Step 4: Set the Export All Rows property on the exportButton item to True to export all rows from a table's view object regardless of the view object's setMaxFetchSize value. If the Export All Rows property is set to False, the total number of rows that can be exported from a table is defined by its view object's setMaxFetchsize. The default value for this property is False for existing Export buttons and True for any new Export button created with 11.5.10E or above.
Runtime Control
There are no specific runtime control steps necessary to enable the export of data from a page.
default value for this property is False for existing Export buttons and True for any new Export button created with 11.5.10E or above.
Runtime Control
In general, there are no specific runtime control steps necessary to enable the export of data from a region. Exporting Data From Master/Detail Regions If, however, you have a page that contains both a Master region and a corresponding Detail region and you want to export all the data from these two regions regardless of which Master row is selected, you must do so programmatically. There is no declarative support for this. First refer to the Coordinating Master/Detail Tables discussion for details on how to create such a region. Then add code, as shown in the following example, to the processRequest method of your controller: OAExportBean expBean = (OAExportBean)webBean.findChildRecursive("Export"); // set the exportDetails for this Master/Detail region. expBean.setExportDetails(oaPageContext,"masterRegionName", "detailRegionName", "masterVuName", " detailVuName"); Note: This type of Master/Detail export is supported only when you implement a region-level export and not a page-level export (where all the regions on a page are exported).
Personalization Considerations
There are no personalization restrictions.
Known Issues
None
Related Information
BLAF UI Guideline(s) Export/Import Page Templates [OTN version] Export/Import Flows [OTN version] Javadoc File(s) oracle.apps.fnd.framework.webui.beans.form.OAExportBean Lesson(s) Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
248
Date Picker
Overview
Users of Oracle Applications can enter a date for a date field by using a Date Picker. A Date Picker, as fully described in the Oracle Browser Look-and-Feel (BLAF) UI Guidelines: Date Picker [OTN version] is a feature that displays a graphical calendar from which a user can select a date to populate a date field on a page. The benefits of including a Date Picker in a page are that users can graphically select a date and visible restrictions of available dates can be enforced for specific application contexts. A Date Picker can be implemented inline, as shown in Figure 1 or in a secondary window, as shown in Figure 2. Figure 1: An example of a page with a date field and an Inline Date Picker.
Figure 2: An example of a page with a date field and Date Picker icon. Selecting the Date Picker icon displays the Date Picker in a secondary window.
249
Declarative Implementation
To implement a Date Picker on your page so that it displays in a secondary window, simply create a messageTextInput item on your page and set its Data Type property to Date.
Runtime Control
Although there are no programmatic steps necessary to implement a Date Picker in a secondary window for a date field, if you wish to restrict the Date Picker to a range of dates, you must include the following code in the processRequest method of your controller: OAMessageDateFieldBean dateField = (OAMessageDateFieldBean) webBean.findIndexedChildRecursive(Date1); dateField.setMinValue(minDate); dateField.setMaxValue(maxValue);
Personalization Considerations
See a summary of Date Picker personalization considerations in the Oracle Applications Framework Personalization Guide.
Inline Datepicker
When one or more date fields appear on a page, an Inline Date Picker can be associated with those date fields programmatically, allowing users to quickly select dates for those fields. An Inline Date Picker is displayed inline in the page contents. A user populates a date field by setting the focus on the desired date field and selecting a date from the Inline Date Picker. Note There should be ONLY one Inline Date Picker on a page even if multiple date fields exist on the page. Note OA Framework only supports the month and year as separate pulldown lists in the Date Picker.
Declarative Implementation
There is currently no declarative support for implementing an Inline Date Picker, however, you must define a date field on your page first by creating a messageTextInput item on your page and setting its Data Type property to Date.
Runtime Control
Creating an Inline Date Picker 250
Once you declaratively define one or more date fields on your page, you can programmatically create an Inline Date Picker and associate the Inline Date Picker ID with these date fields. You can also programmatically determine the placement of the Inline Date Picker on the page. To create an Inline Date Picker, include the following code in the processRequest method of your controller. import oracle.apps.fnd.framework.webui.beans.form.OAInlineDatePickerBean; import oracle.apps.fnd.framework.webui.beans.message.OAMessageDateFieldBean; public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{ : OAInlineDatePickerBean inlineDatePicker = (OAInlineDatePickerBean) createWebBean(pageContext, INLINE_DATEPICKER_BEAN); inlineDatePicker.setId(DatePicker); OAMessageDateFieldBean dateField = (OAMessageDateFieldBean)webBean. findIndexedChildRecursive(Date1); dateField.setPickerID(DatePicker); // Set the same inlineDatePicker to another date field. dateField = (OAMessageDateFieldBean)webBean.findIndexedChildRecursive(Date2); dateField.setPickerID(DatePicker); WebBean.addIndexedChild(inlineDatePicker); } Creating an Inline Date Picker with Max and Min Values To display an Inline Date Picker in a page with a restricted range of dates, include the following code in the processRequest method of your controller. import oracle.apps.fnd.framework.webui.beans.form.OAInlineDatePickerBean; import oracle.apps.fnd.framework.webui.beans.message.OAMessageDateFieldBean import java.util.Date;
public void processRequest(OAPageContext pageContext, OAWebBean webBean) { : Date minDate = new Date(100, 06, 04); // 4th July 2000 Date maxDate = new Date(104, 11, 17); // 17th December 2004
OAInlineDatePickerBean inlineDatePicker = (OAInlineDatePickerBean) createWebBean(pageContext,INLINE_DATEPICKER_BEAN); inlineDatePicker.setId(DatePicker); inlineDatePicker.setMinValue(minDate); inlineDatePicker.setMaxValue(maxDate); OAMessageDateFieldBean dateField = (OAMessageDateFieldBean) webBean.findIndexedChildRecursive(Date1); dateField.setPickerID(DatePicker); // Should be set on the date field also. dateField.setMinValue(minDate); dateField.setMaxValue(maxValue); webBean.addIndexedChild(inlineDatePicker); }
Personalization Considerations
See a summary of Date Picker personalization considerations in the Oracle Applications Framework 251
Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guideline Date Picker [OTN version] Javadoc oracle.apps.fnd.framework.webui.beans.form.OAInlineDatePickerBean oracle.apps.fnd.framework.webui.beans.form.OADateFieldBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
252
GET Implementation
If you set the Destination Function property on a bean that normally renders as a link, the Destination URI property is ignored (if specified). When the user selects the link, a GET request is issued and the page associated with the target function displays. The list of beans in this category include: Note that this functionality existed before release 11.5.10 for some beans. button image link nodeDef (in a tree) staticStyledText messageStyledText Tip: If you want to add parameters to the URL generated for the GET request, you can use the setInvokeFunctionParams(String functionParam) method on your bean. For example, you could add the following processRequest() logic to add the request parameter foo=bar to the URL when a button with a Destination Function is selected: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); 253
POST Implementation
If you set the Destination Function property on a bean that normally submits the form when selected (a submitButton, for example, or another component configured to submit the form with a fireAction), setting this property does not change this behavior. You must handle the form submission event as you normally would with the code shown below. The list of beans in this category include: button image link nodeDef (in a tree) staticStyledText messageStyledText singleSelection messageRadioGroup messageCheckBox messageTextInput messageChoice messageLovChoice messageRadioButton submitButton If you set the Destination Function for one of these beans, you must code processFormRequest() logic to obtain the function name so you can pass it to a setForward*URL() method call. This is illustrated in the following example that handles the fireAction event for a messageChoice bean. public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); String event = pageContext.getParameter(EVENT_PARAM); String source = pageContext.getParameter(SOURCE_PARAM); if ( <myEventName>.equals(event) && <myPoplist>.equals(source) ) { OAMessageChoiceBean poplistBean = (OAMessageChoiceBean)webBean.findIndexedChildRecursive(<myPoplist>); String invokeFunc = poplistBean.getInvokeFunctionName(); pageContext.setForwardURL(invokeFunc,...); } }
Personalization Considerations
See a summary of Page Flow personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None 254
Figure 2: Example of the first page in a multistep flow (this is the Multistep Create flow in the OA Framework ToolBox Tutorial which uses Workflow).
255
Implementation
To create a multistep page flow using Workflow: Step 1: Create all the individual pages that participate in the multi-page transaction. This content is incomplete as of the release 11.5.10 production documentation build. If you are a customer, please see the OA Framework forum for information on how to access these instructions. If you are an Oracle E-Business Suite developer, please see the live, work-in-process version of the OA Framework Developer's Guide for the latest content.
Known Issues
When defining a page flow using Workflow, parallel flows are not allowed.
Related Information
BLAF UI Guideline(s) Step-by-Step Page Flows Step-by-Step (3+ Step) Page Template Javadoc oracle.apps.fnd.framework.webui.beans.nav.OANavigationBarBean OA Framework Developer's Guide Tabs / Navigation Submitting the Form Locator Element: Train Locator Element: Page / Record Navigation OA Framework ToolBox Tutorial / Sample Library See the Create (Multistep) example in the Tutorial.jpr (run the test_fwktutorial.jsp to try it) Oracle Workflow Documentation Oracle Workflow Developer's Guide Oracle Workflow Administrator's Guide Oracle Workflow User's Guide Oracle Workflow API Reference 256
257
Dialog Pages
Overview
As described in the BLAF UI Guideline: Message Flows [OTN Version] specification, messaging can be introduced into application flows when an Error, Information, Warning, Confirmation, or Processing Message needs to be displayed. There are two basic kinds of messaging flows: Inline Message - The message appears inline on a page around the region item that requires attention. The inline message is also repeated in the message box on top of the page. Dialog Page - The message appears on it's own dialog page in the flow. The inline message is described in detail in Chapter 4: Implementing Message Boxes. This document focuses on how to implement an Error, Information, Warning, or Confirmation message in a dialog page. The following figure shows an example of a Warning message displayed in a dialog page. Figure 1: Warning dialog page.
Contents
Declarative Implementation Runtime Control New Dialog Page APIs Using HTML Tags in Messages Personalization Considerations Known Issues Related Information
Declarative Implementation
Since a dialog page is displayed in the context of runtime events and circumstances, there is no corresponding declarative implementation.
Runtime Control
You can display an exception as a message in a dialog page using the APIs in the oracle.apps.fnd.framework.webui.OADialogPage class and oracle.apps.fnd.framework.webui.OAPageContext interface. The OADialogPage class holds properties for the generic dialog page. To create a dialog page object, first use the constructors to instantiate the basic properties, then use the setter methods provided in the class to set additional properties. Please refer to the OADialogPage Javadoc for an explanation of basic usage and additional examples. To navigate (redirect) to a dialog page, use the OAPageContext.redirectToDialogPage methods. The OAPageContext interface contains the context and state information specific for a client request. The following redirectToDialogPage methods are provided in OAPageContext: // Redirects to a dialog message page. public void redirectToDialogPage(OADialogPage dialogPage); // Convenience method to create and redirect to a dialog page with basic properties set. 258
Public void redirectToDialogPage(byte messageType, OAException descriptionMessage, OAException instructionMessage, String okButtonUrl, String noButtonUrl) Please refer to the OAPageContext Javadoc for further information on these methods. Example: Redirect to a Basic Warning Page You can include the following code example in your controller processFormRequest method to redirect to a basic warning page: OAException descMesg = new OAException("FND", "FND_CANCEL_WARNING"); OAException instrMesg = new OAException("FND", "FND_CANCEL_ALERT"); String okUrl = APPS_HTML_DIRECTORY + "OA.jsp?OAFunc=FND_REQUISITIONS_PAGE"; String noUrl = APPS_HTML_DIRECTORY + "OA.jsp?OAFunc=FND_REQUISITIONS_PAGE&retainAM=Y"; pageContext.redirectToDialogPage(OAException.WARNING, descMesg, instrMesg, okUrl, noUrl); Example: Make Dialog Page Action Buttons Submit Back to the Calling Page Refer to the setPostToCallingPage method, documented in the OADialogPage Javadoc for a code example of how to make the dialog page action buttons submit back to the calling page. In the example, the OK button commits the changes on the dialog page and the NO button rolls back the changes. Example: Display a Warning Page When a Delete Icon is Selected. Refer to Task 4 of the Delete exercise in the Oracle Applications Framework Toolbox Tutorial for another example of how to create a Warning dialog page. The specific example is implemented in controller class EmployeeResultsCO in LabSolutions.jpr of the Toolbox. This example displays a Warning page when a user selects the Delete icon from an Employees Search page. The Warning page displays Yes and No submit buttons, as shown in Figure 1.
Personalization Considerations
See a summary of Dialog Pages personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
259
None
Related Information
BLAF UI Guidelines Messaging Flows [OTN Version] Messaging Templates [OTN Version] Javadoc File oracle.apps.fnd.framework.webui.OADialogPage oracle.apps.fnd.framework.webui.OAPageContext oracle.apps.fnd.framework.webui.beans.OAFormattedTextBean oracle.apps.fnd.framework.webui.beans.OATipBean Lesson Delete exercise Sample Code oracle.apps.fnd.framework.toolbox.labsolutions.webui.EmployeeResultsCO in LabSolutions.jpr of the Toolbox Tutorial Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
260
Contents
File Upload Declarative Implementation Runtime Control File Download Declarative Implementation Runtime Control Usage Notes Personalization Considerations Known Issues Related Information
File Upload
Behavior prior to OA Framework 11.5.10D: The File Upload feature appeared as an input field with a prompt, followed by a Browse button, as shown:
In the input field, you specify the full pathname of the file to upload. Alternatively, you could select Browse to display a dialog box to select a file from the file system. Note that if you specify a file to upload and then refresh the screen, the file that you specified prior to the refresh is cleared from the field to maintain security. The data type is ignored when you implement the File Upload feature because OA Framework does not map a view object instance or view attribute with the messageFileUpload web bean. Behavior in OA Framework 11.5.10D and above: You can now specify a view object instance and view attribute for the messageFileUpload web bean and associate a data type to it. The File Upload feature appears as an input field with a prompt, followed by a Browse button, as shown:
If the view attribute returns a non-null value, that is, a file is already uploaded, OA Framework renders the File Upload feature as a View link with a prompt, followed by a Clear button: You can select the View link to see information about the uploaded file. If you select Clear, the feature clears the View link and redisplays an input field with a Browse button so you can specify a new file to upload. Note: You can alter the text of the View link to display some other text or the file name of an already uploaded file. See the Runtime Control section for more details. Note: You can set the profile option called UPLOAD_FILE_SIZE_LIMIT to specify the maximum size of the file a user can upload. For example, if you set UPLOAD_FILE_SIZE_LIMIT to 500K, then during the http POST request, OA Framework reads only up to 500K from the stream and throws an exception if the uploaded file is larger than 500K.
Declarative Implementation
261
Perform the following steps to implement the File Upload feature declaratively in an OA Extension page. Step 1: Create a region in your page layout region, with the Form property set to true for the page layout. Step 2: In the new region, create an item of item style messageFileUpload. Step 3: In the OA Extension Property Inspector, set the following properties for the messageFileUpload item: View Instance - A view object instance of the underlying data source. View Attribute - A view attribute in the specified view object instance, that maps to the column for storing the file content. Data Type - The Oracle data type of the view attribute. The BLOB data type is now supported for File Upload as of OA Framework 11.5.10D. For example, if you set the data type to BLOB, the view attribute must map to a column whose data type is also BLOB. Note: The data type must be set to the same data type as the column that the view attribute maps to, otherwise an error occurs when the user attempts to commit the file upload. Note: If you set Data Type to BLOB and you store your file content in FND_LOBS, be sure to populate the column FILE_CONTENT_TYPE (File MIME Type). Since FILE_CONTENT_TYPE is a non-null column, you will encounter an error is this column is not populated. Refer to the oracle.apps.fnd.framework.webui.beans.message.OAMessageFileUploadBean Javadoc for additional information. Prompt - The text label for the File Upload feature.
Runtime Control
You can programmatically alter the text of the link that appears when a file has already been uploaded to be something other than "View". To change it to some other static text, then in your controller code, call the setDisplayName method from the OAMessageFileUploadBean and pass in the text to display for the link. If you wish the link text to be dynamically determined, for example, to display the name of the file that is already uploaded, then you can data bind the display name as follows: OADataBoundValueViewObject displayNameBoundValue = new OADataBoundValueViewObject(uploadBean, "FileName"); uploadBean.setAttributeValue(DOWNLOAD_FILE_NAME,displayNameBoundValue);
File Download
The File Download feature appears as linked text on a page. For example, in the figure below, a default single column region contains a messageTextInput item (Image Name), followed by a messageDownload item that appears as a File Download link (Process.gif). The text that appears for the File Download link is the value returned by the View Attribute specified for the messageDownload item. When you select the file download link, a small window opens in your Browser. You can either open the file and display the content or save the file. If you choose Save, the file is created and saved to your client machine.
Declarative Implementation
Perform the following steps to implement the File Download feature declaratively in an OA Extension page. Step 1: Create a region in your page layout region, with the Form property set to true for the page layout. Step 2: In the new region, create an item of item style messageDownload. Step 3: In the OA Extension Property Inspector, set the following properties for the messageDownload item: View Instance - The view object instance of the underlying data source. View Attribute - The view attribute that maps to a column in the underlying data source. File View Attribute - The view attribute that maps to the column that stores the file content. File Name Override - The file name to save to when you select the File Download link and choose the Save option in the File Download window to save the file. The default file name that appears in the File Name field of the Save As dialog window is derived from the value returned from the view attribute 262
specified by the View Attribute property. The value of the File Name Override property overrides that default file name and is especially useful if the view attribute returns instructional text, such as "Click on this link to download the file". If the File Name Override property is not defined, then the file name to save to is the value returned from the view attribute. File MIME Type - The MIME type of the file. See the Runtime Control example below if you do not want to specify a static value for this property. Data Type - The data type of the File View Attribute. The BLOB datatype is now supported for File Download as of OA Framework 11.5.10D. Prompt - The text prompt that proceeds the File Download link.
Runtime Control
If the file MIME type is stored in a view attribute, you can retrieve it through a data bound value programmatically. The following code example illustrates how this is done: // if content type is stored in a view attribute, it can be retreived through // data bound value. Otherwise, a static value can also be set: // e.g. downloadBean.setFileContentType("text/html") OADataBoundValueViewObject contentBoundValue = new OADataBoundValueViewObject(downloadBean, "FileContentType"); downloadBean.setAttributeValue(FILE_CONTENT_TYPE, contentBoundValue);
Usage Notes
Avoid defining both a messageFileUpload and a messageDownload item in a region and mapping both items to the same view attribute. If you map both items to the same view attribute, the Clear button in the messageFileUpload web bean that clears the View link, will also clear the link for the messageDownload web bean.
Personalization Considerations
There are no personalization restrictions.
Known Issues
See a summary of key file upload/download issues with suggested workarounds if available.
Related Information
BLAF UI Guidelines Javadoc oracle.apps.fnd.framework.webui.beans.message.OAMessageDownloadBean oracle.apps.fnd.framework.webui.beans.message.OAMessageFileUploadBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
263
Flexfields
Overview
A flexfield is made up of sub-fields, or segments. Each segment has a name and a set of valid values. There are two types of flexfields, key and descriptive. Key flexfields provide a way for Oracle Applications to represent objects such as accounting codes, part numbers, job descriptions, and more. For example, the Key Accounting Flexfield is a feature that uses a key flexfield to represent accounting codes throughout Oracle Applications. Similarly, descriptive flexfields provide a flexible way for Oracle Applications to provide customizable "expansion space" in applications, as well as a way to implement context-sensitive fields that appear only when needed. In essence, descriptive flexfields allow customizations of pages without writing either XML or Java. In fact, both types of flexfield let you customize Oracle Applications features without programming. And, these customizations are fully supported within Oracle Applications. In an OA Framework application, the following Flexfield functionality (above and beyond regular flexfield functionality) is supported: Showing only the displayable segments for a particular context Don't show segments that customers don't want their web users to see. Supporting the use of the system administrator entered segment prompts Supporting flexfield MLS properties, such as the flexfield context and structure names as well as the segment prompts Multiple flexfields on one page
Contents
This documentation contains the following topics: Overview Descriptive Flexfields Declarative Implementation Segment List Run-time Control Key Flexfields Declarative Implementation Segment List Run-time Control Usage Notes
Descriptive Flexfields
A descriptive flexfield is implemented as an oracle.apps.fnd.framework.webui.beans.OADescriptiveFlexBean. An OADescriptiveFlexBean automatically renders vertical table layout UIs for user input. For each descriptive flexfield, we render the Context as a poplist in the first row. After the first row, we render all the segments defined for the Global Data Element. After that we render context sensitive segments depending on the selected value in the context poplist. Each segment (including the flexfield context) will be a row in the html table. Each segment has a prompt aligned to the right, and a corresponding input style aligned to the left. The Figure 0-1 below is an example of the flexfield UI for a standard vertical layout: Figure 1: Visual Example of both a Key and Descriptive Flexfield on a Page
264
In the above example, we use the descriptive flexfield called "FWK Item Descriptive FF" from the "Demo Order Entry (DEM)" application. Packaging Type is the Context field. Warehouse is the 1 field of the Global Data Elements. The context-sensitive elements are not rendered yet as a context has yet to be selected. Currently the flex beans support three types of input style: Text Input (not shown above) PopList, as shown for the segment "Packaging Type" LOV, as shown for the segment "Warehouse" The type of HTML input style generated in the UI for each segment depends on the validation type of the segment. The following table shows what each type of validation will produce for the HTML form input: Segment Validation Type HTML Input Style None Text Input Independent PopList or LOV depending on the list type value on value set definition Dependent PopList Table PopList or LOV depending on the list type value on value set definition If you add an OADescriptiveFlexBean on your page, it will Display flexfield segments for web users to input or update values and populate flexfield segments with database values from corresponding view objects. Upon context switching, refresh page with corresponding set of segments for the new context. Validate user input values for flexfieldsegments. 265
Put the valid values in user's view object so that the calling page has access to valid flexfield values if there are no errors. If there are errors, the current page will be redrawn by the framework with corresponding error messages.
Declarative Implementation
A descriptive flexfield is added to a region as a item. You need to do the following to add a descriptive flexfield to a region. 1. Define an item of the style flex in your region. 2. Specify the view object (VO) for your flex. This view object should be the same view object as you have specified for this region. When you create the view object, you need to include all the database columns for this flexfield. You should not change the database column names for this flexfield because flex beans use the same naming convention that view object generation routine uses to find the corresponding attribute names from your view object. Note: Currently we don't have support to put several flexfields in one view object, but this will be available soon. 3. Set the descriptive flexfield's "Appl Short Name" property to the short name of the application to which the descriptive flexfield is registered. 4. Set the descriptive flexfield's "Name" property to the name of the descriptive flexfield as it was registered. (Note: This differs from how Key Flexfields are defined by shorthand codes.) 5. Set the descriptive flexfield's "Type" property to descriptive. 6. Finally, set the "Segment List" property as appropriate (see discussion below).
Segment List
If you leave this column empty, all the segments will be rendered.The data you want to put in this column must use the this format: context1|segment1's name|segment2's name...||context2|segment4's name|segment5' name... For example, for our example, we used: Global Data Element|Warehouse ||Box|Items per Box|Box Size ||Pallet|Items per Pallet|Pallet Weight As shown above, segments within a certain context are separated by "|', a single pipe, while data from different context is separated by "||", a double pipe. You can also add the read-only token ($RO$) to any of the segments in the list. For example: segmentlist = "Context1|Segment1($RO$)|Segment2..." This designator will cause Segment1 to be read-only.
Run-time Control
In processRequest(), if you are using autorendering and would like to render the whole flexfield structure as a separate table, you don't have to write any extra code in your processRequest(). If you want to merge flexfield segments to the outside layout, you need to find the flex bean by attribute name and call mergeSegmentsWithParent() on the flex bean. If you want to do something wacky with flexfield UI layout (like insert a button after every one), you need follow the instructions below: Note: This is not encouraged by the OA Framework team. 1. Find the flex bean by attribute name and call processFlex() on the flex bean. 2. Call getIndexedChild(int) to extract the TextBeans from the flex bean and do whatever you want. In processFormRequest(), you can get valid flexfield data from your view object's corresponding attributes without any extra coding. How to Code processRequest( ): If the user changes the flexfield context dropdown list value, the flexfield code will redirect to the same page. As a result, the user controller processRequest() method will be callled again. If this behavior causes problems on the page, please use this code in your processRequest(): public void processRequest(OAPageContext pageContext, OAWebBean webBean) { String formEvent = pageContext.getParameter(FLEX_FORM_EVENT); 266
Personalization Considerations
See a summary of Flexfields personalization considerations in the Oracle Applications Framework Personalization Guide.
Key Flexfields
A key flexfield is implemented as an oracle.apps.fnd.framework.webui.beans.OAKeyFlexBean. An OAKeyFlexBean also automatically renders vertical table layout UIs for user input. Because key flexfields don't have context field, we will just render all the segments for the specified structure code. The UI will look the same as descriptive flexfields. If you add an OAKeyFlexBean on your page, it will Display flexfield segments for web users to input or update values and populate flexfield segments with database values from corresponding view objects. Validate user input values for flexfield segments and insert new code combination ID (CCID) row to key flexfield table if applicable. Put the valid values in user's view object so that the calling page has access to valid flexfield values if there are no errors. If there are errors, the current page will be redrawn by the framework with corresponding error messages. Starting from 11.5.10, based on BLAF standard, we've implemented code combination LOV's for the key flexfield, instead of rendering all the segment on the UI. Using this new UI, user can click on the code combination LOV icon and use the advanced search window to input/select KFF combination, or directly type in existing combination code in the code combination LOV input. Figure 2: Key Flexfield on the Base Page
267
Backward compatibility issue of new Key flexfield UI: The new key flexfield UI will generate one LOV web bean for the flexfield instead of generating multiple child web beans for each segment. Some controller code may have dependencies on the old behavior of key flexfield UI. To fix this backward compatibility issue, developers can turn off the new key flexfield UI by using the FND_FWK_COMPATIBILITY_MODE profile to 11.5.9 or JAVA API: OAKeyFlexBean.useCodeCombinaionLOV (boolean false);
Declarative Implementation
A Key Flexfield is added to a region as a region item. You need to do the following to add a key flexfield to a region. 1. Define an item of the style flex. 2. Specify view object for your flex. This view object should be the same view object as you have specified for this region. When you create the view object, you need only include the CCID column. You should not change the database column names for this flexfield because flex beans use the same naming convention that view object generation routine uses to find the corresponding attribute names from your view object. Note: We support multiple key flexfields in one view object, if they are using different CCIDAttributeName's. When you create your view object, you need to decide if you want flexfield code to handle dynamic insertion for you, or you would like to handle the dynamic insertion yourself. Dynamic insertion is just a parameter for the flexfield. It has nothing to do with the VO. Maintainance mode of KFF enables us to handle dynamic insertion. Note: Maintenance mode is not yet implemented in key flexfields. For VO's, developers use the setCCIDAttributeName() API to specify the CCID column. After the user inputs their key flexfield segment values and submits the page, the flexfield code will determine the code combination from the combinations table (maintained by framework) and set the CCID to your VO's CCID 268
column. Dynamic insertion controls the behavior of the key flexfield when the user inputs a combination which is not in the combinations table. If dynamic insersion is on, the flexfield code will create an record in the combinations table, and return a valid CCID. Otherwise the flexfield code will return "-20" as the CCID, which means the combination input by user is not found. 3. Set the key flexfield's "Appl Short Name" property to the short name of the application to which the descriptive flexfield is registered. 4. Set the key flexfield's "Name" property to the code of the key flexfield as it was registered. (Note: This differs from how Descriptive Flexfields are defined by Names.) 5. Set the key flexfield's Type property to key. 6. Finally, set the Segment List property as appropriate (see discussion below).
Segment List
You may also fill in the flex_segment_list column if you want to show only some of the segments in your flexfield, not all. If you leave this column empty, all the segments will be rendered. The syntax must be the same as described in descriptive flexfield, only that you should be using structure codes to replace context values. The format will be: structure code1|segment1's name|segment2's name...||structure code2|segment4's name|segment5' name... For example, for "FWK" key flexfield, we use the following data: FWK Item Flexfield|Manufacturer|Product Family|Product As shown above, segments within a certain structure code are separated by "|', a single pipe, while data from different structure codes is separated by "||", a double pipe.
Run-time Control
The following is an example code for key flexfield. public class RegionCO extends OAControllerImpl { public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); //find the flexfield that is defined in this region as item "Jxtanflextest" and merge each //individual segment to the outside layout OAKeyFlexBean flexBean = (OAKeyFlexBean)webBean.findIndexedChildRecursive("KeyFF"); flexBean.setStructureCode("FWK Item Flexfield"); flexBean.setCCIDAttributeName("FwkitemId"); flexBean.mergeSegmentsWithParent(pageContext); } public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); } }
Usage Notes
You must call setStructureCode() to specify the structure for this key flexfield. You must call setCCIDAttributeName() to specify the Code Combination ID (CCID) attribute name in your view object if they don't include all the invidual flexfield segments in the view object. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
269
Contents
Launching Oracle Applications Forms from OA Framework Pages Launching OA Framework Pages from Oracle Applications Forms
Declarative Implementation
Step 1: In the OA Extension Structure pane, select the region in which you want to create the web bean to launch an Oracle Applications form. Choose New > Item from the context menu. Step 2: Set the ID property for the item, in accordance with the OA Framework File Standards, and set the Item Style property to button, image, or link. You may also launch an Oracle Applications form from a submit button. See the Runtime Control section below for more details. Step 3: Set the Destination URI property of the item with a value following this format (replacing the italicized text as appropriate): form:responsibilityApplicationShortName:responsibilityKey:securityGroupKey:functionName For example, if you want to launch the FND Menus form, the Destination URI property should be set to: form:SYSADMIN:SYSTEM_ADMINISTRATOR:STANDARD:FND_FNDMNMNU Step 4: If you wish to pass parameters to the form, set the Destination URI property with a value using the following format (Note that the parameter list is delimited by a space between each "parameter=value" pair): form:responsibilityApplicationShortName:responsibilityKey:securityGroupKey:functionName:param1= value1 param2=value2 param3=value3 Note: If you wish to send varchar2 parameter values that contain spaces, use \" to enclose the string value. For example, to pass in something of the form: TXN_NUMBER=LT INVOICE 1 Use: TXN_NUMBER=\"LT INVOICE 1\" Step 5: Refer to the following Chapter 4 topics for information about additional properties you may need to set for the specific item: Buttons(Action/Navigation), Buttons (Links), or Images in Your Pages.
Runtime Control
There are no special programmatic steps necessary to launch an Oracle Applications form from a button, image, or link in an OA Framework page. The OAButtonBean, OALinkBean and OAImageBean support the special form function URL format described above for the Destination URI property. When OA Framework encounters this special value, it generates the appropriate URL and also adds a hidden IFrame (inline frame) to the OA Framework page. The hidden IFrame is the target of the FormsLauncher applet provided by Oracle Applications. Launching an Oracle Applications Form From a Submit Button If you wish to launch an Oracle Applications form from a submit button in an OA Framework page, you must use the OAPageContext.forwardImmediatelyToForm(String url) method from oracle.apps.fnd.framework.webui.OAPageContext. An example of how to use this API is shown in the code 270
sample below: public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); if (pageContext.getParameter("Apply")!=null) { String destination = "form:SYSADMIN:SYSTEM_ADMINISTRATOR:STANDARD:FND_FNDMNMNU"; pageContext.forwardImmediatelyToForm(destination); } }
Usage Notes
Microsoft Internet Explorer supports the IFrame element, so when you launch an Oracle Applications form from OA Framework, only a splash window appears. Any other windows required by the FormsLauncher applet use(s) the hidden IFrame as the target and therefore remain(s) hidden from the user. Netscape Navigator, on the other hand, does not support the IFrame element, so in addition to a splash window, the user also sees another window used by the FormsLauncher applet.
Runtime Control
If you wish to call the OA Framework page function directly from an Oracle Applications form, you must use the following Oracle Applications API: PACKAGE FND_FUNCTION IS procedure EXECUTE(function_name in varchar2, open_flag in varchar2 default 'Y', session_flag in varchar2 default 'SESSION', other_params in varchar2 default NULL, activate_flag in varchar2 default 'ACTIVATE', browser_target in varchar2 default NULL); You can also pass additional parameters via other_params using a URL format, such as name1=value1&name2=value2... For example: fnd_function.execute( function_name => 'OKE_OKEKVCOM' other_params => 'headerid='||:parameter.k_header_id|| '&Ver1='||:compare_version.version1|| '&Ver2='||:compare_version.version2); Note: There is no ampersand (&) in front of the first parameter name/value pair, but there is an ampersand in front of subsequent parameter name/value pairs. Note: The open_flag and session_flag parameters are not shown in the above example because they are redundant for an HTML function.
Personalization Considerations
271
See a summary of Forms / OA Framework Page Integration personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guideline(s) Javadoc File(s) Lesson(s) Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
272
273
Declarative Implementation
To add a page title, simply specify the Title property for your pageLayout region. Note: The pageLayout region also has a Window Title property which is used to specify the browser's window title. This has nothing to do with specifying the page title. Warning: Although your page may appear to have a page title if you add a header or one of the "default" regions to your pageLayout, the OA Framework does not interpret this as a page title. You must explicitly specify the region property as described.
Runtime Control
Warning: See the OA Framework Controller Coding Standards for guidelines that you should consider when writing web bean manipulation code. Instantiate Since the page title is a property of the page layout itself, you can't instantiate a page title directly. Instead, you set it on the oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean as shown below. Control Visual Properties To set the page title programmatically (which is a common practice if you need to specify context for the header like you would with "Update Employee: Fred Flintstone"), do the following: import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean; ... processRequest(OAPageContext pageContext, OAWebBean webBean) { ... // Assuming the controller is associated with the pageLayout region OAPageLayoutBean page = (OAPageLayoutBean)webBean; // Assuming the controller is associated with a child/grandchild region of the // pagelayout region OAPageLayoutBean page = (OAPageLayoutBean)pageContext.getPageLayoutBean(); // Always set translated text Strings obtained from Message Dictionary page.setTitle(<title text>); ... See Example: Implementing Search & Drilldown to Details for a more detailed example of setting a contextual page title.
Subheaders
The UI guidelines allow for two levels of subheaders below the page title: a "subheader" and a "subsubheader" 274
Declarative Implementation
To add a subheader to your page add a region with one of the styles listed in Figure 3 to a pageLayout. To add a subsubheader, add a region with one of the styles listed in Figure 3 to any subheader. Remember to specify its ID property in accordance the OA Framework Package / File / Directory naming standards. In both cases, the framework automatically indents the header in relation to its parent region, and sizes the header text in accordance with the UI guidelines. Tip: The classes corresponding to each of the "default" region styles subclass oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean, so they all behave as headers in your page. If you want to use these regions as layout templates, and you don't want the header line to show, set the Hide Header property to True. Figure 3: Relationship between header region styles and OA Framework classes Region Style OA Framework Class header oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean defaultSingleC oracle.apps.fnd.framework.webui.beans.layout.OADefaultSingleCol olumn umnBean defaultDoubleC oracle.apps.fnd.framework.webui.beans.layout.OADefaultDoubleCo olumn lumnBean hideShowHead oracle.apps.fnd.framework.webui.beans.layout.OAHideShowHeade er rBean As of release 11.5.10, the OADefaultSingleColumnBean and OADefaultDoubleColumnBean classes have been deprecated. In their place, you should use a combination of an OAHeaderBean followed by an oracle.apps.fnd.framework.webui.beans.layout.OAMessageComponentLayoutBean. See Page Layout (How to Place Content) for additional information.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate You can instantiate any of the classes described above by calling the appropriate createWebBean() method in the oracle.apps.fnd.framework.webui.OAControllerImpl class. If you select a signature that requires a constant to determine what kind of bean to create, use the following for each class: Figure 4: OAWebBeanConstants for creating corresponding OA Framework classes Constant OA Framework Class OAWebBea OAHeaderBean nConstants. HEADER_B EAN OAWebBea OADefaultSingleColumnBean nConstants. DEFAULT_ SINGLE_C OLUMN_B EAN OAWebBea OADefaultDoubleColumnBean nConstants. DEFAULT_ 275
DOUBLE_C OLUMN_B EAN OAWebBea OAHideShowHeaderBean nConstants. HIDE_SHO W_HEADE R_BEAN Note: You should not instantiate and programmatically add contents to any of the "default" regions. You may, however, instantiate regions that you define declaratively in JDeveloper. Control Visual Properties To change the header's text value, get a handle to the right class (based on what you instantiated, or specified declaratively) and call setText(OAPageContext pageContext, String text). To achieve the correct text size as specified in the UI Guidelines when headers are used in side navigation components, or displayed in the "Home" page main content area (in an "At a Glance" region, for example), call setSize(int size) on the header bean with one of the following values. 0 - the "large" size 1 - the "medium" size (used for headers displayed in the "Home" content page area). 2 - the "small" size (used for headers added to side navigation components) See the ToolBox Sample Library for an example of a "Home" page including headers in the main content area and in a side navigation component. To set the associated icon in your processRequest method, call setIcon(String icon) as shown: header.setIcon(OAWebBeanConstants.APPS_MEDIA_DIRECTORY + "<icon_name>.gif");
Adjacent Subheaders
The UI Guidelines allow multiple subheaders to be used side-by-side in a page a shown in Figure 4. Figure 4: Example of adjacent subheaders.
Declarative Implementation
You create the headers themselves as described in the Subheaders section above. Creating the layout to hold you adjacent subheaders is a different matter. For help with creating complex layouts declaratively, see Page Layout (How to Place Content).
Runtime Control
For any programmatic changes to the headers, also see the Subheaders section.
Declarative Implementation
Currently, you can't add a Side Navigation (including a header) to your page declaratively. See the Tabs / Navigation document for instructions on creating a Side Navigation component. Once you've created your Side Navigation, you simply add your header to it as you would to any other component.
Runtime Control
Control Visual Properties When you add a header to a container, the OA Framework automatically sets the text and line colors based on the corresponding background color. You do not need to set any color properties. The only change that you're likely to make to a header when you add it to a side navigation is to change the size of the header text since this is not configured automatically. Note: You cannot configure header text size by setting a CSS style; this is not supported. See the instructions for changing the header size in the Subheaders section above.
Hide/Show Subheaders
See the Hide/Show documentation for a description of this feature and implementation instructions
Known Issues
None
Related Information
BLAF UI Guidelines: Headers and Subheaders [ OTN Version ] Locator Element (Breadcrumbs) [ OTN Version ] Developer's Guide: Hide/Show Content Containers Page Layout (How to Place Content) Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean 277
oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean oracle.apps.fnd.framework.webui.beans.layout.OAHideShowHeaderBean oracle.apps.fnd.framework.webui.beans.layout.OADefaultSingleColumnBean oracle.apps.fnd.framework.webui.beans.layout.OADefaultDoubleColumnBean oracle.apps.fnd.framework.webui.beans.layout.OAMessageComponentLayoutBean ToolBox Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
278
HGrid
Overview
An HGrid, otherwise known as a hierarchy grid, allows users to browse through complex sets of hierarchical data. Certain types of data, such as the organizational structure of employees within a company, are naturally hierarchical, and best displayed as a tree structure. There are two UI components that display hierarchical information on a page: the HGrid bean and the Tree bean. A Tree is generally used when you want to put emphasis on the hierarchy and the relationship between different sets of objects in a hierarchy. A HGrid is more appropriate when you want to display the hierarchy, but also give more detailed information at each node of the hierarchy. Consider using a HGrid instead of a Tree when you want your users to either: Manipulate the objects in the hierarchy (add, delete, move, reorder, etc.). Note that in certain cases, you may want your users to navigate from a Tree to a Hgrid to perform these actions. You can do this by providing a button that switches to an "update" or "edit" mode which displays an HGrid instead of a Tree. See more object details than can be displayed in a Tree, AND the amount of required detail per object does not warrant use of a Tree with a Master/Detail view. Following is an example of a HGrid.
279
A HGrid consists of the following components/features, as called out in the figure above: 1. Breadcrumbs 2. Focus icon 3. Expand node arrow 4. Collapse node arrow 5. Focus column 6. Object hierarchy column 7. Multiple selection 8. Control bar 9. Selection/Expansion control 10. Root node 11. Record navigator Each row in a HGrid corresponds to a tree node. A HGrid also has two special columns: a focus column and an object hierarchy column. The object hierarchy column identifies the current tree node and allows you to expand or collapse this node. When you expand on a node that contains more records than the defined record set size, "Next" and "Previous" record navigation links appear. If the total number of records is known, the 280
record navigation links also display the record set range and the total number of records. The focus column allows you to select a new root for the tree. You can zoom into a subtree of a massive tree by selecting the focus icon for that subtree row. The HGrid also renders bread crumbs, allowing you to focus out (or zoom out) of the current subtree, and renders links to allow you to quickly expand or collapse all the nodes under the current focus root. This document describes the declarative definition and APIs provided by the HGrid (oracle.apps.fnd.framework.webui.beans.table.OAHGridBean) component within OA Framework. As described in the Oracle Browser Look-and-Feel (BLAF) UI Guideline: HGrid [OTN version] specification, the HGrid feature shares many properties with tables, most notably that it is a display of information in tabular format. The main difference between the two is that a table displays a flat list of objects, whereas a HGrid displays objects in a hierarchy. You should be familiar with the construction of a table (setting up the metadata as well as the business components). If you are not familiar with tables, please take a quick look at the Tables documentation before proceeding.
Contents
Defining Business Components Declarative Implementation Defining a HGrid Enabling Search on an HGrid Runtime Control processRequest method processFormRequest method Getting and Setting the Initial Focus Path Deleting Rows in a HGrid Using FireAction on the Hierarchy Column Using Save Model on the Hierarchy Column Personalization Considerations Known Issues Related Information
view object attached to the HGrid. The first step in defining a HGrid is to define the business object hierarchy that map to your business requirements. To illustrate the above, you can build a simple HGrid example to display supervisor-employee hierarchy infomation. (Note that some of the data model is greatly simplified for this example.) The data for each employee comes from the PER_ALL_PEOPLE_F view. Each employee is uniquely identified by the PERSON_ID column in this view. The PER_ALL_ASSIGNMENTS_F view describes the supervisor-employee relationship through the SUPERVISOR_ID and PERSON_ID columns in this view. Step 1: Set up a view object definition for the PER_ALL_PEOPLE_F view, selecting the data that you want to display in the HGrid. You can download oracle.apps.fnd.framework.persontree.server.PerAllPeopleFVO as an example. You can also download the corresponding VOImpl class. Note that the initQuery method in the VOImpl adds an additional where clause to the view object to fetch the root node. Step 2: Define the view link used to retrieve subsequent levels of the HGrid. In this example, define a view link that links the PerAllPeopleFVO to itself. a. In JDeveloper, select the package to which you want to add the view link. Right click and choose the Create View Link ... option to bring up the "View Link Wizard". b. In the View Link Wizard, Step 1 of 6: Name, enter a name for the view link (PerAllPeopleFVL in this example). c. In Step 2 of 6: View Objects, choose the source and destination view objects. In this example, PerAllPeopleFVO is used as both the source and destination. d. In Step 3 of 6: Source Attributes, select the source attributes. These typically are the primary key attributes (or a subset thereof) of the source view object. You may also want to select other columns that are needed to build the where clause used to fetch the detail row set. The values of these attributes from the master view object are used to determine the detail row set. For this example, use the PERSON_ID column as discussed earlier. e. In Step 4 of 6: Destination Attributes, select the destination attributes (as in the previous step). f. In Step 5 of 6: View Link SQL, build the where condition used to get the detail row set. The default where clause simply contains a one-to-one mapping of the source and destination attributes. The bind variables are bound with values of the source attributes in the master row. In this example, use the PER_ALL_ASSIGNMENTS_F view to determine all the persons supervised by the person in the master row. In other words, construct a where clause as follows: person_id in (select person_id from per_all_assignments_f where supervisor_id = :1) g. In Step 6 of 6: View Link Properties, ensure that the Generate Accessor in View Object checkbox is checked for both the Source and Destination view objects. The accessor name is generated automatically but you can change it if desired. h. You can download the complete definition for PerAllPeopleFVL. You can similarly setup additional view links if the master-detail relationships at each level of the HGrid are different. Step 3: Add the view objects and view links you created to the application module used for the page. Note that adding the view link to the application module using the Application Module Wizard can be tricky. First add the view objects to the application module. Then to add a view link, select the view link in the left column and select the source view object in the right column. This enables the ">" shuttle control and you can move the view link over to the right.
Declarative Implementation
Defining a HGrid
Having defined the data sources for the HGrid bean, the next step is to define the HGrid component in OA Extension. You may refer to the OA Component Reference for additional information about the properties you can set on the hGrid region. 282
In OA Framework, in addition to containing all the region items that a Table region can contain, a HGrid style region also contains a nested region item of style HGrid Hierarchy. The HGrid Hierarchy region item simply points to a nested region of style Tree Level. A Tree Level region corresponds to a node in a HGridBean. A Tree Level region contains two region items: a Tree Definition and a Tree Child. The Tree Definition region item describes the node and the Tree Child region item points to a nested region of style Tree Level. This allows OA Framework to build complex hierarchies in a declarative way. The definition of a HGrid is similar to that of a table. Specify the following metadata in OA Extension: Step 1: Define a top level region and set the Region Style property to hGrid. A HGrid region may also have an optional controller and application module. You can nest this region within a container region such as Page Layout, Header, Stack Layout, or messageComponentLayout. Note OA Extension assumes that for all regions, the Add Indexed Children property is set to True. As a result, the Add Indexed Children property generally does not appear in the Property Inspector. However, for backwards compatibility, the Add Indexed Children property will appear for a region if you previously set this property to False using an earlier version of OA Extension. Step 2: Select the hGrid region in the Structure pane. In the Property Inspector, set the Record Set Size property to control the maximum number of records that can be displayed at a time under each tree node. The syntax used to display the record navigation links is: {ParentName[/ObjectType];} {Next | Previous} [SetRange] [of TotalRecords] For example: Car Division/Brands: Next 11-20 of 26 Note When you set the Record Set Size property on the hGrid region, the value applies to all tree nodes in the HGrid. To achieve finer control, where each tree node has a different maximum record set size, you can set the Record Set Size property on the specific nodeDefinition. Step 3: OAHGridBean supports both single and multiple selection of rows. Refer to the instructions for rendering table selection and selection buttons on the control bar for additional information. Note HGrid currently does not yet support the Advanced Table selection and control bar implementation. Step 4: In the OA Extension Structure pane, select the hGrid region and display the context menu. In the context menu, under New, select tree, to create a HGrid hierarchy column (which distinguishes a HGrid from a table). In the figure below of the HGrid structure, the tree region is labeled as HGridHierarchyRN. This nested tree region defines a particular level in the hierarchy of the HGrid. The tree region can have two types of named children (members): nodeDefinition - The nodeDefinition item automatically appears when you create the tree region and defines the appearance of the node in the hierarchy. For the nodeDefinition item, specify: a value for the View Instance property to associate the node with a view instance. a value for the View Attribute property, to render the view attribute name as the text of the node in the object hierarchy column. a value for the Icon URI property to render an image next to the text in the node in the object hierarchy column. a value for the Destination URI property to render the node as a hyperlink in the object hierarchy column. a value for the Record Set Size property, if you wish to display a maximum record set size for this node that is different from the value of the Record Set Size property set on the hGrid region. childNode - In the Structure pane, select members under the Tree region and display the context menu. Under New, select childNode.The childNode item defines the parent-child relationship between tree levels. Set the Ancestor Node property on this item to indicate the region to which you are looping back. The Ancestor Node property can be set to another tree region, to the same tree region (for a recursive relationship), or to no tree region (null, indicating that the node is a leaf level in the hierarchy tree). The ancestor node should be set as a fully-qualified path name such as /oracle/apps/<applshortname>/<module>/<pagename>.<childNode ID > where the ancestor childNode ID is whatever childNode (node) you are looping back to. Attention: For a recursive relationship, as indicated above, you set the ancestor node to the same tree 283
region. However, the "same tree region" refers to the parent of the base recursing node and not the recursing node itself. Set the View Link Accessor property to the view link accessor name that should be used to retrieve the child nodes at this level. Note: Prior to OA Framework 11.5.10D, the view link instance used to retrieve the child nodes at a particular level was set via the child node's View Link Instance property. This property is now deprecated and is present only for backwards compatibility. You should only use the View Link Accessor property on the child node to specify the view link instance. Note: A childNode item can also have other nested members. Attention: If you intend to support the Export feature on a HGrid, then different viewAttributeNames cannot be used at different levels in the hierarchy column. All levels of the hierarchy column (that is, all nodeDefs) should have the same viewAttributeName. This is analogous to the definition of all other columns of a HGrid. This restriction does not apply if the Export feature is not being used.
Remember that each tree region can contain two members, as called out in the figure above: 1. nodeDefinition - holds the definition for this level, such as icon name, URL, etc. 2. childNode - holds the definition of the view link, pointing to the detail view object. Step 5: You can define other columns in the HGrid by adding corresponding region items to the HGrid region. The HGrid bean supports all the column types that the table bean supports, including form fields like text inputs and poplists. Note HGrid does not yet support the Advanced Table column and column group containers. Step 6: Be sure to set the View Instance and View Attribute properties on each of the region items representing your columns. Step 7: To define table actions, select your hGrid region in the Structure pane of OA Extension. Display the context menu and under New, choose the tableActions. This automatically creates a tableActions named child consisting of a flowLayout region. Step 8: Specify a standards-compliant ID for the region and leave the Region Style as flowLayout or set it to rowLayout. Suggestion If you have only buttons to add to the table actions area, then you can use either layout styles, flowLayout being preferrable. However, if you are adding message web beans such as messageChoice or messageTextInput, along with buttons to the table action area, then you should use the rowLayout style. Using 284
a flowLayout instead of a rowLayout in this case may cause alignment problems. Step 9: Under the Layout region, layout the children you want to render as table actions, such submitButton or messageChoice. Select the Layout region, and choose New > Item from the context menu. Select the new Item that is created and set the item style as appropriate.
Runtime Control
The last step in defining a HGrid is to setup a controller. Refer to the sample controller class PersonTreePageCO to continue with the person tree example discussed in the Defining Business Components section.
processRequest method
As is the case with other components in OA Framework, use the processRequest method for any custom layout code. Initialize the view object for the root node in this method. Note You must execute the query on the root view object. In the earlier original implementation of the HGrid, the HGrid used to automatically execute the query for the root view object. To ensure backward compatibility, this behavior is still present in OA Framework 11.5.57, however, moving forward, you should consider this behavior deprecated. 285
processFormRequest method
You can use the processFormRequest method to process form events from the page containing the HGrid. From a HGrid, you should access data only via the business components. Please look at the PersonTreePageCO for code that walks the business component tree. Refer to the oracle.apps.fnd.framework.webui.OAHGridQueriedRowEnumerator Javadoc for additional information.
//Delete all the rows in the list for (int i = 0; i < listOfRowsToDelete.size(); i++) { Row rowToDelete = (Row) listOfRowstoDelete.elementAt(i); //delete the row rowToDelete.remove(); } } Note In OA Framework 11.5.10B, if you try to call clearCache from the processFormRequest method, a developer mode error occurs, due to an incorrect developer mode check. This has been resolved in OA Framework 11.5.10C. You can avoid the error in 11.5.10B by temporarily turning off developer mode in OA Extension. (In OA Extension, select Project Settings from the Project menu, then navigate to Common > Oracle Applications > Run Options. Remove OADeveloperMode from the Selected Options list.)
Personalization Considerations
See a summary of HGrid personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
See a summary of key HGRID issues with suggested workarounds if available
Related Information
BLAF UI Guideline(s) HGrid [OTN version] HGrid Flows [OTN version] Javadoc File(s) oracle.cabo.ui.beans.table.HGridBean oracle.apps.fnd.framework.webui.beans.table.OAHGridBean oracle.apps.fnd.framework.webui.beans.nav.OAHGridHierarchyBean oracle.apps.fnd.framework.webui.OAHGridQueriedRowEnumerator oracle.cabo.ui.action.FireAction oracle.cabo.ui.collection.Parameter oracle.apps.fnd.framework.webui.beans.nav.OATreeDefinitionBean 287
Lesson(s) Frequently Asked Questions HGrid FAQ's Sample Code PerAllPeopleFVOImpl PersonTreePageCO PerAllPeopleFVL PerAllPeopleFVO Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
288
Hide/Show
Overview
As described in the BLAF UI Guideline: Hide/Show [ OTN Version ] specification, the Hide/Show feature lets the user control whether parts of a page are hidden or displayed by selecting a special link (or icon) that toggles between content "disclosed" and "hidden" states. Figure 1: Example of a Hide/Show control in the hidden (undisclosed) state. Figure 2: Example of a Hide/Show control in the disclosed state. Hide/Show can be incorporated into a page design in the following ways. Each implementation is described below. Hide/Show in Page Content Hide/Show in a Table Row Hide/Show in a Table Cell Hide/Show in Side Navigation Hide/Show Headers For efficiency, this feature uses Partial Page Rendering (PPR) to redraw only the part of the page that is affected by the Hide/Show component's selection. If PPR is not available (the user is running an unsupported browser or the developer disables the feature), the full page is redrawn for each Hide/Show event.
The OA Framework supports multiple Hide/Show components on a single page. You may even nest them as permitted by the UI Guidelines.
Declarative Implementation
Step 1: to add a Hide/Show component to your page, create region and set its style to hideShow. At runtime, the OA Framework will instantiate an oracle.apps.fnd.framework.webui.beans.layout.OADefaultHideShowBean. 289
Note: To ensure that the Hide/Show component is not indented when displayed, add it to a region that does not automatically indent its content (a stack or a header, for example). If you add it to a region that automatically indents its components (like a messageLayout region), the Hide/Show component will not render as specified in the UI Guidelines. Step 2: Set the following properties for the hideShow region: Disclosed Text - the text to display when the content is disclosed. Per the UI Guidelines, this text should be written in the form of "Hide <content description>". If you fail to specify this property, the OA Framework displays "Hide" as the default value. Undisclosed Text - the text to display when the content is hidden. Per the UI Guidelines, this text should be written in the form of "Show <content description>". If you fail to specify this property, the OA Framework displays "Show" as the default value. Initially Disclosed - controls whether the supplemental content is shown when the page first renders in the session (note that the OA Framework tracks the state of each hide/show component on the servlet session so it will always remember the user's last action when the page is rendered). The default value is "False." Step 3: Add the content that you want to control (regions and/or items) directly to the hideShow region. These regions and/or items will be added as indexed children of the hide/show component. Step 4 (optional): If you want to control the hideShow bean's disclosure state using a view object attribute, follow these substeps: Step 4.1: Define an attribute in the view object you want to reference. This attribute must be a Boolean type (in the SQL statement that maps to this attribute, use a DECODE to return 0 for false and 1 for true), and it must be updateable so the correct state can be set when the user toggles the control. Step 4.2: Set the View Instance Name property for the hideShow region to point to the view object you want to use. Step 4.3: Set the View Attribute Name property for the attribute you defined in Step 4.1. Step 4.4 Add logic to a controller for the hideShow (or higher in the hierarchy) to execute the view object's query. If the query has not been executed when the component is rendered, the Initially Disclosed state will be used. If the query has still not been executed when the user selects the link or icon, the OA Framework will throw a developer mode exception if your project has its OADeveloperMode property enabled (see Testing for additional information about OADeveloperMode). Repeating Hide/Show Controls (using Child View Instance) The Child View Instance property is exposed on container beans for the purpose of rendering the containers children multiple times (once for each row in the associated view object). To use this mechanism for displaying a Hide/Show control for each row, follow these steps: Step 1: Define a layout region (a stack layout, for example) in your page and add a Hide/Show control beneath it. Step 2: Set the Child View Instance property on the layout region to the view object you want to use to control the rendering. Step 3: Set the Child View Attribute property on the layout region to the view object's primary key (note that this does not support composite keys at this time). This step enables the OA Framework to correctly identify the Hide/Show control it creates for each view object row. Step 4: Set the View Instance Name property on the Hide/Show control to the same view object you referenced in Step 2. Also set its View Attribute Name property to a Boolean attribute that determines whether the content is hidden or shown (in the SQL statement that maps to this attribute, use a DECODE to return 0 for false and 1 for true, and it must be updateable so the correct state can be set when the user toggles the control.). Step 5: Add the components to the Hide/Show control that you want to display when its state is disclosed. Note that you can add any component you wish, except for a List of Values. Each of these components must bind to a view attribute in the view object you specified in Steps 2 and 3. Also see the Auto-Repeating Layout topic for additional information about using the Child View Instance property. Hide/Show and the Search "Go" Button 290
The BLAF UI Guidelines for Hide/Show suggest that the Search "Go" button should change locations based on whether the supplemental content is hidden or shown. For Oracle E-Business Suite products, you may simply add the Go button to your Search region after the Hide/Show component so its location remains the same while the user works in the page. This exception (which was approved by the BLAF UI team although it is not documented in the guidelines) avoids the need to implement a complex workaround in the OA Framework to support the conditional positioning.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate OADefaultHideShowBean Generally, there is little reason to instantiate a Hide/Show control yourself. That said, if absolutely necessary, you should instantiate an OADefaultHideShowBean if you want the OA Framework to automatically configure the bean to perform a form submit and handle the hide/show events. See the oracle.apps.fnd.framework.webui.OAControllerImpl Javadoc for other createWebBean() signatures. import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.layout.OADefaultHideShowBean; ... OADefaultHideShowBean hideShow = (OADefaultHideShowBean)createWebBean(pageContext, OAWebBeanConstants.DEFAULT_HIDE_SHOW_BEAN, null, "aName"); Once you instantiate the bean, you need to set it's disclosed and undisclosed text values as illustrated in the Control Visual Properties section below. Instantiate OAHideShowBean You should instantiate an OAHideShowBean only if you can't use the declarative implementation, and you need to fully configure the bean (for example, you want the icon/link selection to issue a GET instead of a POST as the "default" bean does), and you want to implement the event handling yourself (so you will be responsible for manually hiding and showing the supplemental content). See the OAControllerImpl Javadoc for other createWebBean signatures. import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.layout.OAHideShowBean; ... OAHideShowBean hideShow = (OAHideShowBean)createWebBean(pageContext, OAWebBeanConstants.HIDE_SHOW_BEAN, null, "aName"); Control Visual Properties You can set the disclosed and undisclosed text values at runtime as shown below. You cannot change the standard hide/show icon. import oracle.apps.fnd.framework.webui.beans.layout.OADefaultHideShowBean; ... processRequest(OAPageContext pageContext, OAWebBean webBean) { // Get a handle to the hideShow bean if this code is in a controller associated with // a parent or grandparent of the bean. OADefaultHideShowBean hideShow = (OADefaultHideShowBean)findIndexedChildRecursive("<component ID>"); // Alternatively, if this code is in a controller associated with the 291
hide/show // region, simply cast the OAWebBean parameter passed to the processRequest() // method. OADefaultHideShowBean hideShow = (OADefaultHideShowBean)webBean; // Set the undisclosed Text. Always remember to obtain a translated text value // from Message Dictionary. NEVER set a hard-coded text value. hideShow.setUndisclosedText("<Show...>"); // Set the undisclosed Text. Always remember to obtain a translated text value // from Message Dictionary. NEVER set a hard-coded text value. hideShow.setDisclosedText("<Hide...>"); // Set the default (initial) disclosure state. hideShow.setDefaultDisclosed(pageContext, Boolean.TRUE; } Control Behavior and Data The OA Framework automatically configures the OADefaultHideShowBean to perform a form submit when the user selects the link or icon. If you need to turn off client side Javascript validation when the form is submitted (you're using the hideShowBean in a data entry page), get a handle to your Hide/Show component and call the following in your processRequest method: hideShow.setUnvalidated(true); If you need to disable Partial Page Rendering for any reason, call the following in your processRequest method: hideShow.setPartialRenderMode(OAWebBeanConstants.PARTIAL_RENDER_MODE_NONE); You can also change the bound value if you're using a view object attribute to determine the disclosure state. hideShow.setViewUsageName(<"viewObjectInstanceName">); hideShow.setViewAttributeName(<"viewObjectAttributeName">; Handle Hide/Show Events When using the OADefaultHideShowBean, the OA Framework automatically handles the user selection events to hide and show supplemental content. If you need to write code to handle these events yourself for any reason, add the following code to your controller's processFormRequest method: Warning: You should not interfere with the OA Framework's handling of these events (in particular, do not make any changes involving the hide/show state management or the associated view instance if one is attached to the hide/show bean). // Get the name of the event currently being raised. String hideShowEvent = pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM); if ((OAWebBeanConstants.SHOW_EVENT.equals(hideShowEvent)) || (OAWebBeanConstants.HIDE_EVENT.equals(hideShowEvent))) { ... If you have multiple Hide/Show components on the page, you can also get the name of the bean that raised the event by getting the value of the source parameter: // Get the component ID for the bean that raised this event String hideShowId = pageContext.getParameter(OAWebBeanConstants.SOURCE_PARAM); Note that if you associate a controller with your Hide/Show control (so the webBean parameter in the processFormRequest method is referencing this component), then the source parameter value will equal the webBean's component ID. public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { String hideShowEvent = 292
pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM); // Get the component ID for the bean that raised this event String hideShowId = pageContext.getParameter(OAWebBeanConstants.SOURCE_PARAM); // Get the component ID of the current webBean String beanId = webBean.getUINodeName(); if (beanId.equals(hideShowId))... Back Button / Refresh Considerations The OA Framework automatically handles user selection of the browser Back and Refresh buttons for this component. That said, however, if you're using a view object to manage the disclosure state, you should consider review Supporting the Browser Back Button before proceeding.
Personalization Considerations
See a summary of Hide/Show personalization considerations in the Oracle Applications Framework Personalization Guide.
Declarative Implementation
To implement this as shown in a table column (without prompts for the data), follow the same steps that are listed in the Hide/Show in Page Content section with the following difference: You must specify the View Instance and View Attribute names. The View Instance should reference the same view object that the table is using, and the View Attribute must be a Boolean type (in the SQL statement that maps to this attribute, use a DECODE to return 0 for false and 1 for true), and it must be updateable so the correct state can be set when the user toggles the control. If you want the data in the Hide/Show column to include prompts, you must add a tableLayout to the column first, and then add your hideShow region as described above.
Runtime Control
See the Hide/Show in Page Content section for runtime control instructions.
Personalization Considerations
See a summary of Hide/Show personalization considerations in the Oracle Applications Framework Personalization Guide.
The OA Framework currently does not support Hide/Show in a side navigation as shown in Figure 6, and this is not planned for 11.5.10. Figure 6: example of a Hide/Show control in a Side Navigation
Hide/Show Headers
If you want to hide or show all the contents beneath a subheader as shown in Figures 6 and 7, use the Hide/Show Header bean. Note: This bean does not have associated disclosed and hidden text properties since only the Hide/Show icon toggles when the user selects it. The header text remains the same in both states. Figure 7: example of a Hide/Show Header in the disclosed state
Declarative Implementation
To add a Hide/Show Header to your page, create a region and set it's style to hideShowHeader. At runtime, the OA Framework will instantiate an OAHideShowHeaderBean. The only other region property that you must set is the Text to display. You can also change the default Initially Disclosed value from False to True. Finally, add contents to the hideShowHeader as you would for any other header region.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or easily extended. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate See the OAControllerImpl Javadoc for other createWebBean signatures. Import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.layout.OAHideShowHeaderBean; 294
... OAHideShowHeaderBean header = (OAHideShowHeaderBean)createWebBean(pageContext, OAWebBeanConstants.HIDE_SHOW_HEADER_BEAN, null, "aName"); Control Visual Properties The only visual property that you can set for this bean is the header's text as shown: // Always remember to obtain a translated text value from Message Dictionary // NEVER set a hard-coded text value. header.setText(pageContext, "<some value>"); Control Behavior and Data As described in the Hide/Show in Page Content section above, you can change the bound value if you're using a view object attribute to determine the disclosure state. You can also turn off client-side Javascript validation if needed. Handle Hide/Show Events The OA Framework automatically handles hiding and showing the header's content. There is no reason to write code to handle this yourself. Back Button / Refresh Considerations The OA Framework automatically handles user selection of the browser Back and Refresh buttons for this component. That said, however, if you're using a view object to manage the disclosure state, you should review Supporting the Browser Back Button before proceeding.
Personalization Considerations
See a summary of Hide/Show personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guidelines Hide/Show [ OTN Version ] OA Framework Developer's Guide Tables [ Classic | Advanced ] Testing OA Framework Applications OA Framework Controller Coding Standards Partial Page Rendering Supporting the Browser Back Button Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAHideShowBean oracle.apps.fnd.framework.webui.beans.layout.OADefaultHideShowBean oracle.apps.fnd.framework.webui.beans.layout.OAHideShowHeaderBean oracle.apps.fnd.framework.webui.OAControllerImpl OA Framework ToolBox Tutorial / Sample Library oracle.apps.fnd.framework.toolbox.tutorial.webui.SupplierSearchPG oracle.apps.fnd.framework.toolbox.samplelib.webui.BasicStructPG Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
295
2 3
This document describes how to add images in the third category. See the Branding document for additional information about the second category. UIX renders images in the first category automatically. Figure 1: Typical OA Framework page showing all 3 categories of images
296
Declarative Implementation
Step 1: Locate the image that you want to add to your page in either the Ancillary Graphic Repository (internal link | external link) or the Icon Repository (internal link | external link). You'll need the image's name and its size for Step 2. Note for Oracle E-Business Suite Developers: If you think you need new images for your product, contact the Oracle User Interface team to request assistance. Once the UI team creates a new icon for you and adds it to the Icon Repository or the Ancillary Graphic Repository, the OA Framework team automatically includes this new file in the next regularly scheduled "images" ARU. Step 2: Create a new item with a standards-compliant ID and set the following properties for the item: Set the Style property to image. Set the Image URI to the image's name. For example, to add the Update (enabled) icon shown in Figure 1 above, you would set this value to updateicon_enabled.gif. Set the Additional Text property to the value listed in the image's source repository. This value is displayed as tooltip text, and used for accessible component access (and as such is required by the Accessibility coding standards). Set the Height to the image's published height (for example, if an image is 23 pixels tall and 7 pixels wide, set this value to 23). Set the Width to the image's published width (for example, if an image is 23 pixels tall and 7 pixels wide, set this value to 7). Note that you must set the Height and Width properties for images that you add to the page. See the View Coding Standard V30 for additional information about this. If selecting the image should perform an HTTP GET, set the Destination URI to a target page (for example: OA.jsp?page=/oracle/apps/fnd/framework/toolbox/samplelib/webui/SampleBrowserPG&retainAM=Y). If selecting the image should perform an HTTP POST, see Submitting the Form for special configuration instructions. At runtime, the OA Framework instantiates an oracle.apps.fnd.framework.webui.beans.OAImageBean. Tip: If you need to conditionally display different images in a table (for example, a Delete image is enabled or disabled on a row-level basis), use a Table Switcher. You can also use a bound value as shown in the Runtime Control example below.
Runtime Control
If you want to add an image to your page programmatically, you must specify the relative image path in addition to setting the height and width (when you add an image declaratively, it is sufficient to specify just the image's name). For example: import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.OAImageBean; ...
dots.setHeight("35"); dots.setWidth("8"); webBean.addIndexedChild(dots); } You can also add an image to your page using bound values as shown below (see the Bound Values topic for additional information). This particular example (from the PoSummaryCO class in the ToolBox Tutorial application) uses a view object attribute value to set the correct status image on a row-level basis). import oracle.cabo.ui.data.BoundValue; import oracle.cabo.ui.data.bind.ConcatBoundValue; import oracle.cabo.ui.data.bind.FixedBoundValue; import oracle.apps.fnd.framework.webui.OADataBoundValueViewObject; import oracle.apps.fnd.framework.webui.beans.OAImageBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAImageBean statusImageBean = (OAImageBean)table.findIndexedChildRecursive("StatusImage"); /* ** Note that you may define an image bound value without specifying the APPS_MEDIA_DIRECTORY, ** however, we include this example to show you how to concatenate a fixed bound value ** with a data bound value. */ // Define the OA Framework image directory FixedBoundValue imageDirectory = new FixedBoundValue(APPS_MEDIA_DIRECTORY); // Define a binding between the image bean and the view object attribute that it // will reference to get the appropriate .gif image value name. // Note that the corresponding attribute values are obtained using a decode() in the // POSimpleSummaryVO view object. OADataBoundValueViewObject statusBinding = new OADataBoundValueViewObject(statusImageBean, "StatusImage"); // Concatenate the image directory with the actual image name (as retrieved // from the view object attribute decode() statement) ConcatBoundValue statusCBV = new ConcatBoundValue(new BoundValue[] {imageDirectory, statusBinding}); // Finally tell the image bean where to get the image source attribute statusImageBean.setAttributeValue(SOURCE_ATTR, statusCBV); }
Personalization Considerations
See a summary of Images in Your Pages personalization considerations in the Oracle Applications Framework Personalization Guide. 298
Known Issues
None
Related Information
BLAF UI Guideline(s) Ancillary Graphic List (Repository) (internal link | external link) Icon Repository (internal link | external link) Javadoc oracle.apps.fnd.framework.webui.beans.OAImageBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
299
300
301
Tips
Although the field-level hint properties in JDeveloper are called "tips," a tip in BLAF UI Guidelines parlance is a special component with an icon, a standard "TIP" prefix and the tip text that you define (an example is shown immediately above the search results table in Figure 1). When you define a tip for your page, the OA Framework instantiates an oracle.apps.fnd.framework.webui.beans.OATipBean and renders the tip text in the current session language. Tip: If you want to display tip text that includes HTML tags, see the Custom HTML document. Declarative Implementation To add a tip to your document: Step 1: In the JDeveloper structure pane, select the region where you want to add a tip, right-click and select New > Item. Note that, unlike field-level hints which are associated with directly with existing items, tips are like any other item; you can simply add them wherever you need them. Step 2: Specify the item ID in accordance with the OA Framework Naming Standards and set the Item Style to tip. Step 3: If your tip text is very brief, you may enter it directly in the Text property. Otherwise, define a message in the Applications Message Dictionary, and then set the Tip Message Appl Short Name and the Tip Message Name accordingly. Runtime Control Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. If you need to create a tip programmatically, follow these steps: Step 1: Create a message in the Applications Message Dictionary. Step 2: Instantiate the tip as shown below. Then, instantiate an oracle.apps.fnd.framework.webui.beans.OAStaticStyledTextBean to hold your tip text and add it as an indexed child of the tip. Note that UIX automatically sets the CSS style to OraTipText on your behalf. import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.OAStaticStyledTextBean; import oracle.apps.fnd.framework.webui.beans.OATipBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { // Always call this first. super.processRequest(pageContext, webBean); // Instantiate the tip bean using the factory mechanism (do not use "new"). 302
OATipBean tip = (OATipBean)createWebBean(pageContext, OAWebBeanConstants.TIP_BEAN, null,"aName"); // Instantiate the text portion of the tip. OAStaticStyledTextBean tipText = (OAStaticStyledTextBean)createWebBean(pageContext, OAWebBeanConstants.STATIC_STYLED_TEXT_BEAN, null,"anotherName"); // Obtain the translated text value from the Applications Message Dictionary // and set it as the text value in the static styled text bean. String tipTextValue = pageContext.getMessage("AK", "FWK_TBX_T_TIP_BEAN", null); tipText.setText(tipTextValue); // Add the tip text to the tip bean. tip.addIndexedChildren(tipText); }
Bubble Text
Bubble text, otherwise known as "ALT" or "rollover" text, should be added to buttons and images as described in the OA Framework View Coding Standards Accessibility section. See this document for instructions on when and how to specify the ALT text. See the UI Guideline for information on appropriate verbiage.
Related Information
BLAF UI Guidelines Inline Messaging, Tips, Hints and Bubble Text [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.OATipBean oracle.apps.fnd.framework.webui.beans.OAStaticStyledTextBean Developer's Guide Instruction Text Buttons (Global) Custom HTML OA Framework View Coding Standards OA Framework File Standards Error Handling OA Framework ToolBox Tutorial / Sample Library oracle.apps.fnd.framework.toolbox.tutorial.webui.PoSearchPG.xml Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
303
Instruction Text
Overview
Per the Oracle Browser Look-and-Feel (BLAF) UI Guideline Instruction Text [ OTN Version ], instruction text is the primary method for directing and helping users to perform specific tasks. Instruction text can be specified in relation to the following as illustrated in Figure 1 below. the entire page a section of content (a subheader or a subsubheader) a table a group of components within a section of content (rare, not illustrated in Figure 1) Figure 1: Example of instruction text in different parts of the page.
See Inline Messages, Tips, Hints and Bubble Text for information on creating field-level hints and tips as shown above the table in Figure 1.
Declarative Implementation
To add plain instruction text (without any links or HTML formatting) in any of the valid page areas, following these steps and the OA Framework will create an oracle.apps.fnd.framework.webui.beans.OAStaticStyledTextBean. Tip: If you want to display tip text that includes HTML tags, see the Custom HTML document. Step 1: Create a message in the Applications Message Dictionary. Step 2: Create a region item and set its Style to staticStyledText. Step 3: Set the region item's ID property in accordance the OA Framework File Standards. Step 4: Set the CSS Class property to OraInstructionText. Step 5: Associate the message you created in Step 1 with the region item you created in Step 2 by setting its Message Name and Message Appl Short Name properties as appropriate for your message.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. If you need to create a tip programmatically, follow these steps: 304
Step 1: Create a message in the Applications Message Dictionary. Step 2: Instantiate the static styled text and configure its key properties. import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.OAStaticStyledTextBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { // Always call this first. super.processRequest(pageContext, webBean); // Instantiate the instruction text bean using the createWebBean() factory. OAStaticStyledTextBean helpText = (OAStaticStyledTextBean)createWebBean(pageContext, OAWebBeanConstants.STATIC_STYLED_TEXT_BEAN, null,"aName"); // Obtain the translated message from Message Dictionary and set it // as the bean's value. String helpTextValue = pageContext.getMessage("AK", "FWK_TBX_T_REGION_GENERAL", null); helpText.setText(helpTextValue); // Set the CSS Style to OraInstructionText. helpText.setCSSClass("OraInstructionText"); }
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines: Instruction Text [ OTN Version ] Developer's Guide Custom HTML Javadoc oracle.apps.fnd.framework.webui.beans.OAStaticStyledTextBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
305
Buttons (Links)
Overview
This document describes the different kinds of links that you can create for your pages. "Return to" Link Display-Only Table Column Link Display-Only Text Field Link Plain Link "Mailto" Action Link Form Submit Links Note: For information about buttons that behave as links, see Buttons (Action / Navigation). For information about embedding links in instruction text, see the Instruction Text document.
Declarative Implementation
A "Return to... link" is a special named component of the page layout region. To create one: Step 1: Select your pageLayout region in the JDeveloper Structure pane, right-click and select New > ReturnNavigation. JDeveloper creates a link item for you. Step 2: Name the link in accordance with the OA Framework File Standards, set the Text to display, and set the Destination URI to the target page. For example: OA.jsp?page=/oracle/apps/dem/employee/webui/EmpSearchPG&retainAM=Y.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate To add a return link programmatically: processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OALinkBean returnLink = (OALinkBean)createWebBean(pageContext, OAWebBeanConstants.LINK_BEAN, null, "returnLink"); returnLink.setDestination("OA.jsp?page=/oracle/apps/dem/employee/webui/EmpSearchP G&retainAM=Y"); // Retrieve and set the translated link text. String linkText = pageContext.getMessage("AK", "FWK_TBX_T_RETURN_TO_POS", null); returnLink.setText(linkText); 306
See Implementing the View for detailed information about using URL tokens.
Plain Link
If you want to display a simple link without a prompt, add a link item to your page and set its Destination URI property. You can either set its Text property, or you can bind the link to a view object by setting its View Instance and View Attribute properties.
"Mailto"Action Link
If you want a link to send an email when selected, for any component that can be configured as a link, simply set the destination property to mailto:<emailAddress>. For example, the Destination URI property for the "Buyer" field shown in Figure 3 above is defined as mailto:{@BuyerEmail}. Note the use of token replacement to obtain the BuyerEmail value from a view object attribute.
Related Information
307
BLAF UI Guidelines Buttons (Links) [ OTN Version ] OA Framework Developer's Guide Submitting the Form Implementing the View OA Framework File Standards OA Framework Controller Coding Standards Buttons (Action / Navigation) Instruction Text Javadoc oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean oracle.apps.fnd.framework.webui.beans.nav.OALinkBean oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
308
An LOV Primer
Before learning how to implement a List of Values, it's important to understand its key components and behavior. This section briefly describes each of the following; implementation-level details are provided below for different LOV types. Base Page and LOV Window LOV Mappings Dependent LOVs Validation (Also Known as "Autocompletion") AutoClear
309
LOV Mappings
LOV Mappings define the data communication between the base page the and LOV window. An LOV map is comprised of the following participants: LOV Item The item in the LOV for which the mapping is defined. (Base Page) Criteria When the user invokes a List of Values, one or more field values from the base page can be passed to the LOV to be used as search criteria (note that the LOV field on the base page should always be configured as a search criteria item). When the LOV window renders, the query results are displayed. For example, in the purchase order example above, if the user enters "2" in the "Purchase Order" field and selects the LOV icon, the query will return all purchase orders whose number starts with "2." If you need to programmatically control the query criteria (for example, you need to intercept base page values to ascertain what the real query criteria should be), then you must configure the LOV to accept passive criteria, which is loosely defined to mean any LOV query criteria that you specify programmatically in an associated LOV controller. (Base Page) Result When the user selects a row in the LOV, one or more values are returned to the base page. In the ToolBox Tutorial Application example shown in Figure 1 above, each of the user-friendly "Buyer," "Supplier" and "Supplier Site" LOV fields also have hidden primary keys. When the user selects a value from the LOV, the OA Framework copies both the user-friendly name and the primary key values to the base page. Figure 3: XML page structure showing the Buyer, Supplier and Supplier Site LOV fields and the corresponding hidden primary key fields.
310
Dependent LOVs
You can also configure an LOV value to depend on a value from another field(s). For example, in the ToolBox Tutorial Application example shown above, the user cannot select a supplier site value until a supplier is selected, so the "Supplier Site" LOV is configured to depend on the "Supplier" value.
the result fields will still be empty. If the user enters a value in the LOV field and immediately selects a submit button, link or icon without tabbing out first, regular validation is not performed. When validate-on-submit is enabled, the LOV behaves almost exactly the same as it does when performing the standard validation: If a single match is found, the OA Framework automatically populates the result field(s). If multiple matches are found, the OA Framework displays an error message at the top of the base page. If no matches are found, the OA Framework displays an error message at the top of the base page. Passive Criteria Prior to release 11.5.10, LOVs with passive criteria could not be validated properly. Even if a single valid match was found for the given criteria, the OA Framework displayed the LOV window so the user could select the single matching value. Now, even LOVs with passive criteria can be validated (assuming you enable validation on the LOV field as described in the implementation details below).
AutoClear
The OA Framework automatically clears dependent fields when the user changes the LOV value. First, if the user changes a value of the LOV field, or any criteria items for the LOV, and tabs out, the OA Framework clears all associated result field values. Second, if the user changes the value of an LOV criteria field and tabs out, the OA Framework clears the LOV field value. Note that AutoClear cascades throughout LOV relationships. For example, assume the user changes the value of a criteria field and tabs out. The OA Framework clears the corresponding LOV input field, and in turn, clears all related results fields. If any of these result fields are designated as a criteria for different LOV field, that LOV input will also be cleared along with its result fields. This continues until all related LOV items have been cleared. Warning: If an LOV result is written to a messageStyledText item, AutoClear cannot clear this field.
Declarative Implementation
Driving View Object Based on Entity Objects If the view object that you are updating with the LOV selection results is based on entity objects, and your LOV will be returning values mapped to entity-object based attributes on one or more reference entity objects: 1. You must define associations between the driving entity and each reference entity. 2. In the view object definition wizard, you must configure each reference entity object's Association End as Reference and Read Only. For example, assume you define a page to create a purchase order including an LOV to select a supplier: The LOV returns a SUPPLIER_ID foreign key value for update on the purchase order (PurchaseOrderEO), and a SUPPLIER_NAME value to display in the UI. The SUPPLIER_NAME value is mapped to a reference entity object attribute (SupplierEO.SUPPLIER_NAME). There is a reference association (PoToSupplierAO) that joins the PurchaseOrderEO.SUPPLIER_ID and the SupplierEO.SUPLIER_ID. When you configure the purchase order view object to reference the SupplierEO via the PoToSupplierAO, you must check both the Read Only and Reference properties. If you follow these instructions, the OA Framework does not attempt to write any values on reference entities (thereby avoiding a BC4J runtime error regarding updates to a Read Only entity), and BC4J's standard faulting mechanism is used to automatically query the reference values as needed. 312
LOV View Object and Application Module Step 1: As described in Implementing the Model, define a view object for your list of values query (note that the OA Framework File Standards recommend creating this application module in the oracle/apps/<app_short_name>/<module>/lov/server directory). This view object should include all the columns you want to display in the LOV results table, and any hidden values that you want to return when the user makes a choice. For example, a view object for selecting a buyer might include BUYER_NAME (displayed value), BUYER_ID (hidden primary key), and JOB_TITLE (displayed value). You do not need to include a WHERE clause for the base page search criteria items; the OA Framework automatically appends an appropriate WHERE clauses and bind variables based on the LOV criteria. That said, however, your LOV can include a WHERE clause that always restricts the result set (for example, an END_DATE check for a "Currently Employed Buyers" LOV). The view object for the LOV region can be based on an entity object, but given its limited data selection, it's typically created using plain SQL. Step 2: If you have not already done so, create a dedicated application module (AM) to contain all view objects that are shared by a package or module (note that the OA Framework File Standards recommend creating this application module in the oracle/apps/<app_short_name>/<module>/lov/server directory). Add the view object that you created in Step 1 to this application module. Note: Do not designate this application module as being passivation-enabled (it isn't a real root application module). LOV Field and (Optional) Additional Criteria/Results Fields Step 3: In the JDeveloper Structure pane, select the region where you want to add the LOV field, right-click and select New > Item. Set the Item Style property to messageLovInput. Step 3.1: Specify a standards-compliant ID, an Attribute Set and other properties as usual for text fields. Step 3.2: If you don't want the LOV to automatically validate when the user enters a value and tabs out or submits the form without tabbing out, set the Disable Validation property to True. Note that, per the OA Framework View Coding Standards, this value should always be False unless it's essential that you allow partial values in the field (in a search region, for example). Step 4 (optional): Create additional items for LOV result values. For example, if you create an LOV for "Employee Name," you will probably need a hidden field for the "Employee ID" value. Note that you should set the Style to formValue and the Rendered property to True for all hidden fields used for LOV results. Items of type messageStyledText are also valid for results. Step 5 (optional): Create additional items for LOV search criteria. Note that LOV criteria items must be form elements (for example, they cannot be of type messageStyledText). If not, the LOV cannot read their values. For example, if you define a text input field as an LOV criteria item, but you set its Read Only property to True, it is not rendered as a form element. Tip: If you want to use the value that you display in a messageStyledText field as LOV search criteria, consider creating a mirror formValue field to hold the same value. LOVs do allow formValue items as criteria items. Warning: Query criteria for supplemental fields (in addition to the LOV field itself) must be used carefully. For example, assume an "Employee Name" LOV is configured to apply a "Department" value as query criteria. If the user enters a value of "Sales" in the "Department" field and selects the "Employee Name" LOV icon, all employees in the sales department are displayed. The value entered in the criteria field is used to perform an exact match (the base page LOV field's value is an exception to this rule as it is always used to perform a partial match). As a consequence, if the user enters "Sa" in the "Department" field and invokes the "Employee Name" LOV, the query will not find any employees in the "Sales" department. Supplemental query criteria items cannot be used as user enterable search criteria within the LOV itself. So, in our "Department" example, the LOV cannot be configured to let the user search on "Department" within the LOV window (if she realizes she wants to search in the "Consulting" department instead, she needs to dismiss the LOV and change the "Department" value on the base 313
page before opening invoking the LOV a second time). LOV Region Step 6: Create the LOV region itself. First, you need to decide if you want to create an "external" LOV that can be leveraged in multiple pages by defining unique mappings for each instance, or a single-use LOV for use only in the current page. Instructions for each are provided below. To create a single-use LOV region: Step 6.1 When a you create a messageLovInput item, JDeveloper automatically creates an inline LOV region (listOfValues style) for this item. Step 6.2: Select your new listOfValues region in the Structure pane, and set its AM Definition property to the fully qualified name of the application module you created in Step 2 above (for example, /oracle/apps/fnd/framework/toolbox/tutorial/lov/server/TutorialLOVAM). Step 6.3: Select the listOfValues region again, right-click and select New > Region Using Wizard to quickly create your results table and bind it to the view object you created above (see the Tables documentation for additional information about creating this component). Remember to give the region and its items standards-compliant IDs, and specify appropriate Attribute Sets for the items. Set the item Style to messageStyledText for any items you want to display in the LOV "Results" table. Note that at least one table item must be of type messageStyledText for the LOV to render properly. Set the item Style to formValue for any hidden items (remember to set their Rendered property value to True so the OA Framework includes them in the web bean hierarchy). Set the Search Allowed property to True for any LOV result items you want to present to the user as searchable values. These items are listed in the search poplist the user sees in the LOV window. At a minimum you must set the Search Allowed property to True for the the result table item corresponding to the LOV field on the base page. Do NOT set the Search Allowed property to True for any result table items that correspond to the supplemental search criteria items that you created in Step 5 above. Set the Selective Search Criteria property to True to identify items for which the user must provide search criteria (see the Search topic for additional information about selective search criteria). In the simple LOV search, only those items that have both the Search Allowed and Selective Search Criteria properties set to True will appear in the Search By poplist. At runtime, the user must provide a real search value; if the user enters % or tries to perform the search without specifying a Search By value, the OA Framework displays the standard selective search criteria error message. Note: For backwards compatibility, simple searches will function as they always have if none of the items are marked with the Selective Search Criteria property set to True. In the advanced LOV search (instructions for enabling an advanced search are provided below), all items whose Search Allowed property is set to True will render, however, the user must enter a value in at least one of the designated Selective Search Criteria fields. Note: If you enable an advanced search, you must designate at least one Selective Search Criteria item. Step 6.4 (optional): Select the listOfValues region again, right-click and select New > searchInstructions to provide custom help text for the LOV search region. Specify a standardscompliant ID, set the CSS Class to OraInstructionText and specify the Message Dictionary message to display as the help text by setting the Tip Message Appl Short Name and the Tip Message Name as appropriate. To create a reusable LOV region: Step 6.1: Create the shared region (not a page!) using the instructions provided in Implementing the View: Create a Shared Region. Set its Style to listOfValues. Steps 6.2 - 6.4: Follow as documented above for the single-use LOV region. Step 6.5: Associate the reusable LOV with the base page LOV field. In the JDeveloper Structure pane, select the LOV item you created in Step 3 and set its External LOV property to the fully qualified name 314
of the shared listOfValues region you just created (for example, /oracle/apps/fnd/framework/toolbox/tutorial/lov/webui/EmployeesLovRN). Note: JDeveloper confirms that you want to replace the default generated inline LOV region with the external LOV. Select the OK button to proceed, and JDeveloper will remove inline LOV region and display the external LOV in a dimmed state since you cannot edit a referenced object. Tip: If you change your mind and want to create an inline LOV after setting an external LOV, select the Set to Default Property Inspector toolbar button to clear the External LOV property. JDeveloper automatically recreates the default inline LOV region for you. LOV Mappings Step 7: Create the LOV Mappings (regardless of whether you choose to implement a reusable LOV or a single-use LOV, you map its data communication relationship to the base page in the same way). For the first mapping, select the LOV mapping that was created by default when you created your messageLovInput. To create additional mappings, select the lovMappings node in the Structure window, right-click and select New > lovMap from the context menu. To configure a mapping: Specify the LOV Region Item that will participate in the mapping. Specify the Criteria Item for a base page item whose value is to be used as LOV search criteria. Specify the Return Item for a base page item whose value is to be populated by the LOV selection. Set the Required property to True for Criteria Items whose values must be populated before the LOV can be invoked (if not, the OA Framework displays an error message in the LOV window). Set the Programmatic Query property to True for any Criteria Items whose values you want to apply to the WHERE clause programmatically. Tip: you might use this approach, for example, if you have supplemental Criteria Items whose values should be used for partial matches instead of the default OA Framework behavior of an exact match (remember that the LOV field value itself is always used for a partial match). Set the Use for Validation property one of the following values: default validate-on-submit will be triggered if the base item is of type formValue, and if it has no value (this is the OA Framework 5.7 behavior) yes validate-on-submit will be triggered if the base item has no value regardless of the item type. no validate-on-submit is not triggered by a null value regardless of the item type. Note: if you want to turn off validate-on-submit altogether for an LOV input, you need to set the Use for Validation property to no for all LOV maps whose base item is of type formValue. When configuring your mappings, pay close attention to the following usage notes: First and foremost, you need one mapping for each distinct field on the base page that you want to use as criteria and/or to which you want to return a result value. A single LOV mapping for the LOV field can handle both sending criteria values to the LOV, and receiving result values from the LOV. Note that older pages migrated from previous versions of JRAD or AK may show separate mappings for each direction. The data types for the LOV Region Item and the Criteria/Results Items must match. If not, and you are running in Developer Test Mode, you will get an error. You must have a mapping for the base page LOV field. Specify the name of that field for both the Criteria Item and Return Item properties. For the LOV Region Item property, specify the item in the LOV region that corresponds to the base page LOV field. If you fail to configure the LOV field as a Criteria Item and you're running your page in Developer Test Mode, the OA Framework will display an error. In LOV mappings for fields other than the LOV field itself, you can specify either the Criteria Item or the Return Item property, but not both. Do not try to create one mapping for a (non-LOV field) field as criteria and another mapping for the same field as a return item, as this will cause runtime errors. For the LOV Region Item property, specify the item in the LOV region that corresponds to the appropriate base page field. If your LOV does not naturally include a formValue result item (so it returns its values only to visible fields), you must add at least one formValue result field whose Use for Validation property is set to True. For example, consider the following Address example: 315
LOV Usage Item Name Item Type criteria AddressLov messageTextInput result AddressLov messageTextInput result City messageTextInput result State messageTextInput In this case, we have an AddressLov field with associated City and State fields. When the user selects a value from the Address list of values, results are returned to the AddressLov field and its related City and State fields. This configuration can lead to the submission of invalid values when partial page rendering (PPR) is disabled. To resolve this, simply add a formValue item for one of the results as shown: Item Type LOV Usage Item Name criteria AddressLov messageTextInput result AddressLov messageTextInput result City messageTextInput result State messageTextInput result AddressFormValue formValue If the user tries to submit invalid values for the address fields, the OA Framework detects that the AddressFormValue field is null (meaning that it has not been populated by a valid LOV result value), and so it will validate the values on submission. General Usage Notes The base page's LOV value is applied only to the first, automatic query that the OA Framework executes when the LOV window first opens (or for autovalidation, when the user leaves the LOV field after entering a partial value). Any subsequent searches performed by the user in the LOV window do not use the base page LOV value. If there is no criteria in the base page LOV field, the OA Framework does not perform an automatic query when the LOV window opens. Query criteria from fields other than the LOV field are not displayed in the LOV window, but they will affect all queries executed in the LOV window. Any query criteria values from items configured as passive criteria are not automatically added to the WHERE clause; you must manually set them in a controller as described above. A table and an LOV used in a table should always used different view objects to avoid stale data errors. If an LOV is used in a table or an HGrid, you cannot map to criteria or result fields outside the table or HGrid. If you make an LOV text input field read only, the OA Framework hides the LOV icon and renders the data in messageStyledText item. If an LOV is used in a table with an "Add Another Row" button, and the LOV returns a result to a messageStyledText item, add a mirror formValue item for the messageStyledText item and map it to the same underlying view object attribute. Then, add a special LOV map to return the same value to the formValue field that you return to the messageStyledText field. This ensures that the data is properly written to the underlying view object. Enabling Advanced Search in Your LOV If you want to enable an advanced search in your LOV, in addition to the default simple search, set the Advanced Search Allowed property on the listOfValues region to True. You can also set this property prgrammatically by calling setAdvancedListOfValues(Boolean.true) on the OAListOfValuesBean. Note that this should be called only in the processRequest method of a controller associated with the listOfValues region. Advanced Search Usage Notes 316
Per the BLAF UI guidelines, the Simple Search always displays by default, even if the Advanced Search is enabled. This state is illustrated in Figure 1 above. If the user searches in one mode and toggles to the other, the underlying query criteria object is cleared to avoid inconsitency. You should not make any changes to the underlying query criteria object yourself as this might destabilize the LOV. The Advanced Search displays any listOfValues region items whose Search Allowed property is set to True.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code. Instantiate The following example code illustrates how to create a Text Field LOV programmatically. See the oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean Javadoc for additional information about these methods. public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAMessageLovInputBean lovInput = (OAMessageLovInputBean)createWebBean(pageContext, LOV_TEXT, null, "inputTest"); // Specify the path to the base page. lovInput.setAttributeValue(REGION_CODE, "/oracle/apps/dem/webui/Basic"); // Specify the application id of the base page. lovInput.setAttributeValue(REGION_APPLICATION_ID, new Integer(20001)); // Specify the LOV region definition.
lovInput.setLovRegion("/oracle/apps/fnd/framework/toolbox/tutorial/webui/Employee sLovRN", 0); // Validation should be enabled for LOVs unless it's essential for the field to allow // a partial value (in a "Search" region, for example). lovInput.setUnvalidated(false); // Configure the LOV mappings lovInput.addLovRelations(pageContext, "inputTest", // base page item "Empname", // lov item LOV_RESULT, // direction LOV_REQUIRED_NO); lovInput.addLovRelations(pageContext, "inputTest", // base page item "Empname", // lov item LOV_CRITERIA, // direction LOV_REQUIRED_NO); webBean.addIndexedChild(lovInput); } This example illustrates how to add an LOV relation programmatically to a declaratively defined LOV. See the 317
OAMessageLovInputBean Javadoc for additional information about these methods. public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAMessageLovInputBean msglov = (OAMessageLovInputBean)webBean.findChildRecursive("Employee"); msglov.addLovRelations(pageContext, "Employee", // base page item name "EmpName", // lov item name LOV_CRITERIA, // direction LOV_REQUIRED_YES); } Configure WHERE Clause Based on Passive Criteria If you have configured one or more criteria items as passive criteria, you must obtain the passive criteria values and manually apply them to the WHERE clause in a controller associated with the LOV region as illustrated in the Dependent Text Field LOV / Passive Criteria Example below. Switch LOV View Objects Based on Passive Criteria If you need to change the view object an LOV queries dynamically, create a controller and associate it with the LOV region. Then, create one or more passive criteria items that you can inspect in this controller's processRequest method to determine which view object to query. Remember to add the view object that you dynamically select to your LOV's application module. public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); Dictionary passiveCriteria = (Dictionary)pageContext.getLovCriteriaItems(); String lov = (String)passiveCriteria.get("SwitchLOV"); if ((lov != null) && !("".equals(lov))) { ((OAListOfValuesBean)webBean).setViewUsageName("<ViewInstanceName>"); } } Use the LOV as a Context Switcher Prior to release 11.5.10E, the LOV partial page rendering (PPR) behavior differed significantly from other beans that you might configure to enable PPR events. Specifically: The value(s) selected by the user was not immediately posted to the base page's underlying view object. Only the values of the result items were available to developers trying to catch the LOV PPR event. With release 11.5.10E, the LOV has been modified to behave in a consistent manner with other beans: The value(s) selected by the user are immediately posted to the base page's underlying view object. When the user tabs out of the LOV field, the OA Framework now submits the form. All the base page's form values are written to the underlying view objects as expected. When setting a value in a table row with an LOV, you can use the EVENT_SOURCE_ROW_REFERENCE to identify the row as described in the Dynamic User Interface documentation. Note: Whether this new functionality is exposed is controlled by the FND: Framework Compatibility Mode profile option. If this value is set to 11.5.9, the old behavior remains unchanged (see the 11.5.9 instructions below in this case). Otherwise, the new behavior is introduced as described here. If you want to make changes in your page based on an LOV selection, add the following code to a 318
processFormRequest method associated with the base page. Note that LOV automatically fires a predefined PPR client action. This is differs somewhat from any standard PPR client actions that you must explicitly enable for other items like a poplist). if (pageContext.isLovEvent()) { // Form was submitted because the user selected // a value from the LOV modal window, // or because the user tabbed out of the LOV input. // Find out which LOV input triggered the event. String lovInputSourceId = pageContext.getLovInputSourceId(); // At this point, all the data is available in the base VO, just as in // regular PPR events. Invoke an AM method to update the application // properties VO. // // if ("myLovInput".equals(lovInputSourceId)) // { // am.invokeMethod("handleMyLovInputEvent"); // } } The pageContext.isLovEvent method returns true if the event value is LOV_UPDATE (meaning the user selected a value from the LOV modal window), or LOV_VALIDATE (meaning the user tabbed out of the LOV input field on the base page). Note that it is no longer necessary to use the method pageContext.getLovResultsFromSession to retrieve selected values since the LOV results are now available in the base page view object with all the other form values. See the Dynamic User Interface documentation for a detailed explanation of how to handle PPR events in general (once you've identified the LOV event, the code procedure is the same for the LOV as it is for all other PPR-enabled beans). 11.5.9 Instructions for Using the LOV as a Context Switcher If you want to make changes in your page based on an LOV selection, and the FND: Framework Compatibility Mode profile option is set to 11.5.9, add the following code to a processFormRequest method associated with the base page (note that you cannot enable a standard PPR client action as you might for a poplist, for example). if (pageContext.isLovEvent()) { // Form was submitted because the user selected // a value from the LOV modal window, // or because the user tabbed out of the LOV input. // Find out which LOV input triggered the event. String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM); // Find out the result values of the LOV. Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId); if (lovResults != null) { // Update the page depending on the value chosen by the user. } } The pageContext.isLovEvent method returns true if the event value is LOV_UPDATE (meaning the user selected a value from the LOV modal window), or LOV_VALIDATE (meaning the user tabbed out of the LOV 319
input field on the base page). Note that you cannot check the LOV result fields when these events fire (the entire form is not submitted, so the underlying view object on the base page does not have the latest values). In this case, always use the pageContext.getLovResultsFromSession method as shown above. With the values that you obtain from the LOV, you can then update the page by populating the appropriate application module's application properties view object as you would when handling a regular partial page rendering event (see the Dynamic User Interface documentation for additional information about PPR).
Personalization Considerations
None
import java.util.Dictionary; ... /** */ public class SupplierSiteLOVCO extends OAControllerImpl { public static final String RCS_ID="$Header: SupplierSiteLOVCO.java 115.0 2003/02/24 06:49:33 nigoel noship $"; public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion(RCS_ID, "oracle.apps.fnd.framework.toolbox.lov.webui"); public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean);
// Get the list of items configured as "passive criteria" for the LOV. Dictionary passiveCriteriaItems = pageContext.getLovCriteriaItems(); String supplierName = (String) passiveCriteriaItems.get("SupplierName"); // Note: supplierName should not be null since it is defined as required // passive criteria. Raise exception if null. The OA Framework typically // handles this itself and generates a generic error message at the top of the // Supplier Site LOV page if there is no // supplier name... if (supplierName == null || ("".equals(supplierName))) { throw new OAException ("AK", "FWK_TBX_T_PO_SUP_BEFORE_SITE"); } // IMPORTANT: DO NOT EXECUTE THE VO QUERY! The LOV code will take care of this // based on your lov mappings. } }
Declarative Implementation
To add an LOV Choice List to your page: Step 1: Create a shared LOV region as described in the Text Field LOV section above. Note that the view object you create must have at least two columns that can be mapped to a poplist: a developer key and a 321
display value. For example, in an "Employees" view object, you might include an EMPLOYEE_ID (PK) column and an EMPLOYEE_NAME column to satisfy this requirement. For the LOV window that displays when the desired value isn't found in the poplist, you can include additional columns (DEPARTMENT_NAME, MANAGER_NAME and so on). Note: The value that you will designate as the developer key cannot exceed 30 characters in length. Step 2: In the JDeveloper Structure pane, select the region to which you want to add the LOV Choice List, right-click and select New > Item. Step 2.1 Specify a standards-compliant ID, and set the Style to messageLovChoice. Step 2.2 Apply the Attribute Set associated with the value you are displaying in the poplist. For example in the ToolBox Sample Library, the LOV Choice List created to display employees uses the attribute set /oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/FullName. Step 3: Set the messageLOVChoice's External LOV property to the shared LOV region you created in Step 1. Note that this must be set to a fully specified region name (for example, /oracle/apps/fnd/framework/toolbox/lov/webui/EmployeesLovRN). Step 4: Configure the poplist. Set the Picklist Display Attribute and the Picklist Value Attributes to the view object attribute names for the corresponding items in the LOV you selected in Step 3. For example, the ToolBox Tutorial Sample Library LOV Choice List mentioned in Step 2 above uses the /oracle/apps/fnd/framework/toolbox/lov/webui/EmployeeLovRN region as its LOV. This region's table binds to the EmployeeNamesVO1 instance as follows: LOV Region Item ID Item View Object Attribute EmpName EmployeeName EmpNum EmployeeNumber In this case, the Picklist Display Attribute value is EmployeeName, and the Picklist Value Attribute is EmployeeNumber. Step 5: Verify that the messageLovChoice's Data Type property value matches the data type of the view object attribute you specified for the Picklist Value Attribute. Step 6: If you want to allow end-users to personalize the LOV Choice List (add, remove, or reorder values in the list), set the List Personalization property to True. Setting this property to True displays a Personalize button next to LOV Choice List when it renders. Step 7: Select the LOV map that JDeveloper created for you and configure it as follows: Set the LOV Region Item property to the name of the LOV region item name whose value maps to the Picklist Value Attribute property you set in Step 4. In the ToolBox example described above, this is EmpNum. Set the Return Item property value to the name of the LOV Choice list item. Set the Required property to False (the OA Framework will ignore this value in the future). Leave the Use for Validation value as default (the OA Framework ignores this as it doesn't apply in this case). Note: Do not specify a Criteria Item when configuring your LOV Choice map to avoid the problem of choice list values that are no longer appropriate for the specified criteria value.
Personalization Considerations
Refer to the Personalizing a LOV Choice List in the Oracle Applications Framework Personalization Guide for additional information.
multiselect LOV. When the user selects this button, the multiselect LOV window displays (this is the same as a regular LOV window, however, the user can select multiple rows). When the user makes a selection, the rows are populated in the originating table.
Declarative Implementation
Note: The multiselect LOV can be enabled only for tables of type advancedTable (OAAdvancedTableBean). You cannot use this feature with simple tables (OATableBean). Step 1: Create your advanced table region as described in the "Advanced Tables" document. Step 2: Create a reusable list of values region as described in the Text Field LOV section above. Tip: Make sure your LOV's view object query includes all the values that you need to correctly populate the advanced table rows. For example, if your table requires values for items A, B, C, D and E, your LOV should include corresponding items for all of these, even if it only displays A. Warning: Do NOT base your LOV and advanced table on the same view object. Step 3: Select the advancedTable region in the JDeveloper structure pane, right-click and select New > tableActions. This automatically creates a flowLayout region under the tableActions node. Step 4: Select the flowLayout region, and specify a standards-compliant ID. Then, right-click and select New > lovActionButton to create the special LOV action button. Set the following properties for the LovAction: Specify a standards-compliant ID. Set the External LOV property to the fully qualified name of the reusable LOV you created in Step 2 above. Step 4: Specify an appropriate Prompt ("Add <Objects>") for the lovAction. At runtime, the OA Framework creates an oracle.apps.fnd.framework.webui.beans.nav.OALovActionButtonBean for this component. Step 5: Create LOV mappings between the multselect LOV, and the base table. Change the ID of the default mapping that JDeveloper created for you so it's easily identified. Also, set the Lov Region Item and Return Item (in the table) to identify the relationship between the LOV item value, and the destination item in the table that will be updated with this value when the user makes a selection. For additional mappings, select the lovActionMappings node in the JDeveloper structure pane, rightclick and select New > lovActionMap. Repeat the mapping configuration described above for each one. Step 6: Before the user can add rows to your table with the Multiselect LOV, you must initialize the associated view object as described in View Objects in Detail: Initialization Guidelines.
Runtime Implementation
Behind the scenes, selecting rows from the LOV behaves just as the Add Another Row button does. In other words, the OA Framework will create and insert rows into the view object associated with your advanced table. Note that, although your code may throw validation errors during this process (if, for example, underlying entity object validation logic fails), the OA Framework will ignore these errors so that incomplete rows can be presented to the user. Any subsequent form submit actions on the page that don't explicitly disable client and server-side validation will trigger full validation and error display. Caveat: If the attempt to insert a new row with the LOV values fails due to a primary key constraint violation, the OA Framework stops processing. In other words, if the user selects five rows from the LOV and an attempt to insert the first one fails, the OA Framework does not try to process the remaining four rows.
Personalization Considerations
None
Known Issues
If you have plugins in your browser, particularly Yahoo! Companion, this can interfere with the LOV 323
modal window.
Related Information
BLAF UI Guidelines LOV (List of Values) Template [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean oracle.apps.fnd.framework.webui.beans.message.OAMessageLovChoiceBean oracle.apps.fnd.framework.webui.beans.layout.OAListOfValuesBean oracle.apps.fnd.framework.webui.beans.nav.OAListOfValuesBean OA Framework Developer's Guide Implementing the View: Creating a Shared Region OA Framework View Coding Standards OA Framework File Standards Classic Tables Advanced Tables Dynamic User Interface (PPR) ToolBox Tutorial / Sample Library ToolBox Tutorial Search Lab oracle.apps.fnd.framework.toolbox.samplelib.webui.ListOfValuesPG OA Framework Component Reference (Oracle9i JDeveloper Online Help) OA Item Styles > messageLovInput OA Region Styles > listOfValues Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
324
Note: Prior to release 11.5.10, the final item in the breadcrumbs list was an unlinked entry for the current page as shown in Figure 2. Starting with release 11.5.10, the breadcrumbs list no longer displays the unlinked entry for the current page (see Figure 1 above), however, the OA Framework still appends this item to its internal, inmemory list so any preexisting code that references it will not break. Figure 2: Example of pre-release 11.5.10 breadcrumbs list with unlinked item for current page.
When the user navigates from a top-level page down through the hierarchy, the breadcrumbs reflect the page hierarchy in relation to the top-level page. This lets the user identify her location within the application, and affords a convenient navigation tool to intermediate pages in the hierarchy between the current page and the top-level page. While breadcrumbs do provide the user with a certain amount of history (where the user has been), they are somewhat poorly named since they are really intended to help the user locate themselves within the overall information architecture hierarchy (where they are vis--vis the top-level menus). That means they effectively "start over" when the user navigates from one top-level task to another. They do not drag on endlessly behind the user showing every place she has been. When breadcrumbs render, they always begin with the top-level identifier (a tab or global button as appropriate). If the top-level identifier is a global button, the first breadcrumb reflects that global button's label as follows: 325
Global Button (for example, Shopping Cart ) If the top-level identifier is a tab/horizontal navigation selection, the first breadcrumb appears as follows: Tab : Horizontal Navigation (for example, Order Status : Receiving) If the page is on a side navigation menu that is associated with a selected tab/horizontal navigation, the first breadcrumb appears as follows: Tab : Horizontal Navigation: Side Navigation Breadcrumbs never appear on a top-level page (a page that displays as a result of selecting a global button, a tab or a horizontal navigation or side navigation with no parent tab). They are only displayed when you navigate to another page from that top level page. When the user changes top-level identifier (for example, switches from Tab A to Tab B or selects a global button), the breadcrumbs reflect this change.
Implementation
You do not need to explicitly add a breadcrumbs region or item to your page. Assuming you follow the steps described below, the OA Framework automatically manages the breadcrumb history in memory and displays them on your page (behind the scenes, the OA Framework creates an oracle.apps.fnd.framework.webui.beans.nav.OABreadCrumbsBean and adds it to your pageLayout). Step 1: Set the Title property in your pageLayout region. This value is used for the breadcrumb text. See the Primary Header (Page Title) topic in the Headers and Subheaders document for additional information about setting the page title. Note: If you want the breadcrumb link text to differ from the page title text (for example, you want to display a shortened version of the page title text as the breadcrumb text), then you can programmatically override the breadcrumb text as described in the Runtime Control section below. Tip: If you reuse a page multiple times in a menu (each instance has a different page title) and you want to show multiple breadcrumb instances for that dynamic page in a single breadcrumb list (Page 1 > Page 2 > Page 3, where pages 1 - 3 actually correspond to the same pageLayout region), then do not set the title declaratively. In this case, you should set the page title in your pageLayout controller. public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAPageLayoutBean pageLayoutBean = (OAPageLayoutBean)webBean; pageLayoutBean.setTitle("<Page Title>"); // OAF // // // // The following prepareForRendering() call is required ONLY if you violate the coding standard against modifying a parent web bean from a child, and try to set the page title from a controller associated with a region BELOW the pageLayout region in the web bean hierarchy. See the OA Framework Controller Coding Standards.
// pageLayoutBean.prepareForRendering(pageContext); } Step 2: Set the addBreadCrumb URL parameter as you navigate between pages to tell the OA Framework to add the target page to the in-memory breadcrumb list that it maintains (you can set this in any of the forward/redirect methods, or explicitly set it as a URL parameter. For example, if you define an OAButtonBean to perform simple navigation to another page that should display breadcrumbs, you would set the Destination URI property to OA.jsp?page=/oracle/apps/dem/employee/EmpDetailsPG&addBreadCrumb=Y. Tip: If you set the Destination URI property declaratively without specifying the addBreadCrumb parameter, the OA Framework always interprets this as N. Alternatively, you could set this value when performing a JSP forward as shown below. public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { 326
super.processFormRequest(pageContext, webBean); ... pageContext.setForwardURL(< some page >, KEEP_MENU_CONTEXT, // Keep current menu conext null, pageParams,// additional URL parameters true, // Retain AM ADD_BREAD_CRUMB_NO, // Do not display breadcrumbs IGNORE_MESSAGES); } Tip: If you call the setForwardURL() or forwardImmediately() methods without specifying a value for the addBreadCrumb parameter, the OA Framework always interprets this as N. Valid values for this parameter include: URL Parameter Value addBreadCrumb=Y Corresponding OAWebBeanConstant ADD_BREAD_CRUMB_YES Behavior
Breadcrumbs will display. If the in memory breadcrumb list already contains a breadcrumb item with the same page title, the breadcrumb list will be rewound to the matching breadcrumb item. In other words, all the items after the matching item will be removed from the list, and the breadcrumb (page title) will not be added twice. The associated URL value of the current page's breadcrumb item will not be changed. If two pages have the same breadcrumb label (defaulted to page title except for the first breadcrumb that is based on the menu selection), but they are associated with different applications, they will be treated as different pages with different breadcrumbs. The in-memory breadcrumb list is cleared; addBreadCrumb=N ADD_BREAD_CRUMB_NO breadcrumbs are not displayed. The in-memory breadcrumb list is saved/preserved addBreadCrumb=S ADD_BREAD_CRUMB_SAVE as it is with no changes. Breadcrumbs are displayed. addBreadCrumb=RS ADD_BREAD_CRUMB_RESTART The in-memory breadcrumb list is cleared and then the target page URL is immediately added to the newly empty breadcrumb list . The breadcrumb list is restarted, and breadcrumbs are displayed. addBreadCrumb=RP ADD_BREAD_CRUMB_REPLACE Searches for the first breadcrumb item in the inmemory breadcrumb list that has the same breadcrumb label and application ID as the one you are trying to add to the list. If a matching item is found, the URL value of the breadcrumb item found is replaced with the target page URL value, and the breadcrumb list is rewound to the matching breadcrumb item. In other words,all the items after the matching item are removed from the list Otherwise (if a matching item is not found), a new breadcrumb item is added to the existing breadcrumb list. This is the same behavior as 327
addBreadCrumb=Y. Usage Example #1 Note: In each of the following use case examples, assume the "addBreadCrumb Value" is set when navigating to the target page. Navigate From Page Navigate To Page addBreadCrumb Value User selects Tab 1 to navigate to Page 1. Page 1 Page 2 Y Page 2 Page 3 Y Page 3 Page 4 N When Page 1 renders, no breadcrumbs are displayed (breadcrumbs do not render on top-level menu pages). When Page 2 renders, the breadcrumbs display as: Tab 1 > When Page 3 renders, the breadcrumbs display as: Tab 1 > Page 2 > When Page 4 renders, no breadcrumbs display (the in-memory list is cleared). Usage Example #2 Navigate From Page Navigate To Page addBreadCrumb Value User selects Tab 1 to navigate to Page 1. Page 1 Page 2 Y Page 2 Page 3 Y Page 3 Page 3 S Page 3 Page 4 Y After completing each of the navigations in this example, the breadcrumbs display as: Tab 1 > Page 2 > Page 3 > Note that Page 3 is not repeated in the breadcrumb list. Usage Example #3 Note: In this example, we're assuming the developer performs a JSP forward from Page 3 -> Page 3 to programmatically display someRegion2 instead of someRegion1. Navigate From Page Navigate To Page addBreadCrumb Value User selects Tab 1 to navigate to Page 1. Page 1 Page 2 Y Page 2 Page 3 Y Page 3 Page 3 Y (dynamically display "someRegion1") Page 3 Page 3 RP (dynamically display "someRegion2") Page 3 Page 4 Y Tab 1 > Page 2 > Page 3 > (Note that Page 3's URL should have a URL parameter to indicate that someRegion2 should display) Usage Example #4 328
Navigate From Page Navigate To Page addBreadCrumb Value User selects Tab 1 to navigate to Page 1. Page 1 Page 2 Y Page 2 Page 3 Y Page 3 Page 4 RS Page 4 Page 5 Y Page 5 Page 6 Y When Page 6 renders: Assuming "Tab 1" is selected when Page 4 renders, the breadcrumbs would display as: Tab 1 > Page 4 > Page 5 > The in-memory list of breadcrumbs restarts with the navigation to Page 4. Note that the OA Framework automatically adds the breadcrumb for the menu entry "Tab 1" to reflect the current page hierarchy. If no menu was selected when Page 4 renders (perhaps Page 4 has no associated menu), the breadcrumbs would display as: Page 4 > Page 5 > Miscellaneous Rules To navigate from a drilldown page to the top-level page that corresponds to the menu breadcrumb, use addBreadCrumb=N (or, do not specify any addBreadCrumb URL parameter). This will clear the breadcrumbs when the top-level page is rendered. Navigating back to the top-level page with addBreadCrumb=Y should be avoided. In this case, the OA Framework tries to add a breadcrumb based on the top-level page's page title, however, if the page title differs from the menu breadcrumb's label (which is based on the selected menu items' labels), the OA Framework will add a new breadcrumb based on the page title instead of rewinding and clearing the breadcrumb list (the desirable behavior). If you drill down from Page 1 (the first page rendered with a menu selection) to Page 2, and if the first page does not have a menu item highlighted, but if you do want to include Page 1 in the breadcrumb list, then specify addBreadCrumb=Y for Page 1 as well. Then the OA Framework will show the breadcrumb for Page 1 with its Page Title as the breadcrumb label.
Runtime Control
To programmatically change breadcrumb properties, do so in the target page's controller.
bean will break. If you set the page title to an empty string in your controller, this will have no effect on the breadcrumbs (in other words, the breadcrumb list will not be modified since breadcrumb cannot contain an empty label).
Within the same application, breadcrumbs do not repeat in the displayed breadcrumb list. A page without a page title or an empty page title string will not be added to the breadcrumb list. Trains and breadcrumbs cannot be used together (see the BLAF UI Guidelines for instructions on when to use a train, and when to use breadcrumbs). If you try to enable breadcrumbs on page with a train by setting the addBreadCrumb URL parameter to Y, the OA Framework simply ignores this instruction and does not modify the in-memory breadcrumb list. The train takes precedence. A breadcrumb list is associated with a given transaction id. Whenever you return to the E-Business Home page and revisit a page or relogin and revisit a page, a new transactionid is assigned. In this case, a new breadcrumb list is started. Thus, you do not need to specify addBreadCrumb=RS on the portal menu option function JSP URL to restart the list. According to the Oracle UI team, the "Return to" link does not have a direct correlation with breadcrumbs. It should direct the user to some logical point in the page flow rather than the last URL, and should usually be defined at design time.
Personalization Considerations
See a summary of Locator Element: Breadcrumbs personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
When the user navigates by selecting a breadcrumb link, the page state may be lost Bug 2431147). The reason is that the root application module retention behavior is determined by the retainAM URL parameter value of the breadcrumb URL in this case. Note: Do not simply change all the breadcrumb URL values to have retainAM=Y to work around the problem. This could cause serious scalability issues by tying up application module resources and increasing the memory load. If this is a serious problem for your, please consider using the oracle.apps.fnd.framework.webui.OAReleaseListener to ensure that individual application modules are retained or released as needed. As tracked in Bug 1728163, breadcrumbs exhibit the following problem with the browser Back button use: User navigates from Page 1 (Tab 1 is highlighted) to Page 2, and then to Page 3. The breadcrumbs show "Tab 1 > Page 2". The user then presses the browser Back button to return to Page 2 and selects a link that takes her to Page 4. An HTTP GET request is issued to Page 4. The desired breadcrumb list at this point is is "Tab 1 > Page 2 ", but the displayed breadcrumb list is "Tab 1 > Page 2 > Page 3" because the web server is not aware of the client-side navigation event. The current OA Framework breadcrumb implementation and the latest breadcrumbs UI standards have some discrepancies. The new UI standards are moving in the direction of a predefined, fixed page hierarchy for the breadcrumbs. The OA Framework breadcrumb implementation tends to model the dynamic navigation path. The menu breadcrumbs behave somewhat differently from the UI standards as well. Bug 1759706 will try to resolve these discrepancies.
Related Information
BLAF UI Guidelines Locator Element (Breadcrumbs) [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.nav.OABreadCrumbsBean oracle.cabo.ui.beans.nav.BreadCrumbsBean oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
331
Page Navigation
When used for page navigation, the OANavigationBarBean renders a Back and Next button with locator information ("Step X of Y") between them. You can also configure this control to display a poplist instead of static locator information so users can quickly navigate to a specific page in the sequence. Figure 1: Example of page navigation buttons in multistep transaction.
Repeat steps 5.1 and 5.2 for each page in the page flow.
OANavigationBarBean navBean = (OANavigationBarBean)webBean.findChildRecursive("NavBar"); // Determine which page we're on so we can set the selected // value. Each time we navigate to and within the flow, the // URL includes a parameter telling us what page we're on. 333
int step = Integer.parseInt(pageContext.getParameter("empStep")); navBean.setValue(step); // Figure out whether the "Submit" button should be rendered // or not; this should appear only on the final page (Step 3). OASubmitButtonBean submitButton = (OASubmitButtonBean)webBean.findIndexedChildRecursive("Submit"); if (submitButton == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "Submit") }; throw new OAException("ICX", "FWK_TBX_OBJECT_NOT_FOUND", tokens); } if (step != 3) { submitButton.setRendered(false); } } // end processRequest() Handle Navigation Events Note: The following simple example shows how to navigate between the pages with static code. See Declarative Pageflow Using Workflow for instructions on implementing page navigation using Oracle Workflow. Add the following processFormRequest() method to your EmployeeUpdateFooterCO. This ascertains which OANavigationBarBean button was selected so the correct destination page can be rendered. It also displays a Confirmation message when the user selects the Submit button. import com.sun.java.util.collections.HashMap;
import oracle.apps.fnd.common.MessageToken; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.OAException; import oracle.apps.fnd.framework.webui.OADialogPage; ... public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean);
if (pageContext.getParameter("Submit") != null) { // Assuming the "commit" succeeds, we'll display a Confirmation // dialog that takes the user back to the main Employee search. MessageToken[] tokens = { new MessageToken("EMP_NAME", employeeName) }; OAException confirmMessage = new OAException("ICX", 334
"FWK_TBX_T_EMP_UPDATE_CONFIRM", tokens); OADialogPage dialogPage = new OADialogPage(OAException. CONFIRMATION, confirmMessage, null, APPLICATION_JSP + "?OAFunc=FWK_TBX_LABS_EMPLOYEES2", null); // Note that we release the root "UI" application module // so we can correctly handle any subsequent "Back" button // navigation and attempts to resubmit the PO transaction. pageContext.releaseRootApplicationModule(); pageContext.redirectToDialogPage(dialogPage); } else && { // // // // // //
if ("goto".equals(pageContext.getParameter("event")) "NavBar".equals(pageContext.getParameter("source"))) We use the parameter "value" to tell use the number of the page the user wants to visit. Also note the check of "source" above to ensure we're dealing with the page-level navigation here and not table-level navigation which is implemented with the same Bean configured differently.
int target = Integer.parseInt(pageContext.getParameter("value")); String targetPageFunction; switch(target) { case 1: targetPage case 2: targetPage case 3: targetPage default: throw new }
HashMap pageParams = new HashMap(2); pageParams.put("empStep", new Integer(target)); pageContext.setForwardURL("OA.jsp?page=" + targetPage, null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, pageParams, true, // Retain AM OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrumbs OAWebBeanConstants.IGNORE_MESSAGES); } } // end processFormRequest() 335
To create an interactive navigation bar, follow the declarative instructions above for the "basic" navigation bar. Then, select the navigationBar region in the JDeveloper Structure pane, right-click and select New > Item. Assign the item a standards-compliant ID, set its Style to link, set the Text to the value you want to display in the poplist and set the Destination URI to the fully-qualified name of the target page in the flow (for example, /oracle/apps/dem/employee/webui/ EmpAssignPG). Repeat as needed for each page. Warning: Make absolutely certain that the navigation bar links match the train step links if you are using these components in tandem. Also make sure that the displayed text matches.
// Figure out whether the "Submit" button should be rendered or not; // this should appear only on the final page (Step 3). // // // // The OATrainBean is a named component of the page layout, so we have a special way of getting a handle to it (we can't "find" it like we do for normal, indexed children that would be below the current region in the hierarchy).
OATrainBean trainBean = (OATrainBean)pageContext.getPageLayoutBean().getLocation(); // You must call the following before getting the target page index. trainBean.prepareForRendering(pageContext); int step = trainBean.getSelectedTrainStepRenderedIndex(); if (step + 1 != trainBean.getNumberOfRenderedTrainSteps()) { OASubmitButtonBean submitButton = (OASubmitButtonBean)webBean.findIndexedChildRecursive("Submit"); submitButton.setRendered(false); 336
}} // end processRequest()
Record Navigation
Under the covers, the same OANavigationBarBean that you use for page navigation is also used for record navigation in tables. Assuming you implement a table or advancedTable region, the OA Framework configures this for you automatically. There is no need for you to create or interact with this component.
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines Locator Element: Page / Record Navigation [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.nav.OANavigationBarBean OA Framework ToolBox Tutorial / Sample Library Update Lab Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
337
Per the UI Guidelines, all trains are implemented in conjunction with a page navigation component as illustrated in Figure 2 (there is one exception: if you leave the main page flow to perform a subordinate task you should display a disabled train coupled with simple Apply and Cancel buttons on the drilldown page). When present, the navigation bar component is synchronized with the train to ensure that both regions reflect the user's current location within the flow. Figure 2: Example of a train and a page navigation component together on a page.
Basic Train
This section describes the steps for implementing a basic train. See the Interactive Train section below for supplemental instructions on how to make the basic train interactive (so the user can navigate by selecting train nodes). See the Train Within Train instructions for representing a "subtask" within a linear train flow.
Declarative Implementation
Note: When you implement a train, you must also implement a page navigation component -- unless you are dealing with the drilldown exception described above. This document deals exclusively with the train; see Locator Element: Page/Record Navigation for corresponding implementation instructions. Step 1: Create a shared train region for inclusion in all the pages comprising your multistep flow. Assign a standards-compliant ID, and set the Style to train. Step 2: Add nodes to the train region for each page that you want to display. Step 2.1 Select the train region in the Structure pane, right-click and select New > Link. Step 2.2 Assign a standards-compliant ID to the link, enter the Text that you want to display below the train node (for example, "Assignments"), and set the Destination URI to the fully qualified page name that renders when this node is active (for example, /oracle/apps/dem/employee/webui/ 338
EmpAssignPG). Repeat steps 2.1 and 2.2 for each node in the train. Step 3: Add the shared train region to each page in the flow. Step 3.1 Select the pageLayout region in the Structure pane, right-click and select New > Location. Step 3.2 Assign a standards-compliant ID to the train node and set the Extends property to the fully qualified name of the shared train region (for example, /oracle/apps/dem/employee/webui/EmpTrainRN). Repeat steps 3.1 and 3.2 for each node in the train.
Runtime Control
If you want to get access to your train for any reason, use the following code in processRequest(): OATrainBean train = (OATrainBean)pageContext.getPageLayoutBean().getLocation();
Interactive Train
Interactive trains let users let users quickly navigate to any previous step, and one step forward, by selecting a train node (the nodes are implemented as links) as shown in Figure 3. Figure 3 : Illustration of an interactive train.
Interactive trains should always be implemented in conjunction with the interactive page navigation element as shown in Figure 4. Figure 4: Example of an interactive page navigation control.
synchronizes the train with the new target page. To achieve this, the train steps' Destination URI property (as specified in the Basic Train implementation Step 2.2 above) must match the OANavigationBarBean link steps.
To configure a train as a subtrain, simply set its Sub Train property to true. Otherwise, you define and implement this train and the associated page navigation just as you would for any other standalone train flow. See the oracle.apps.fnd.framework.webui.beans.nav.OATrainBean Javadoc for information about identifying a subtrain programmatically.
Personalization Considerations
None
Known Issues
The interactive train does not work with page flows that are implemented with Oracle Workflow.
Related Information
BLAF UI Guideline(s) Locator Element: Train [ OTN Version ] Locator Element: Page/Record Navigation [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.nav.OATrainBean oracle.apps.fnd.framework.webui.beans.nav.OANavigationBarBean ToolBox Tutorial Application See the Multistep (Create) module for an example implementation of the "basic" train with Oracle Workflow. See the Update lab. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
340
Message Box
Overview
Per the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Message Box, you can display the following standard kinds of messages at the top of a page: Error Warning Confirmation Information Each message renders with a dark beige background to make it more visible, and a standard icon. For example, Figure 1 shows a confirmation message box: Figure 1: example of a confirmation message box displayed at the top of a page
Note if you want to display these messages in a separate page, see the Dialog Page documentation.
Declarative Implementation
Since messages are displayed in the context of runtime events and circumstances, there is no corresponding declarative implementation. If you want to display messages that include HTML tags, see the Custom HTML document.
Runtime Control
As described in the Error Handling document, if you throw an OAException (or any of its subclasses), the OA Framework automatically displays an error message at the top of the current page. If you throw row or attribute-level exceptions in your business logic, the error message box includes links to the rows and/or fields which are in error, and displays error icons for these components as shown in Figures 2 and 3 below. Figure 2: example of an error message box displaying attribute-level validation exceptions thrown in the underlying entity object.
341
You can also explicitly display a message box of any type using the following code in your controller (this particular example displays a confirmation message after a successful commit). processFormRequest(OAPageContext pageContext, OAWebBean webBean) { // Get the purchase order number from the request. String orderNumber = pageContext.getParameter("headerId"); MessageToken[] tokens = { new MessageToken("PO_NUMBER", orderNumber)}; OAException message = new OAException("ICX", "FWK_TBX_T_PO_UPDATE_CONFIRM", tokens, OAException.CONFIRMATION, null); pageContext.putDialogMessage(message); } Note that you construct an oracle.apps.fnd.framework.OAException object and set the kind of message you want (other options are OAException.WARNING, OAException.INFORMATION and OAException.ERROR). Then you simply identify this exception for display when the page renders by calling the OAPageContext.putDialogMessage() method. At runtime, the OA Framework constructs and oracle.apps.fnd.framework.webui.beans.message.OAMessageBoxBean and adds it to the web bean hierarchy. Exceptions and Navigation If -- after you call putDialogMessage() in your processFormRequest() method -- you want to forward to the current page or another page and display the message at the top of the new target page, you need to call the appropriate oracle.apps.fnd.framework.webui.OAPageContext forwardImmediately*() method. The OA Framework immediately stops processing the page and issues a forward before displaying the messages. Note: The two pages should share the same root application module, and you should retain this AM while forwarding. If you plan to call the OAPageContext.setForwardURL() or setForwardURLToCurrentPage() methods before throwing an exception, you need to decide whether you want to ignore the messages and proceed with the forward action, or stop and show the messages in the current page. Then, set the messageLevel setForward*() method parameter as described in the OAPageContext Javadoc. 342
Multiple Message Type Handling When you register or throw multiple exceptions, the OA Framework combines them into a single message box using the following rules: Since an error is more important than a warning, the message box is titled "Error" if both errors and warnings exist. Confirmations and errors cannot be shown together. In this case, the OA Framework simply ignores the confirmation message(s). You can, however, show confirmations with warnings. The message box is titled "Confirmation," and it contains both types of messages.
Related Information
BLAF UI Guideline: Message Box Javadoc oracle.apps.fnd.framework.OAException oracle.apps.fnd.framework.webui.beans.message.OAMessageBoxBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
343
Implementation
To add a shared Workflow Worklist region to your page: Step 1: Select the region to which you want to add the Worklist, right-click and select New > Region. Give the region a standards-compliant ID. Step 2 (optional): If you want to include a header above the Worklist region as shown in Figure 1 above, set the Region Style to header and set the Text property to the value you want to display as the header text. Select the header region, right-click and select New > Region. Give this region a standards-compliant ID (the "Workflow Worklist" text in Figure 2 is set in the Page Title property in the pageLayout region). Tip: If you need to reduce the size of the header text from its default rendering size, add the following processRequest() call to setSize() in a controller associated with the header region: public void processRequest(OAPageContext pageContext, OAWebBean webBean) 344
{ super.processRequest(pageContext, webBean); ((OAHeaderBean)webBean).setSize(1); } Step 3: Select the region that will extend the shared Notifications Worklist region and set its Extends property to /oracle/apps/fnd/wf/worklist/webui/AdvancWorklistRG (if JDeveloper displays a warning message regarding scope restrictions, simply acknowledge it and proceed). Note that the Region Style is automatically set based on the region that you are extending. Step 4 (optional): If you are adding the Worklist region to a page where you want it to display in summary form as shown in Figure 1, you must add a WFHomeWorklist parameter to the request with a value of Y. For example, you could add a controller to your Worklist region (or to a ancester region) with the following processRequest() logic: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); pageContext.putParameter("WFHomeWorklist","Y"); } In this case, Oracle Workflow automatically handles the selection of the Full List button for you by rendering the standard AdvancedWorklist page with your menu/footer. If you opt to display the Worklist region in its summarized form, and you want to drilldown to a custom Worklist page when the user selects the Full List button, then you must add the following logic to a controller associated with your Worklist region or an ancestor region: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean);
// You must set a session value WFFullListPage to the fully qualified // name of your custom full Worklist page. pageContext.putSessionValue("WFFullListPage", "/oracle/apps/fnd/framework/toolbox/tutorial/webui/ToolboxWorklistPG"); } Prior to release 11.5.10, you must also add the following logic to ensure that Oracle Workflow correctly renders a "Return to" link with an appropriate destination in any Worklist pages displayed while the user is navigating in that module. For release 11.5.10+, Oracle Workflow automatically configures the the "Return to" link to point to the page where the Worklist is embedded. If you need to override this behavior for any reason, you can also leverage the following example code. public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean);
// You must set a session value WFWorklistPage to the fully qualified // name of the page that includes the shared Worklist. pageContext.putSessionValue("WFWorklistPage", "/oracle/apps/fnd/framework/toolbox/tutorial/webui/HomePG"); }
Personalization Considerations
See a summary of Worklist personalization considerations in the Oracle Applications Framework Personalization Guide. 345
Known Issues
None
Related Information
BLAF UI Guidelines Notification Page Templates [ OTN Version ] OA Framework Developer's Guide OA Framework File Standards (Naming, Package Structure and Standard Content) Worklist Personalization Considerations OA Framework ToolBox Tutorial / Sample Library See the Home Page lab. oracle.apps.fnd.framework.toolbox.samplelib.webui.WorklistPG Oracle Workflow Documentation Oracle Workflow Developer's Guide Oracle Workflow Administrator's Guide Oracle Workflow User's Guide Oracle Workflow API Reference Copyright 2000 - 2004 Oracle Corporation. All rights reserved.
346
Deployment
Page Access Tracking is shipped with JTT.E and OA Framework 11.5.10 to track CRM Applications and OA Framework Applications. The Configuration and Reports UI is currently shipped in JTT.E as part of the CRM HTML Admin Console. If JTT.E is installed in the environment, a system administrator can navigate to the UI from the CRM HTML Admin Console. Refer to Metalink Note 278881.1 for details on navigating to the Configuration and Reports UI. If JTT.E is not installed in the environment, the Configuration and Reports UI will not be available. Page Access Tracking can still be configured to track OA Framework Applications by setting the profiles described below. Please see Metalink Note 278881.1 regarding Sign-on Audit Configuration.
Profile Options
There are five Profile Options used to configure Page Access Tracking. If JTT.E is installed in the system, configuring these five profiles can be done via the Configuration UI as described above. You should also refer to the Metalink Note 278881.1 for further details on how to configure Page Access Tracking. If JTT.E is not installed, these profiles can be set via the Oracle E-Business Suite System Profile Options form: JTF_PF_MASTER_ENABLED Site level Profile Master on/off switch for Page Access Tracking. Possible values: true/false JTF_PF_ENABLED Site/Application/Responsibility/User level Profile Determines if Site/Application/Responsibility/User has Page Access Tracking turned on/off. Possible values: true/false JTF_PF_LEVEL Site/Application/Responsibility/User level Profile As a bitmask this profile determines what information to log when Page Access Tracking is on for a particular access. Possible values: 347
Value Information Logged 22 Session Information (Client Browser, Language, and HTTP Header) 118 Session Information and Cookies 254 Session Information, Cookies, and URL Parameters 126 Session Information, Cookies, and all Parameters JTF_PF_FLUSH_INTERVAL Site level Profile Determines how often Page Access data is flushed to the database (sec). Default value of 120 sec is used if Profile not set. JTF_PF_BUFFER_SIZE Site level Profile Determines how often Page Access data is flushed to the database (number of page accesses). Default value of 20 page accesses is used if Profile not set.
Personalization Considerations
None
Known Issues
None
Related Information
Metalink Note 278881.1 Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
348
Declarative Implementation
All OA Framework pages automatically include the "ski." See the Footer documentation for information on the standard links that render beneath the "ski" See the Buttons (Links) documentation for information on adding a "Return to..." link beneath the "ski" See the Buttons (Action/Navigation) documentation for information on adding action/navigation buttons beneath the "ski" Note: For those of you who have experience with earlier versions of the OA Framework, we no longer create what used to be called a "Content Footer" to hold buttons and a "Return to..." link beneath the ski. Instead, you add these components using new procedures described in the reference documents above (the contentFooter pageLayout component exists in JDeveloper only to support old pages; do not use it for new development). See the Page Stamps documentation for information on adding a secondary page stamp immediately above the "ski"
Runtime Control
There is no reason to manipulate this component programmatically (and, there are no methods for doing so).
Personalization Considerations
See a summary of Page Contents Bottom Line personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guidelines Page Contents Bottom Line (the "Ski") [ OTN Version ] Developer's Guide Page Footer Buttons (Links) Buttons (Action/Navigation) Page Stamps Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
349
Page Footer
Overview
Per the BLAF UI Guideline: Page Footer [ OTN Version ] specification, the page footer marks the end of a page's contents. A footer includes the following components: A link for each of the top-level application tabs and global buttons Oracle copyright information (Optional) A privacy statement link (Optional) An "About" link to information about the current application/page Tip: For information on adding action/navigation buttons and a "Return to..." link above the footer, see Buttons (Action/Navigation) and Buttons (Link) respectively. The footer content is truly the last content that a page includes, and as such, it renders below the page contents bottom line and any associated action/navigation buttons or the "Return to..." link. A footer example including all optional components is shown below: Figure 1: Example of a Page Footer Including All Optional Components
Declarative Implementation
The links that duplicate your top-level tabs and global buttons render automatically in all OA Framework pages.
"About" Page
Each OA Framework page automatically includes an "About" link in the footer if the Diagnostics or Administrator Personalization features are enabled. See Discovering Page, Technology Stack and Session Information.
Runtime Control
350
Although you should never manipulate footer elements programmatically as this precludes personalization, there are methods in the oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean to get and set the text for the privacy statement and copyright links. You can also set the privacy statement target. Note: The footer components are added to your page as special named children, not indexed children. That means you can't get a handle to them using findIndexedChildRecursive in the oracle.apps.fnd.framework.webui.OAPageContext class as you would for the regions and items that comprise the main page content. Use findChildRecursive() instead.
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines Page Footer [ OTN Version ] Developer's Guide: Page Contents Bottom Line Buttons (Action/Navigation) Buttons (Links) Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean oracle.apps.fnd.framework.webui.OAPageContext ToolBox Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
351
Contents
Region Style: header Region Style: messageComponentLayout Region Style: stackLayout Region Style: flowLayout Region Styles: tableLayout / rowLayout / cellFormat Region Styles: defaultSingleColumn / defaultDoubleColumn Common Layouts and Suggested Solutions Page Start and Page End Search and Results Page Single Column Display-Only Details Page Single Column Update Page Master-Detail Page w/ Adjacent Headers Home Page Multiple Items with a Single Prompt Image and Text in a Table Column
So, since headers don't automatically indent their content, if you want to add fields and the like to a header, you will typically add an intermediate region to the header to achieve the appropriate indentation. The messageComponentLayout region, discussed next, is the recommended solution for this. Figure 2 shows the change in component placement when we add a messageComponentLayout region to the header, and then 352
add the items to the messageComponentLayout. Figure 2: Example of a header region with a messageComponentLayout added to it to hold the items.
If you want to display regions or items that should not be indented (like instruction text and a table), you can add them directly to your header region. See Headers and Subheaders for additional information about this component.
Tip: For those of you who are familiar with the spacing in the OADefaultSingleColumnBean and OADefaultDoubleColumnBean regions, the messageComponentLayout yields a very different result (fields are far more indented). The messageComponentLayout spacing is correct per the current UI guidelines. Figure 4: Double column messageComponentLayout.
With this component, you can control the number of rows (items) that you want to display in a column, and you can control the number of columns that you want to display (you can define as many columns as you need -although there is a practical UI usability limit!). Typically, you should display no more than 3 columns. 353
Declarative Implementation
Step 1: (optional) If you want to use the messageComponentLayout to position content immediately beneath a header as shown in Figure 5 below, first add a header region to your page (the messageComponentLayout is not capable of rendering the header text and line). Set the header region's Text property as needed. Figure 5: Single column messageComponentLayout used in a manually created search region with a header and instruction text.
Step 2: (optional) If you want instruction text to render above the fields in the messageComponentLayout as shown in Figure 3, add the corresponding item to the containing region (if you add the instruction text to the messageComponentLayout, it will render indented and aligned with the fields). So, for example, if you have a header region above the messageComponentLayout, you would create the following structure: header | -- staticStyledText | -- messageComponentLayout Step 3: Add a new region to your page, set its Style to messageComponentLayout and assign it a standardscompliant ID. Step 4: Select the messageComponentLayout region, right-click and select New in the context menu. JDeveloper displays all the message* beans for quick selection. The list also includes a messageLayout region. If you want to add any non-message* beans to your messageComponentLayout (a submitButton or a region, for example), you must first add the messageLayout region. Then, select the messageLayout region and add your item. For example, the page structure required to achieve the layout shown in Figure 1 is: header | -- staticStyledText | -- messageComponentLayout | -- messageLovInput | -- messageChoice | -- messageCheckBox | -- messageLayout | -- submitButton Tip: All of the items that you add to the messageComponentLayout region are added as indexed children. By default, the messageComponentLayout renders its items in a single column. Step 5: (optional) If you need a multicolumn layout, you should configure the Columns and Rows properties according to the following rendering rules. The Columns property controls the maximum number of columns you want to render. The Rows property controls how many items should render in any given column before populating the next column, however, this property is ultimately governed by the Columns property. If, for example, you set the Rows property to 2 and the Columns property to 2, but you add 6 fields to the messageComponentLayout region, your layout will appear as two columns with the first containing objects 1 - 3 while the second contains objects 4 - 6. Figure 6: messageComponentLayout with Rows = 2, Columns = 2 and 6 fields.
354
If, on the other hand, you set the Columns property to 3 and the Rows property to 2 for the same 6 fields, the resulting layout will render as three columns with the first column containing objects 1 and 2, the second column containing objects 3 and 4, and the third column containing objects 5 and 6, like this: Figure 7: messageComponentLayout with Rows = 2, Columns = 3 and 6 fields.
Note that you must set both the Columns and Rows properties to achieve the multicolumn layout (if you set only the Columns property, your items will render in a single column regardless of what value you specify). Tip: If you set the Rendered property of an indexed child to False (see the Dynamic User Interface documentation for information about controlling item rendering at runtime), the remaining items collapse vertically to absorb the missing component. For example, if you hide the Field 4 item in the layout shown above, the result will render as: Figure 8: messageComponentLayout with Rows = 2, Columns = 3 and 6 fields with Field 4's Rendered property set to False.
Step 6: (optional) If you need to tweak the default layout, you may set the Width, Prompt Width and Field Width properties as needed to achieve the desired result (in this case, since the default spacing complies with the UI guidelines, you should confer with the UI team to verify that your overrides are desirable and correct). Note that these values may be set as absolute pixels (100) or as a percentage (100%). The Width property controls the amount of available space used by the entire region. The Prompt Width property controls the preferred width of the prompts. If specified as a percentage, the Prompt Width plus the Field Width should add up to 100%, regardless of the number of columns. If the Prompt Width is specified as a percentage, the OA Framework derives the Field Width if it is not specified. The Field Width property controls the preferred width of the fields. If specified as a percentage the Prompt Width plus the Field Width should add up to 100%, regardless of the number of columns. If the Field Width is specified as a percentage, the OA Framework derives the Prompt Width if not specified. Note: If prompt or field lengths exceed the "preferred" amount of space requested by these properties, the preferences will be ignored and the layout adjusted so the values render properly. For example, in Figure 9, the Prompt Width property is set to 15%, however, the very long prompt exceeds this space allocation so the layout is adjusted to accommodate it. Figure 9: Example of a very long prompt exceeding a Prompt Width value of 15%.
355
Step 7: (Required only if you are using the messageComponentLayout in a search region) The BLAF UI guidelines stipulate special spacing parameters for components in search regions. Although you could override the individual Width, Prompt Width and Field Width properties to satisfy this requirement, you should not do this in case the standards change in the future. Instead, set the Search Region property to True (note that you can also call the setSearchRegion(true) method on your OAMessageComponentLayoutBean). The OA Framework will automatically adjust the default spacing to correctly position your fields.
Runtime Control
There is no common reason to interact with a messageComponentLayout programmatically, except to call the setSearchRegion(true) method as described in Step 7 above.
Personalization Considerations
None
Known Issues
Per the UI team, tabbing order is more important than row/column span capabilities in a messageComponentLayout region. So, as described in bug 2061506, the messageComponentLayout does not support row/column spanning. There is an open enhancement (311783) to let the messageComponentLayout act as a header. If your regions includes buttons below all the fields, and it is personalizable, there is currently no way to ensure that the buttons continue to render last (in the first column of the last row). If you are in this situation, you must use a defaultSingleColumn region even though it is deprecated.
Since most items need to be indented, you'll typically use a stackLayout only for cases where you want to explicitly position regions and/or items vertically without the indentation. For example, in the Home page 356
example shown in Figure 17 below, we used a stackLayout to position the two content containers on the right side of the page. Note: Do not use the deprecated oracle.apps.fnd.framework.webui.beans.layout.OADefaultStackLayoutBean (defaultStack region style) or the oracle.apps.fnd.framework.webui.beans.layout.OADefaultFormStackLayoutBean (defaultFormStack region style).
Declarative Implementation
Create a new region, assign it a standards-compliant ID, set its Region Style to stackLayout and add your items. That's it!
Personalization Considerations
None
Known Issues
None
Note: Certain components "wrap" when added to a flowLayout: instead of rendering horizontally, they render vertically. For example, all the message* items exhibit this behavior because they are contained in a tableLayout region (and a tableLayout region by itself would do the same thing). See Image and Text in a Table Column for a good use case for a flowLayout.
Declarative Implementation
Create a new region, assign it a standards-compliant ID, set its Region Style to flowLayout and add your items. That's it!
Personalization Considerations
None
Known Issues
None
beneath the Terms and Conditions header: Figure 12: Example of a tableLayout implementation.
To conceptualize this in an HTML editor, we'll start by creating a simple 2 row, 2 column table in Dreamweaver. The result is shown in Figure 13. Figure 13: 2 row, 2 column table in Dreamweaver after initially creating it.
Now, we'll add some content roughly where we want it to render, but we won't set any formatting properties. Figure 14 shows a result that is close to our layout, but the formatting is off: the Shipping Terms doesn't render next to the Supplier content even though we have room, and all the headers are "floating" in their respective cells. Figure 14: 2 row, 2 column table in Dreamweaver after adding content to three of the four cells.
358
The first thing we want to fix is the location of the Shipping Terms header. To force this to render beside the Supplier header, we need to merge the Supplier cell with the empty cell below it by creating a "row span." After making this change, our table appears as shown in Figure 15. Figure 15 : 2 row, 2 column table in Dreamweaver after adding adding a row span format to Supplier cell.
Next, we need to fix the table cell content alignment by setting their vertical alignment properties to "Top." As you can see in Figure 16, we've arrived at a layout that mirrors what we want to achieve in our UI. Figure 16 : 2 row, 2 column table in Dreamweaver after adding adding a rowspan format to Supplier cell and setting the vertical alignment of all the cells to the Top.
The corresponding HTML looks like this (to highlight the table structure, cell content has been replaced by ellipses): <table> <tr valign="top"> <td rowspan="2"> ... <!-- Supplier cell --> </td> <td valign="top"> ... <!-- Payment terms cell --> </td> </tr> <tr> <td valign="top"> ... <!-- Shipping terms cell --> </td> </tr> </table> So, to recap: We created a table and added two rows. We then merged two of the cells by setting a rowspan of 2 to end up with three content cells. Two of of these cells are part of the first row: "Supplier" and "Payment Terms." "Shipping Terms" is part of the second row (when you merge cells, the resulting cell belongs to whatever the top row was before you did the merge). All three cells have their vertical alignment set to "Top." 359
If we wanted the table to fill the available horizontal space, we'd set its width property to 100%. The next section describes how to create a generic tableLayout region, and then follows with the specific implementation of this example.
Declarative Implementation
To add a basic tableLayout to your page: Step 1: Create a new region, assign it a standards-compliant ID and set its Region Style to tableLayout. In most cases you'll want the tableLayout to fill whatever space it's rendering in, so you should set its Width to 100% (if you don't do this, you might find that your content doesn't start/end align as you might expect it to since this region does not automatically expand to fill available space). You may also specify a number of pixels (300), or a smaller percentage if necessary. Step 2: Select your tableLayout region, right-click and select New > Region. Assign this region a standardscompliant ID and set its Region Style to rowLayout. Repeat this step for all rows that you want to add. Step 3: Select your rowLayout, right-click and select New > Region. Assign this region a standards-compliant ID and set its Region Style to cellFormat. Repeat this step for each row in your tableLayout. Step 3: Select your cellFormat, and add whatever region or item you want to display. If you need to control the alignment of the web bean displayed within the cellFormat, set its Vertical Alignment and Horizontal Alignment properties as needed. So, for example, if you want a text field to be start justified at the top of the cellFormat region, set the Vertical Alignment to top and the Horizontal Alignment to start. Note that this does NOT control the alignment of content within the web bean. For example, if the start aligned text field's Data Type is NUMBER, the text field value will be end aligned. If you need to change the column and/or row span for the cellFormat (as we do in the example below), set the Column Span and Row Span properties to a whole number (for example, 2). Note: Whenever you use a tableLayout, you must always create a complete structure: each tableLayout must have at least one rowLayout child, and each rowLayout must have a cellFormat child. Then, add your content to the cellFormat region. Do not "skip" regions in this structure as this can result in incorrect HTML output. Example Implementation Now that you know how to create a tableLayout and its contents, let's look at the example that we started working through above and translate the HTML into an OA Framework layout. Step 1: Create a tableLayout region and set its Width to 100%. Step 2: Add two rowLayout regions to the tableLayout region. Step 3: Add two cellFormat regions to the top row (these will be used for the Supplier and Payment Terms content). Add one cellFormat region to the bottom row (this will be used for the Shipping Terms content). Step 4: Select the Supplier cellFormat and set its Row Span property to 2. Set its Vertical Alignment property to top and its Horizontal Alignment property to start. Step 5: Select the Payment Terms cellFormat region and set its Vertical Alignment property to top and its Horizontal Alignment property to start. Repeat for the Shipping Terms cell. Step 6: Add the content that you want to render in each cell. For this particular layout, the structure appears as follows -- structurally similar to the HTML we created above. pageLayout | -- header ("Description") | | -- messageComponentLayout | | -- messageStyledText ("Number") | ... | -- header ("Terms and Conditions") | -- tableLayout | | -- rowLayout | | -- cellFormat | | -- header ("Supplier") | | -- messageComponentLayout | | -- messageStyledText ("Supplier") 360
| ... | | -- cellFormat | | -- header ("Payment Terms") | | -- messageComponentLayout | | -- messasgeStyledText ("Payment Terms") | | -- rowLayout | | -- cellFormat | | -- header ("Shipping Terms") | | -- messageComponentLayout | | -- messageStyledText ("Carrier") | -- header ("Items") | -- table See the Home Page example below for another tableLayout use case.
Personalization Considerations
None
Known Issues
None
Figure 18: Example of the same Home page with only "Start" and pageLayout content.
Figure 19: Example of the same Home page with only "End" and pageLayout content.
362
Note that the page contents bottom line (the "ski") renders beneath the main page content, and not beneath the "Start" and "End" content. To learn how to implement this Home page, see the OA Framework ToolBox Tutorial (oracle.apps.fnd.framework.toolbox.tutorial.webui.HomePG in Tutorial.jpr). Also see Content Containers. Also see the ToolBox Tutorial Home Page lab.
Home Page
See the Page Start and Page End topic above for pointers to examples.
Step 1: Create a messageComponentLayout region. Step 2: Add a messageLayout region to your messageComponentLayout region. Specify the Prompt value 364
for the messageLayout region (this serves as the prompt for the related items; in Figure 23, this value is "Combined Fields"). Tip: If you need to add this region in the middle of a column in another messageComponentLayout region, simply add a messageLayout region first, and then start with Step 1. Step 3: Add your items to the messageLayout region. Do not specify prompts for any of these items, but do set Additional Text values for accessibilty (per the OA Framework View Coding Standards, all fields must have prompts or additional text values). Step 4: Configure the messageComponentLayout region's properties as follows. This ensures that the fields render as close together as possible in a single row. Width = 1% Rows = 1 Prompt Width = 1% Step 5 (optional): If one or more of the items that you added to the messageLayout region are required: Set the messageLayout region's Required property to yes (in 11.5.10, you need to set this programmatically). This ensures that the required indicator renders next to the messageLayout prompt. Step 6: Add a controller to your region with the following code to identify the IDs for the items that you added in Step 3. This ensures that any Javascript client errors raised for these items display the Prompt that you specified in Step 2 (as if the combined fields were a single component). Note that the list of IDs is space-delimited, and is specified as the LABELED_NODE_ID_ATTR attribute value (in release 11.5.10, this cannot be set declaratively). public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); // Configure the combined fields with a single prompt so any client side // validation errors for the poplist or the field are displayed for the // messageLayoutBean prompt as if this were a single component. OAMessageLayoutBean msgLayout = (OAMessageLayoutBean)webBean.findIndexedChildRecursive("CombinedFieldsLayout"); // Set the LABELED_NODE_ID_ATTR attribute to a space-delimited list // of IDs associated with the messageLayout region. msgLayout.setLabeledNodeID("CombinedPoplist CombinedTextField"); } Figure 24: Example of a Javascript client validation error that references the Prompt associated with the messageLayout region holding the related items (see Figure 23 for the UI beneath the error dialog).
365
Related Information
OA Framework Developer's Guide Headers and Subheaders Dynamic User Interfaces Content Containers Search Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean oracle.apps.fnd.framework.webui.beans.layout.OAMessageComponentLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OAMessageLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OAFlowLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OADefaultSingleColumnBean oracle.apps.fnd.framework.webui.beans.layout.OADefaultDoubleColumnBean oracle.apps.fnd.framework.webui.beans.layout.OADefaultStackLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OADefaultFormStackLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OATableLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OARowLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OACellFormatBean OA Framework ToolBox Tutorial / Sample Library Search lab Drilldown to Details lab Create lab Home Page lab Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
366
Page Security
Overview
This document describes how to build applications that grant selected access to individual pages.
Security Example
To put the various aspects of page security in context, this document uses the following example application to illustrate the steps that you need to take in your applications. It is the same example that we used in Chapter 3: Menus and Page Security with one additional special page (the Benefits Registration Page). Page Benefits Registration Page Administer Benefits Create Benefit My Benefits Description User login page to access the benefits application. This page also allows a user to register himself. View, update, approve and discontinue benefits. Create a new benefit. View current benefit selections and make new selections as appropriate. Benefits Manager Employee Access? Access? Yes Yes Yes Yes Yes No No Yes
Update Beneficiaries
This page can be accessed from the "Workflow Notifications Page". This page has a "Create" button to launch the "Create Benefit" page. Yes Update designated beneficiaries.
Yes
Contents
Step 1: Create the Navigation Menu Step 2: Create Permissions Permissions to secure Component Access Case: Page supports auto responsibility setting Case: Shared/reusable page that needs a specific responsibility context Step 3: Create Grantees or Roles Step 4: Create Permission Sets Step 5: Create Grants Step 6: Extract Seed Data
Prerequisite Reading
Please read the following before proceeding: Chapter 3: Menus and Page Security Chapter 4: Tabs / Navigation Chapter 4: Component-Level Function Security (Dynamic User Interface)
then the Home Page top-level menu. Tip: The advantage of having just one navigation menu is that there is just one file to ship, patch and upgrade when the navigation within your application changes and/or you add more pages. Note that the Grant Flag for all of the functions should be unchecked (or set to N). One of the primary goals of the Oracle E-Business Suite security model is to separate navigation from security. And as you notice, the above navigation menu just defines the navigation or hierarchy for your application. To ensure the right authorization for your pages, you would then proceed with steps outlined in this document. Note: Prior to release 11.5.10, a navigation menu's function Grant Flags were checked (or set to Y). These functions could then be accessed only by those responsibilities that had access to the navigation menu.
responsibility context. If the permission is associated with more than one of your responsibilities, then the OA Framework picks the responsibility that is associated with the same organization as your current organization to display the page. If a match is not found, or if an organization is not available, then the OA Framework chooses your first responsibility associated with the permission. You have a responsibility context switcher on the page to switch to another responsibility (associated with the permission) if you like. If the permission is not associated with any of your responsibilities, then the OA Framework prohibits you from accessing the page. As we stated earlier, if the permission is associated with a global grant, then the OA Framework requires no responsibility context. In our example, Benefits Registration Page is globally granted. So, you can display that page without picking a responsibility. If your page has no permission set on its rendered flag, then the OA Framework displays a responsibility context switcher of all your responsibilities and then picks the first responsibility to display the page. You can use the responsibility context switcher to switch to another responsibility if you like. Tip: If your page is bookmarkable then it most likely falls either under Case 1 or Case 2 or both, unless you want to prompt the user to login and/or choose a responsibility. Case 3 : Shared/Reusable Page that Needs a Specific Responsibility Context This is an extension of Case 2. If your page is used in a cross application flow where each application has its own security context, then you should secure your page with a permission. The OA Framework uses this permission to identify your responsibility required for rendering the page, and makes a responsibility switch if necessary. In our example, the My Benefits page can be launched from the Workflow Notifications Page. Let's assume that the Workflow page needs a Workflow responsibility and the My Benefits page needs a Benefits responsibility. When you navigate to the Benefits page from the Workflow page, you want to switch to the workflow responsibility automatically without prompting the user. You can do so by associating a permission with the rendered attribute My Benefits page. As we discussed in Case 2 above, the OA Framework uses this permission to set or to switch to the Benefits responsibility automatically. You should also handle the case where a user can revisit the Workflow page from the Benefits page. Since the workflow page needs a Workflow responsibility, you should set a permission on its rendered attribute as well. This permission will then be used to switch to the Workflow responsibility automatically.
You need two user roles for our example above: one that groups all managers into a manager role, and another that groups all employees. Since all employees includes everyone, you can use a Global role for this purpose. Alternately, you can create a responsibility that is assigned to all managers, and use that for your grants setup.
simple terms, grants link your grantees to your permission sets. You need two grants for the example above: A Manager Grant to associate the manager permission set with the manager role. An Employee Grant that is associated with your Global permission set with a global grantee. Since this grant is associated with a global grantee (in other words, everyone) and has no additional security restrictions (in other words it is not restricted to any responsibility, organization or security group), it can also be called a global grant. In addition to specifying a grantee, you could also restrict your grant further with additional security context. This includes the current user's responsibility, organization and security group. So, for example, to restrict the manager grant to a specific organization, you can associate an organization context with the grant. Note that grants, just like responsibilities, are mostly created at the customer site. You create the permission sets, and the customer then creates the WF roles and creates grants to associate these roles with your permission sets. Instead of granting the manager permission set to the manager role, you can grant it to a global grantee. You can then restrict it to managers alone by associating a security context with the responsibility to which only managers have access. However note that the OA Framework recommends the use of role based grants instead of responsibilities. At runtime, a user is granted access to a page if the permission associated with the page is granted access to the current user's security context. The user's security context as described above includes the user's role, responsibility, organization and security group. To create the Manager grant, we: Step 1: Login to your development database and choose the Functional Administrator responsibility. This takes you to the Applications Administration Home Page. Step 2 : Navigate to the Grants sub tab under Security tab. Select the Create Function Grant button. Note that since the grant that we are creating is associated with a permission, it is also called a Functional Grant. You can use the page navigation buttons to complete the steps below. Step 3 : Choose the grantee for your grant. You have the following options: You should choose the All Users option to create a global grant that is accessible by everyone. Tip: You should choose this option for the Employee Grant. You should choose the Group of Users option to create a grant that is associated with a specific role. In our example, you should choose this option, and pick the manager role that you created from the LOV. You should choose the Single User option to create a grant that is associated with just one user. Step 4: Associate your grantee with the permission set by picking it from the LOV. In our example, you should pick the Benefits Manager Permission Set that you just created. Step 5: Pick any additional security context to associate with this grant. In our example, as we stated above, to restrict the manager grant to a specific organization, pick the organization from the LOV. Step 6: Pick the start date to activate your grant and optionally specify an end date. Step 7: Select Finish to create your grant. The Grants model is a very versatile model for modeling any security requirement of your application. The above steps to create your security rules by using roles, permission sets and grants is just one aspect of what it offers. You can find more information on its full list of features from the Oracle Applications Security Guide.
mode is either UPLOAD or DOWNLOAD configfile is the configuration file datafile is the data file entity is an entity name, or - to specify all values in an upload param is a NAME=VALUE string used for parameter substitution The following table describes which configuration file to use for the entities you want to extract. The configuration files are published in .../fnddev/fnd/11.5/patch/115/import. Configuration File FND_RESPONSIBILITY To extract the responsibilities that you created with your navigation afscursp.lct menu. Extracting a menu will also extract any submenus or functions MENU afsload.lct associated with it. In our example, use this to extract the navigation menu. Extracting the grant will also extract its permission set and its GRANT afsload.lct. permissions. In our example, use this to extract the manager and the employee grants. Entity Name Description Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
372
Page Stamps
Overview
As described in the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Page Stamps [ OTN Version ], page stamps let you display view-only, contextual information in a consistent fashion. Specifically, page stamps fall into the following categories: User login and connection information (for example, Logged In As mbriggs) Status or task-related information (for example, 22-Oct-2001 10:15 AM [current date and time], Status Approved, Sales Target $65,000,000 and so on) Page stamps are placed on the page according to the type of stamp and relative importance to the user's task. Possible locations (fully described in the UI guideline) include: User Info ("Log in Stamp") Footnote Stamp Primary Page Stamp Section Stamp
Implementation
The user info login stamp is a special, named child of the oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean. As of release 11.5.10, the user info stamp must be added programmatically as shown. public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); // Create a flow layout region to hold the prompt and data components. OAFlowLayoutBean userInfo = (OAFlowLayoutBean)createWebBean(pageContext, OAWebBeanConstants.FLOW_LAYOUT_BEAN, null, "userInfo"); OAStyledTextBean infoPrompt = (OAStyledTextBean)createWebBean(pageContext, OAWebBeanConstants.STYLED_TEXT_BEAN, null, "infoPrompt"); OAStyledTextBean infoText = (OAStyledTextBean)createWebBean(pageContext, OAWebBeanConstants.STYLED_TEXT_BEAN, null, "infoText"); userInfo.addIndexedChild(infoPrompt); userInfo.addIndexedChild(infoText); // Set the content for the prompt and the user name based on the current // user. Note that the prompt should be sourced from Message Dictionary and // not hard-coded as shown. Also note the inclusion of white space after // The "User Name" text to ensure that the two Strings don't render right 373
// next to each other (the flowLayout region is whitespace sensitive). infoPrompt.setText("User Name "); infoText.setText(pageContext.getUserName()); // Set the following styles to achieve the required look. infoPrompt.setCSSClass("OraPageStampText"); infoText.setCSSClass("OraPageStampLabel"); // Set the user info component on the page layout bean. OAPageLayoutBean pageLayout = (OAPageLayoutBean)webBean; pageLayout.setUserInfo(userInfo); }
Footnote Stamp
If present, a footnote renders at the bottom of your page above the page contents bottom line as shown in Figure 2. Figure 2: Example of a footnote.
Declarative Implementation
The footer page stamp is a special, named child of the OAPageLayoutBean. To add it to your page: Step 1: Select the pageLayout region in the Structure pane, right-click and select New > footnote. JDeveloper will create a footnote node including an item. Note: The UI Guidelines allow only one footnote; you can't add a region of multiple footnotes. Step 2: Name your item in accordance with the OA Framework Package / File / Directory standards. Step 3: Set the Item Style to formattedText. Set the Text property to the content you want to display in the footer stamp. For example: Footer Prompt <b>with Data</b>. Note the addition of the bold tag around the data portion. Step 4: Set the CSS Class to OraPageStampText. The resulting footnote renders as shown in Figure X above.
Runtime Control
To create and set the footer stamp programmatically, follow the User Info procedure described above. The OAPageLayoutBean accessors for this named child are get/setFootnote().
374
Declarative Implementation
The primary page stamp is a special, named child of the OAPageLayoutBean. To add it to your page: Step 1: Step 1: Select the pageLayout region in the Structure pane, right-click and select New > pageStatus. JDeveloper will create a pageStatus node including a flowLayout region. Step 2: Name your region in accordance with the OA Framework Package / File / Directory standards. Step 3: Set the Region Style as appropriate to achieve the desired layout (see Page Layout (How to Place Content) if you need help with standard layouts), and add the region and item(s) you want to display. For example, to achieve the layout shown in Figure 3, you simply need to add a staticStyledText item to the page status flowLayout followed by a region that extends /oracle/apps/fnd/framework/webui/OAReqFieldDescRG (since OAReqFieldDescRG is a tableLayout region, remember to set your region's Width to 100% so it aligns properly to the start).
Runtime Control
To create and set the page status stamp programmatically, follow the User Info procedure described above. The OAPageLayoutBean accessors for this named child are get/setPageStatus().
Section Stamp
Section stamps are merely items that render immediately beneath a header region (you may include up to 3 stamps beneath each header). To create a section stamp, add an item to your header and configure it as shown for a footnote.
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines Page Stamps [ OTN Version ] OA Framework Developer's Guide Contextual information Page Layout (How to Place Content) Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean OA Framework ToolBox Tutorial / Sample Library oracle.apps.fnd.framework.toolbox.samplelib.webui.BasicStructPG Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
375
Personalizable Pages
Contents
Flexible Layout and Flexible Content Declarative Implementation General Instructions User-Personalizable Regions in flexibleContent Regions Creating Configurable Page Templates Flexible Layout Examples Runtime Control Personalization Considerations Known Issues Related Information
376
The number of cells within a flexibleLayout region is determined by the value of its 'rows' and 'columns' attributes. These attributes determine how many flexibleLayout or flexibleContent children the current flexibleLayout region has. For example, if a flexibleLayout region has one column and one row, it has one cell as illustrated in the figure below, on the left. If a flexibleLayout region has 1 row and 2 columns, it displays 2 cells side by side. Each cell (or flexibleLayout region) can also have multiple rows and columns and therefore be split into additional cells. In the figure on the right, below, the flexibleLayout starts with 1 row and 2 columns, but the cell on the far right is further divided into 1 column and 2 rows, resulting in the three cells shown. One cell flexibleLayout - 1 column, Three cell flexibleLayout - 1 row, 2 columns, but column on right is further 1 row split into 2 rows Note In order to be able to take full advantage of page layout personalization capabilities, it is important when you create your configurable page, to use flexibleLayout and flexibleContent regions at all levels when you create the page hierarchy structure under your page layout region. In Oracle Applications, this is required, as it 377
Declarative Implementation
General Instructions
The following steps describe generally, how to implement a configurable page in OA Extension. Note that the steps may vary depending on the type of page layout that you want to achieve. Refer to the Flexible Layout examples for suggestions on some basic layouts you can implement in a configurable page. Step 1: In your project, create a new page and in that page, create a new region of style pageLayout. Set the necessary properties on the pageLayout region. Step 2: Select the pageLayout region and choose New > Region from the context menu. Set the Region Style property for this new region to flexibleLayout, to create a flexibleLayout region that you can use to layout flexibleContent or additional flexibleLayout regions. Step 3: Using the Property Inspector, you can set the following properties on the flexibleLayout region (* indicates a required property): ID* - Specify an identifier that uniquely identifies the region in the page. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. Attribute Set - specify an attribute set if you want to maintain a standard look and feel for your region. Title - specify the title for the region. The title is displayed only when the region is rendered in the collapsed state. Disclosed - specify True or False to indicate if the region is to be initially expanded (disclosed) or collapsed, respectively. The default is True. Rendered - specify True or False to indicate if the region is to be rendered. Setting Rendered to False is equivalent to hiding the region in the configurable page (or selecting Remove Content in Page Layout Personalization screen). The default is True. Layout Style - specify vertical or horizontal to indicate the direction that the content should be laid out. The default is vertical. This property takes effect only for those flexibleLayout regions that are leaf nodes, where the Rows and Columns properties are "1" and flexibleContents are added. Columns - specify the number of columns in the flexibleLayout region. The default is 1. Rows - specify the number of rows in the flexibleLayout region. The default is 1. Note The number of columns and rows indicate the number of cells within the flexibleLayout region. OA Extension automatically creates a child flexibleLayout region for each cell. For example, if Columns=2 and Rows=3, the flexibleLayout would contain 6 cells total, 2 columns going across and 3 rows going down, and OA Extension would create 6 flexibleLayout children for the flexibleLayout region. Height - specify the display height of the flexibleLayout in pixels or as a percentage (by including the % sign). Width - specify the display width of the flexibleLayout in pixels or as a percentage (by including the % sign). Show Border -specify True or False to indicate whether or not to display a border around the flexibleLayout region. The default is False. Show Header - specify True or False to indicate whether or not to display a header for the flexibleLayout region. The default is True. Admin Personalization - specify True or False to indicate if administrators are allowed to perform the personalization operations listed under the Admin Operations property. The default is True. User Personalization - specify True or False to indicate if users are allowed to perform the personalization operations listed under the User Operations property. The default is True. User Operations - specify the personalization operations that a user can perform on the component, if User Personalization is set to True. The choices are "null" or disclose. The default is "null". When you set this property to disclose and set User Personalization to True, the user can either expand (disclose) or collapse the flexibleLayout region in the rendered page. Admin Operations - specify the personalization operations that an administrator can perform on the component if Admin Personalization is set to True. The choices are "null" or add. The default is add. If 378
you set this property to add and set Admin Personalization to True, an Administrator can add predefined flexibleContent to the flexibleLayout region when personalizing the page in the Page Layout Personalization screen or the Page Hierarchy Personalization screen. Note The order in which the flexibleLayout regions within the Structure pane appear is the order in which they display in the configurable page. Step 4: To create flexibleContent, select the pageLayout region and choose New > flexibleContents from the context menu. OA Extension automatically creates a flexibleContentList named child in the pageLayout Components folder. There are no properties to set on the flexibleContentList. Step 5: Select the flexibleContentList named child and chose New > flexibleContent from the context menu. Step 6: Set the following properties on the flexibleContent region. In particular, specify the Flexible Layout Reference property to the ID of the flexibleLayout region in which you want this flexibleContent region to reside. (* indicates a required property) ID* - Specify an identifier that uniquely identifies the region in the page. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. Attribute Set - specify an attribute set if you want to maintain a standard look and feel for your region. Flexible Layout Reference - specify the ID of the flexibleLayout region in which you want this flexibleContent region to reside. You may use the list of values to select a flexibleLayout region ID. The list includes all leaf flexibleLayout regions (that have no children) defined in the current page structure. Leaving this property null indicates that the flexibleContent does not have to be associated with any particular flexibleLayout region and can later be added to any flexibleLayout region using the Add Content control on the Page Layout Personalization screen or the Page Hierarchy Personalization screen. Title - specify the title for the region. The title is displayed only when the region is rendered in the collapsed state. Description - specify a brief description of the items that are contained in this element. Use short phrases as this description is used to list the predefined content that can be manipulated from the Page Layout Personalization screen or the Page Hierarchy Personalization screen. Disclosed - specify True or False to indicate if the region is to be initially expanded (disclosed) or collapsed, respectively. The default is True. Rendered - specify True or False to indicate if the region is to be rendered. Setting Rendered to False is equivalent to hiding the region in the configurable page (or selecting Remove Content in Page Layout Personalization screen). The default is True. Show Border -specify True or False to indicate whether or not to display a border around the flexibleContent region. The default is False. Show Header - specify True or False to indicate whether or not to display a header for the flexibleContent region. The default is True. Admin Personalization - specify True or False to indicate if Admin level users are allowed to perform the personalization operations listed under the Admin Operations property. The default is True. User Personalization - specify True or False to indicate if users are allowed to perform the personalization operations listed under the User Operations property. The default is True. User Operations - specify the personalization operations that a user can perform on the component, if User Personalization is set to True. The choices are "null" or disclose. The default is "null". When you set this property to disclose and set User Personalization to True, the user can either expand (disclose) or collapse the flexibleContent region in the rendered page. Admin Operations - specify the personalization operations that an administrator can perform on the component if Admin Personalization is set to True. The choices are "null" or remove. The default is remove. If you set this property to remove and set Admin Personalization to True, an Administrator can remove flexibleContent so that it does not render on the page, when personalizing the page in the Page Layout Personalization screen or the Page Hierarchy Personalization screen. Removed regions can be added back using the Add Content control. Resource Description - specify a user friendly, concise description of the items contained in this flexibleContent region and optionally, its usage. In the Page Layout Personalization screen, when you select the Add Content control to navigate to the Add Content page, a catalog of predefined 379
flexibleContent regions for this page appears. The Content Name, as well as Content Type is listed for each flexibleContent region. The Content Name is the value specified in the Title property of this region and the Content Type is the value specified in the Resource Description property of this region. Step 7: Create the actual content for the flexibleContent region. Select the flexibleContent region in the Structure pane and select New > Region or Item from the context menu. Set the style for the region or item as desired and set the properties that are appropriate for that style. Note To specify a predefined region as the content of a flexibleContent region, create a new child region under the flexibleContent region and specify the ID of the predefined region in the Extends property of the newly created child region. Note The order in which the flexibleContent regions appear within the Structure pane is the order in which they display in the configurable page. Step 8: Depending on your layout needs, you can also embed a flexibleLayout region under a flexibleContent region. See the DBI Rack Layout example. Select the flexibleContent region and choose New > Region from the context menu. Set the Region Style to flexibleLayout, and set the remaining properties on this nested flexibleLayout region as appropriate. Step 9: Create other flexibleContent regions, as described above, to display in the embedded flexibleLayout region. For these flexibleContent regions you create, be sure to set the Flexible Layout Reference to the ID of the nested flexibleLayout region you created in Step 8 and set the remaining properties on the flexibleContent region as appropriate.
View Source Region ID - set to the ID of the region for which personalized views may be defined. If the user-personalizable region is defined outside the configurable page (extends), use the ... button to display the package browser window so you can select the complete region reference. View Source Target ID - set to the ID of the query region for which to apply a personalized view. If the user-personalizable region is defined outside the configurable page (extends), use the ... button to display the package browser window so you can select the complete region reference. Note: A user-personalizable region always has a table region embedded in a query region, so in typical usage, the View Source Region ID is always set to the ID of the table region and the View Target Region ID is always set to the ID of the query region.
381
Step 1: In the Structure pane, select the pageLayout region and select New > Region from the context menu. Step 2: In the Property Inspector, set the Region Style of the new region to flexibleLayout. Step 3: Ensure that the properties of the flexibleLayout region are as follows: Rows=1, Columns=1, Layout Style=vertical, and ID=MainFlexLayoutRN. Step 4: Create one flexibleContent region for each rack required, and set the flexibleLayoutRef property to MainFlexLayoutRN and ID property to Rack<N>FlexContent where N is a number that identifies this rack uniquely. Step 5: For each flexibleContent region (Rack<N>FlexContent) that represents a rack, create a child flexibleLayout region. Select the flexibleContent region and choose New > Region from the context menu. Set the following properties on the child region: ID=Rack<N>FlexLayout, Region Style=flexibleLayout, Rows=1, Columns=1, and Layout Style=horizontal. Step 6: For each item (content) that you want to display in a rack (usually a table, a chart, and links), create a new flexibleContent region by selecting the flexibleContentList and choosing New > flexibleContent from the context menu. Set the ID property appropriately to describe the content and set the Flexible Layout Reference property to Rack<N>FlexLayout. Step 7: For each flexibleContent region, select that flexibleContent region and choose New > Region or Item to create the actual content (chart, table, links). Example 2 - Creating a Table with One Row and Two Columns A flexibleLayout region with one row and two columns creates a 'table' with one row and two columns. To control the characteristics of each of the cells in this table, one nested flexibleLayout is needed for each cell. To create this layout : Step 1: In the Structure pane, select the pageLayout region and select New > Region from the context menu. Step 2: In the Property Inspector, set the Region Style of the new region to flexibleLayout. Step 3: Set the properties of the flexibleLayout region as follows: set Rows to 1, and Columns to 2. Since there are two columns, two nested flexibleLayouts are needed. OA Extension automatically creates these for you when you set the Rows and Columns properties. Step 4: Set the width property for the newly created flexibleLayout1 and flexibleLayout2 regions to achieve a look similar to the figure on the left, otherwise both columns will be of equal width.
382
Step 4: In the Structure pane, select the pageLayout region and select New > flexibleContents from the context menu. Step 5: This creates a new pageLayout Component called flexibleContents with one child of flexibleContentList. The flexibleContentList is where you define the content:
Step 6: Select flexibleContentList1 and choose New > flexibleContent from the context menu. This creates a region with Region Style set to flexibleContent. Step 7: In the Property Inspector, set the ID property of the new region to flexibleContent1 and set the flexibleLayoutRef property to flexibleLayout1. This indicates that the content should appear in the flexibleLayout with the ID of flexibleLayout1.
Step 8: Add content to the region called flexibleContent1. You can add regions or items. As an example, the following steps add a Header region with a messageTextInput item inside. Step 9: Select flexibleContent1 and choose New > Region from the context menu. Set Region Style property to header, ID property to SearchHDR and Text property to Search. Step 10: Select SearchHDR and choose New > Item from the context menu. Set the Item Style property to messageTextInput and set the Prompt property to Search. Step 11: Select SearchHDR again and select New > Item from the context menu. Set the Item Style property to button and set the Prompt property to Go. 383
Step 12: Create additional content. In the Structure pane, select flexibleContent1 and choose Copy from the context menu. Step 13: Select flexibleContentList1 and choose Paste from the context menu. Step 14: Repeat Step 13 two more times to create content as follows:
Step 15: Select flexibleContent11 and in the Property Inspector, set the flexibleLayoutRef property to flexibleLayout2. Step 16: Select flexibleContent12 and in the Property Inspector, set the flexibleLayoutRef property to flexibleLayout2. Step 17: In the Structure pane, select the flexibleLayout called flexibleLayout and set the Show Border 384
property to True. This helps demonstrate the example by drawing a border around the content. Step 18: Run the page. Example 3 - Creating an Asymmetric Layout A layout like this is obtained by subdividing the cells of the flexibleLayout region. This example is in fact like example 2 , with the right hand column subdivided into two rows. To create this layout: 1. In the Structure Pane, select the pageLayout region and select New > Region from the context menu. 2. In the Property Inspector, set the Region Style of the new region to flexibleLayout. 3. Set the properties of the flexibleLayout region as follows: set Rows to 1, and Columns to 2. 4. OA Extension automatically creates two nested flexibleLayout regions called flexibleLayout1 and flexibleLayout2. 5. Set the Rows properties to 2 for flexibleLayout2. 6. OA Extension automatically creates two nested flexibleLayout regions called flexibleLayout3 and flexibleLayout4. Refer to the General Instructions for information about other properties you can set on this region.
Example 4 - Creating a Projects Home Page A Projects Home page has two columns whose content is laid out in a vertical direction. It is similar to the layout in Example 2 above.
Runtime Control
There is no runtime control code necessary to create a configurable page.
Personalization Considerations
For information on how to personalize a configurable page, refer to Chapter 2: Admin-Level Personalizations, in the OA Framework Personalization Guide.
Known Issues
See a summary of key issues with suggested workarounds if available.
Related Information
BLAF UI Guideline(s) Javadoc Files Lesson(s) Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved. 385
Known Issues
See a summary of key Personalization issues with suggested workarounds if available.
Related Information
BLAF UI Guideline(s) Javadoc Files Lesson(s) Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
386
Setting a Localization
Since product teams handle localization differently, they are responsible for setting the localization that needs to be effective for each page (or each rootAM). To initialize the context with a localization code, the product teams need to do the following: Step 1: Make sure that the page's rootAM extends OAApplicationModuleImpl. Step 2: The method initializeWebValues in their rootAMImpl returns a string that is used as the localization code for this page. Product teams need to override this method with their product specific logic. See: AM Parameter Registry.
Function-Level Personalizations
A function in Oracle Applications is a piece of application logic or functionality that is registered under a unique name for the purpose of assigning it to, or excluding it from, a responsibility. You can create standard personalizations for a region at the Function level so that the personalizations are effective only for users of a specific function. Once you create a function-level personalization, you can update it or delete it. Note Oracle may deliver predefined Function-level personalizations. Customers can view but not update or delete "Oracle-seeded" Function-level personalizations. Function-level personalizations are the highest level of personalizations you can make. Any further personalizations you make to the same region at lower Admin-levels always override the personalizations you make at the Function level. To maintain function security, the function for which you are personalizing the region must be included in the responsibility from where users launch the page containing the region. Once you create a function-level personalization, you can pass the function name corresponding to the personalized region in any of the following ways, in order of highest to lowest precedence: Specify the function name from the root Application Module using the method initializeWebValues. See the AM Parameter Registry section for additional information. Specify the function name on the URL using the parameter OAFunc. For example: http://<server.com>:<portID>/OA_HTML/OA.jsp?OAFunc=<custom_function>&... OAFunc can be used in two different ways: 387
If OAFunc is used without akRegionCode/akRegionApplId, then the function corresponding to it is launched. If OAFunc is used in addition to akRegionCode/akRegionApplId or page, then it is used for setting the function context for that page. A function context should be set for the function personalization to take effect. For example, suppose you have the following URL that launches an Oracle Applications page that is defined as the web_html_call of function XYZ: OA.jsp?OAFunc = XYZ XYZ points to: OA.jsp?page=oracle.apps.fnd.framework.webui.TestRegion If you want a function-level personalization of ABC (defined using OA Personalization Framework) to apply to this page, you should change the web_html_call of function XYZ to: OA.jsp?page=oracle.apps.fnd.framework.webui.TestRegion&OAFunc=ABC In OA Extension, search for the page layout region you just personalized. In the Property Inspector, set the Function Name property to the name of the function that you specified for the Function-level personalization.
AM Parameter Registry
You can register parameters associated with any application module by seeding them in the table AK_AM_PARAMETER_REGISTRY using the HTML-based AM Parameter Registry page. You can later retrieve those parameters from the URL(Request) or Session with the initializeWebValues method. Step 1: The Application Module Parameter Registry page is shipped as part of Oracle Applications 11.5.10 seed data, but is not associated with any given responsibility. To run this page, a system administrator must first attach the function AK_AM_PARAMREGSTRY_SEARCH to a menu and add that menu to a responsibility using the Oracle Applications Menus and Responsibilities screens. Step 2: Use the Search region to search for parameters based on Application Name, Module Definition Name, Parameter Name or Source. You can update existing parameters or select the Create Record button to register new parameters. Choose Apply to save your changes. Step 3: You can later retrieve the parameters for all context setting variables like functionName and localizationCode using the initializeWebValues method. The method initializeWebValues returns name-value pairs. For example, suppose you want to set the functionName of the current page. You would need to do the following: 1. Override the method initializeWebValues in the application module associated with the current page. 2. Return an ArrayMap entry that has the function name of the page keyed by: OAFwkConstants.FUNCTION_NAME. 388
Note that if you need to override the localization code as well, then return another entry for the localization code keyed by OAFwkConstants.LOCALIZATION_CODE. Attention The method initLocalizationCode has been deprecated, so you should use initialWebValues instead.
Known Issues
See a summary of key Personalization issues with suggested workarounds if available.
Related Information
BLAF UI Guideline(s) None Javadoc Files oracle.apps.fnd.framework.OAFwkConstants oracle.apps.fnd.framework.server.OAApplicationModuleImpl Lesson(s) None Sample Code None Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
389
Portlets
Overview
Portlets are reusable components you can insert into web pages created with Oracle Portal. They typically display summarized information and provide entry points into applications. Users of a portal can customize the pages they use, adding portlets that are relevant to their job or interests. This topic describes how to create portlets using the OA Framework. For more information about developing portlets using Oracle Portal refer to the Oracle Application Server Portal Developer Kit (PDK) The OA Framework lets you expose any regions (except pageLayout regions) as portlets. Page layout regions cannot be exposed as portlets because portlets are always rendered inside an HTML table cell and page layout regions contain HTML constructs that cannot be rendered within a table cell. Figure 1: Example of a Portal page including OA Framework portlets.
Prerequisites
To execute portlets created with the OA Framework you must have access to an installation of Oracle Portal 3.0.9.8.4. If you do not have Oracle Portal 3.0.9.8.4 installed, you must complete the prerequisites as described in Metalink note 146469.1. Regions to be exposed as portlets must be created using OA Framework 5.10 (or later). The remainder of this document assumes you have created and unit tested a region you want to expose as a portlet. Refer to the OA Framework Developer's Guide and the OA Framework ToolBox Tutorial for general information about creating regions.
Basic Implementation
Exposing an existing region as a portlet is very simple. To expose your region as a portlet: Step 1: Create a UI Function to register your region as a portlet. See Tabs/Navigation for more information regarding the creation of UI Functions. Step 2: Set the following properties within your new UI Function: Function Type = Web Provider Portlet (internal value is WEBPORTLET) HTML call = OA.jsp?region=<your region Reference> For example: OA.jsp?region=/oracle/apps/fnd/wf/worklist/webui/WorklistPrtletRG If your portlet includes a drill-down page, append a parameter to the above URI specifying the target of the drill down using a page reference or a function name. For example: 1. &detailPage=<target page> For example: OA.jsp?region=/oracle/apps/fnd/wf/worklist/webui/WorklistPrtletRG &detailPage=/oracle/apps/fnd/wf/worklist/webui/AdvancWorklistPG 390
2. &detailFunction=<Form Function name> For example: OA.jsp?region=/oracle/apps/fnd/wf/worklist/webui/WorklistPrtletRG &detailFunction=WF_WORKLIST_DRILL_FUNC Step 3: Optionally disable portlet personalization By default, all portlets rendered using the OA Framework Web Provider include a Customize link in the title bar. Clicking on the link displays a customization page that lets you change the portlet title and responsibility. With this page you can customize the portlet title and assign a responsibility to it. Customizing the responsibility is useful when a portlet content is dependent on the responsibility context, and is associated with multiple responsibilities. To disable portlet customization, append &dispRespCustPg=N to the HTML call URI. For example: OA.jsp?region=/oracle/apps/fnd/wf/worklist/webui/WorklistPrtletRG&dispRespCustPg=N Step 4: Associate help text defined using Oracle iHelp with your portlet. When you associate help text with your portlet the OA Framework Web Provider renders a help text icon (?) in the portlet title bar. Clicking on the icon displays the help text. To associate help text with your portlet, append &oawpHelpTarget=<Oracle iHelp reference> to the HTML call URI. For example: OA.jsp?region=/oracle/apps/fnd/wf/worklist/webui/WorklistPrtletRG&oawpHelpTarget= worklistHelp
For example: OA.jsp?region=/oracle/apps/fnd/wf/worklist/webui/WorklistPrtletRG&portletRefreshR ate=10 A value of 10 would result in the portlet being cached for 10 minutes. Note: Portlets do not need to be cached for a long period of time for caching to be beneficial. Caching a portlet for as little as 5 minutes is significantly better than not caching it at all.
Validation-Based Caching
Validation-based caching lets end users to see real-time data without having to regenerate the portlet content every time a user requests it. Instead, the OA Framework maintains a version ID that application code increments whenever the data associated with a portlet is modified. When the OA Framework Web Provider receives a request for the portlet, it generates the content and sends it with the current version ID to Oracle Portal. Oracle Portal maintains the version ID with the cached portlet. On subsequent requests, Oracle Portal "pings" the OA Framework Web Provider to determine if the version ID of the cached content is still valid. If the version ID of the cached content is still valid, the OA Framework Web Provider indicates to the portal that it is okay to use the cached content. If the version ID is invalid, the OA Framework Web Provider generates fresh portlet content and returns it to Oracle Portal along with the latest version ID. Validation caching works well because the time it takes for the OA Framework to compare two version IDs is significantly less than the time it would take to generate the portlet content each time it is requested. However, it is important that your application code updates the version ID for your portlet whenever the underlying data is modified. To do this you must insert the following API call into any application code that changes the data displayed by the portlet. oracle.apps.fnd.framework.util.provider.OAFrameworkProviderUtil.incrementPortletC achingKey( AppsContext ctx, String referencePath, int userId ) Refer to the OAFrameworkProviderUtil Javadoc for additional information. Note: During development, you can use the Refresh icon to manually increment the version ID and force the portlet content to be regenerated. The Refresh icon is displayed in the portlet title bar when the Developer Mode profile option is enabled.
| -- Region3 | -- Region4 | -- Region2 -- uses your application module Step 5: Enter the URI of your portlet specific customization page in the MDS Reference Path field of your UI Function definition. Once a value is defined for the MDS Reference Path, users will be able to navigate to the portlet specific customization page using the Next button in the default portlet customization page. For example: /oracle/apps/fnd/framework/customjrad/webui/CustomJRADViewUpdatePage
Troubleshooting
Please refer the Portal Issues section of the metalink note 216208.1 for troubleshooting assistance.
Related Information
Javadoc oracle.apps.fnd.framework.util.provider.OAFrameworkProviderUtil Copyright 2000 - 2004, Oracle. All rights reserved.
393
Printable Page
Overview
In accordance with Oracle Browser Look-and-Feel (BLAF) UI Guidelines: Preview and Printable Page Flows [ OTN Version ], any OA Framework page can be rendered in an optimized state for printing. Printable pages do not include any navigation controls or Personalization links (if Personalization is enabled), and they should open in a new browser window. Users access the printable version of a given page by accessing a "Printable Page" button as shown in the following flow diagram. Figure 1: Example "Printable Page" flow
Declarative Implementation
On any page that should have a printable state: Step 1: Add a page-level button as described in the Buttons (Action/Navigation) document. Step 2: Assuming your button label is the standard "Printable Page," apply the OA Framework attribute set /oracle/apps/fnd/attributesets/Buttons/PrintablePage. Step 3: Set the button's Destination URI property to point to the current page and set the UIX facet parameter (OARF) to printable as shown in the following example (if you don't know what a "facet" is, please see Controlling UIX Rendering Output for additional information). Remember to retain your application module. OA.jsp?page=<CURRENT_PAGE>&retainAM=Y&OARF=printable Note: Earlier versions of the OA Framework recommended giving the printable page submit button the ID "IcxPrintablePageButton." The OA Framework would detect this ID and behave appropriately when the user pressed the button. Although this still works, new code should leverage the facets approach instead. Step 4: Set the button's Target Frame property to _blank. This ensures that the printable page opens in a new window. Tip: If your page requires a request parameter so it can build properly when the OA Framework renders the page (for example, if you need to pass a primary key to a details page from a summary page), your Printable Page button needs to put this value on the request when it is selected. In the ToolBox Tutorial orace.apps.fnd.framework.toolbox.tutorial.webui.PoDetailsPG, we show how to bind the button to a view instance and use a URL token to pick up the primary key value.
Runtime Control
If you need to make any supplemental changes to the page over and above the standard OA Framework changes for a printable page, add the following code to the processRequest method in a controller associated with the base page. String printable = pageContext.getParameter("OARF"); 394
if ( (printable != null) && (FACET_PRINTABLE.equals(printable)) ) { // Printable page mode processing } else { // Normal page processing }
Personalization Considerations
See a summary of Printable Page personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guidelines Preview and Printable Page Flows [ OTN Version ] OA Framework Developer's Guide Controlling UIX Rendering Output Buttons (Action/Navigation) OA Framework ToolBox Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
395
Processing Page
Overview
Per the Oracle Browser Look-and-Feel (BLAF) UI Guidelines: Processing Templates [ OTN Version ], you can display a special "Processing" page whenever the user should be told that a long-running process is working in real-time in the background (note that this is appropriate only if the user cannot do anything else while the process is running). Figure 1: processing page content (without incremental status)
Declarative Implementation
Currently, there is no declarative support for this feature.
Runtime Control
To associate a processing page with a long-running process, complete the following two steps. Note: The current OA Framework Processing page implementation has the following two restrictions: Once the processing starts, the background process cannot be cancelled (so no Cancel button displays as shown in the BLAF guideline). Only the simple, static processing page (without information about incremental status) is currently supported. Step 1: Create a Controller for the Processing Page Create a controller to be used by the Processing page. This controller should actually start the long-running process (in the processFormRequest method as shown below); and specify the destination page to display when processing completes. Note: The target post-processing display page should include a "Confirmation" message so users aren't left to wonder if the process completed successfully. public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean);
... // Finally, tell the OA Framework what page to display when the processing completes // (this assumes you display a "Confirmation" message at the top of the target page). // Note that you can also display a "Confirmation" dialog instead. 396
// This example assumes a submit button named "StartProcess" initiates the long-running // process. if (pageContext.getParameter("StartProcess")!= null) { // Create the processing page and pass it the fully qualified name of the controller that // you created to launch the process. OAProcessingPage page = new OAProcessingPage("oracle.apps.fnd.toolbox.samplelib.webui.processCO"); // The concise message is displayed in bold and should briefly describe the process. // NOTE: never hard-code text display values as shown here. Always use message dictionary. page.setConciseMessage("This is the concise processing page message."); // The detailed message displays below the concise message in plain text. It provides // additional information about what's happening. page.setDetailedMessage("This is the detailed message which should explain what's happening."); // This is displayed in the processing page title. page.setProcessName("<Process Name>"); // Forward to the processing page. Note that the OA Framework assumes you are retaining // the root application module. Since we haven't specified a different root AM on // the processing page, the OA Framework assumes it uses the same root AM as the // launching page. pageContext.forwardToProcessingPage(page); } 397
Personalization Considerations
See a summary of Processing Page personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
Listed above.
Related Information
BLAF UI Guideline(s) Processing Templates [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.OAProcessingPage OA Framework ToolBox Tutorial / Sample Library oracle.apps.fnd.framework.toolbox.samplelib.webui.ProcessExamplePG.xml oracle.apps.fnd.framework.toolbox.samplelib.webui.ProcessExamplePageCO.java oracle.apps.fnd.framework.toolbox.samplelib.webui.ProcessPageCO.java Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
398
Quick Links
Overview
As described in the BLAF UI Guideline: Quick Links [ OTN Version ] specification, Quick Links are a means for users to see and access clearly defined topics within a long page that might otherwise scroll out of sight. Figure 1 illustrates how Quick Links (and the corresponding "Return to Top" links at each target subheader) render in a page. Figure 1: Example of Quick Links and topic subheaders.
Declarative Implementation
To enable Quick Links, set the pageLayout region's Quick Links Shown property to true. The OA Framework automatically includes all top-level headers (except for the first which is clearly visible from the top of the page) in the list of Quick Links. In this case, "top-level headers" are defined as those that you add directly to the pageLayout region. For example, consider the pageLayout JDeveloper definition for the "Samples" page shown above. Only the three headers added to the pageLayout region are eligible to be included in the Quick Links, and the first is always omitted. Were any subheaders or subsubheaders to be created beneath these top-level header regions, they would not be included in the Quick Links. Figure 2: Quick Links example page region relationships to the pageLayout region
399
Note: The UI Guideline includes recommended minimum and maximum numbers of Quick Links. This is not enforced by the framework; it's up to you to build a compliant design.
Runtime Control
If you want to enable or disable Quick Links programmatically, call setQuickLinksShown() on the oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean as illustrated below. import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean; ... processRequest(OAPageContext pageContext, OAWebBean webBean) { ... // Assuming the controller is associated with the pageLayout region OAPageLayoutBean page = (OAPageLayoutBean)webBean; page.setQuickLinksShown(true); ...
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines: Quick Links [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean OA Framework ToolBox Tutorial / Sample Library oracle.apps.fnd.framework.toolbox.samplelib.webui.BasicStructurePG.xml Copyright 2000 - 2004, Oracle Corporation. All rights reserved. 400
401
Implementation
Regardless of where you actually add your related information links, the following will help you create the individual links: If you want to implement your links as a bulleted list, see the Bulleted List documentation. If you want to implement your links with images a shown in Figure 3, see Page Layout (How to Place Content) For information on creating a link (either in a bulleted list, or in a flow layout with an image), see Buttons (Links). Related Links in a Content Container In this context, you are adding your related links to a content container. For information on how to add a content container to your page, see Content Containers in a Page. See the ToolBox Tutorial Home Page Lab for an example implementation of this. Related Links in a Region Subsection In this context, you are adding your related links to a header. For information on how to create adjacent subheaders, see Headers. If you want to add your related links in-line with text items in a region, see Page Layout (How to Place Content).
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines "Related" Links / Shortcuts [ OTN Version ] OA Framework Developer's Guide Content Containers in a Page Bulleted Lists Headers OA Framework ToolBox Tutorial / Sample Library Home Page Lab Copyright 2000 - 2004, Oracle Corporation. All rights reserved. 402
Overview
The Rich Text Editor component provides rich text editing capability within OA Framework. The component allows users to author, edit and view rich text content in a browser that supports IFRAMEs. Note The Rich Text Editor area is currently only supported for Microsoft Internet Explorer (IE) 5.5 & above on the Microsoft windows platform. IE has support for the IFRAME html tag and exposes browser DOM API's through JavaScript, which are used for rendering and manipulating the rich text. On other platforms and other browsers, a plain text area is rendered instead of the Rich Text Editor. The Rich Text Editor consists of two parts: 1. Tool Bar 2. Editable Area The tool bar is rendered above the editable area. The user can enter text in the editable area and format it by selecting the text and choosing one of the icons on the Tool bar. The user can also toggle between Rich Text and Normal Text modes or view the HTML source for the text entered in the editor. Figure 1: Example of a Rich Text Area Displaying a Subset of Toolbar icons
The toolbar contains two rows of editing tools. The First Row of the toolbar may contain the following: Font poplist - lets you choose the font for the selected text. Font Color poplist - lets you choose the font color for the selected text. Font Size poplist - lets you choose the font size for the selected text. Checkbox to view HTML source. The Second Row of the toolbar may contain the following: Cut - cut the selected text. Copy - copy the selected text. Paste - paste the previously copied text. Bold - make the selected text Bold. Italic - Italicize the selected text. Underline - Underline the selected text. 403
Align Left - align the text to the left. Align Center - align the text to the center. Align Right - align the text to the right. Number Order List - change the selected text to be an number ordered list. Bulleted List - change the selected text to be a bulleted list. Decrease Indent - decrease the indentation of the selected text. Increase Indent - increase the indentation of the selected text. Create Hyperlink - create a hyperlink for the selected text. Click-through Destination - build an application-specific URI. It is the responsibility of the calling application to specify a popup page URL to build the URI. The popup page builds the URI and calls setHref(url) via the RichTextEditor javascript proxy object to set the URI on the selected text or image in the editable area. Upload Image - allows user to upload and embed an image from another source, such as from the Desktop, Content Repository, etc. It is the responsibility of the calling application to specify a popup page URL for the image upload. In the popup page, the user selects the image from the Content Repository or upload it from the desktop. The popup page then calls insertImageTag(imageSrc) via the RichTextEditor javascript proxy object to insert the image tag in the editable area.
Usage Notes
The Rich Text Editor (oracle.apps.fnd.framework.webui.beans.message.OAMessageRichTextEditorBean) can be used to provide rich text editing capabilities where needed, instead of using OAMessageTextInputBean. Attention: Rich Text Editor cannot be used in search regions or tables.
Contents
Accessibility Compliance Bi-direction Support Declarative Implementation Runtime Control Instantiate Control Visual Properties Setting the Font Bar Setting the Button Bar Setting Click-Thru URI, Image Upload and Create Hyperlink Public Javascript Functions for the Rich Text Editor Personalization Considerations Known Issues Related Information
Accessibility Compliance
The Rich Text Editor conforms to the Oracle Global HTML Accessibility Guidelines. Accessibility of the Rich Text Editor is determined by the value of the profile option ICX_ACCESSIBILITY_FEATURES. This profile value is read by OARenderingContext and made available to the Rich Text Editor. There are three possible Accessibility modes: DEFAULT_MODE - where strict accessibility compliance is met and the Rich Text Editor is always rendered in Text Mode. This mode results when ICX_ACCESSIBILITY_FEATURES is set to Yes. SCREEN_READER_MODE - where content is optimized for screen readers and the Rich Text Editor is always rendered in Text Mode. This mode results when ICX_ACCESSIBILITY_FEATURES is set to Screen Reader. 404
INACCESSIBLE_MODE - where code is optimized to strip out Accessibility-specific constructs. In this mode, the Rich Text Editor is rendered in Rich Text Mode, along with a Switch Mode hyperlink, that is based on the SwitchHyperLink property, set internally by OA. This mode results when ICX_ACCESSIBILITY_FEATURES is set to No.
Bi-direction Support
Rich Text Editor supports bi-direction rendering and renders icons in the button bar accordingly. The following icons are bi-di supported:
Icon Align Left Align Right Bullet List Number List Indent List Outdent List
Declarative Implementation
To add a Rich Text Editor to a region: Step 1: Select the region in the OA Extension Structure pane, select New > Item from the context menu. Name your new item in accordance with the OA Framework naming standards, and set its Item Style to messageRichTextEditor. Step 2: Set the following properties for the messageRichTextEditor item. Property Rich Text Mode Height Rich Text Mode Length Plain Text Mode Height Plain Text Mode Length Font Bar Edit Icons Style Icons Alignment Icons Bullet Icons Indentation Icons Create Hyperlink Icon Image Upload URl ClickThru Meaning The display height of the rich text editor in pixels or as a percent (specify as number%) of the container. The display length of the rich text editor in pixels or as a percent (specify as number%) of the container. The display height of the text mode editor in characters. The display length of the text mode editor in characters. Indicates if the font bar is displayed. Indicates if the cut, copy and paste icons are displayed. Indicates if the bold, italic and underline icons are displayed. Indicates if the left, center, and right alignment icons are displayed. Indicates if the bullet and numbered list icons are displayed. Indicates if the indentation icons are displayed. Indicates if the Create Hyperlink icon is displayed. The URI launched from the Upload Image icon. If null, no icon is shown. See the description of the Upload Image Button Bar icon for additional information on how to use this feature. The URI launched from the "Click Thru Destination" icon. If null, no icon is shown. See the 405
description of the Click-through Destination Button Bar icon for additional information on how to use this feature. The maximum length of the data in the view attribute, which is also the maximum number of characters that can be entered in the editor. A value has to be specified for this property, otherwise no input is taken by the Rich Text Editor. The exception is when the Data Type is CLOB, in which case this property does not need to be set. View Instance The name of the view object instance that is mapped to the text in the Rich Text Editor. View Attribute The name of the view attribute that maps to a column in the view object. Note The Maximum Length property sets the maximum length for the datatype VARCHAR2, and the maximum number of characters that can be entered in the editor. In plain text mode, you are not allowed to type any more characters beyond this value. In rich text mode, if you enter more than the maximum number of characters allowed, you get a JavaScript error when you submit the page. In addition to the properties listed above, the messageRichTextEditor item supports the following properties: Meaning Property Required Indicates if the user must enter a value. Read Only Indicates if the value can be changed. Prompt The text label for the component. Tip-related properties To display the short/long tip. Step 3: Save your work.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily.
Instantiate
OAMessageRichTextEditorBean rteBean = (OAMessageRichTextEditorBean) createWebBean (pageContext, RICH_TEXT_EDITOR_BEAN);
//Set bean Id rteBean.setID("htmlData"); //Set View Usage Name rteBean.setViewAttributeName("Description"); //Set View Attribute Name rteBean.setViewUsageName("RichTextEditorVO"); //Set Prompt rteBean.setPrompt("Prompt"); //Add Bean to the web bean hierarchy webBean.addIndexedChild(rteBean);
406
//set Height in RichText Mode rteBean.setRichTextModeDisplayHeight("100%"); //set width in RichText Mode rteBean.setRichTextModeDisplayLength("100%"); //Set Maximum Characters can be entered in both Text and RichText mode rteBean.setMaximumLength(4000); //Set flag NOT to render Font Bar rteBean.setFontBar(false);
// FontListVO should provide the list of supported fonts font.setPickListViewUsageName("FontListVO"); font.setListValueAttribute("LookupCode"); font.setListDisplayAttribute("Meaning" ); font.setID("font"); //Font Color Poplist OAMessageChoiceBean color = (OAMessageChoiceBean) createWebBean (pageContext, MESSAGE_CHOICE_BEAN); // FontColorVO should provide the list of supported font colors color.setPickListViewUsageName("FontColorVO"); color.setListValueAttribute("LookupCode"); color.setListDisplayAttribute("Meaning" ); color.setID("color"); //Font Size Poplist OAMessageChoiceBean size = (OAMessageChoiceBean) createWebBean (pageContext, MESSAGE_CHOICE_BEAN); // FontSizeVO should provide the list of supported font sizes size.setPickListViewUsageName("FontSizeVO"); size.setListValueAttribute("LookupCode"); size.setListDisplayAttribute("Meaning" ); size.setID("size"); //Set Font dropdown Bean rteBean.setFontBean(font); 407
//Set Color dropdown Bean rteBean.setFontColorBean(color); //Set Size dropdown Bean rteBean.setFontSizeBean(size);
//Set to render indent & outdent icons. rteBean.setIndentationIconsGroup(true); //Set to disable indent & outdent icons. rteBean.setIndentationIconsGroup(false); //Set to render Hyperlink icon. rteBean.setHyperlinkIcon(true); //Set to disable Hyperlink icon. rteBean.setHyperlinkIcon(false); //Set to render Click Thru Destination icon. rteBean.setClickThruDestinationUri(true); //Set to disable Click Thru Destination icon. rteBean.setClickThruDestinationUri(false); //Set to render Image upload icon. rteBean.setImageUploadUri(true); //Set to disable Image upload icon. rteBean.setImageUploadUri(false);
In order to use the Click-Thru Destination or Upload Image feature of the Rich Text Editor, you must first define a URL for a Javascript popup page that you create: If you want to use the Click-Thru Destination feature, your popup page should build a URI and call setHref(url) via the RichTextEditor javascript proxy object to set the URI on the selected text or image in the editable area. If you want to use the Upload Image feature, your popup page should allow the user to select the image to upload from the desktop. Use the following API's to set that URL as the destination of the Click-Thru Destination URI or Image Upload URI. String proxy = rteBean.getID() + "_rte"; // Create URL for Click-Thru Destination page and set as Click-Thru // Destination URI property. rteBean.setClickThruDestinationUri(ctdUrl); // Create URL for Image Upload page and set as the Image Upload URI property String imageUrl = "javascript:popUpWindow('OA.jsp?page=/oracle/apps/..../ImageUploadPG',{});"; rteBean.setImageUploadUri(imageUrl);
Personalization Considerations
See a summary of Rich Text Editor personalization considerations in the Oracle Applications Framework Personalization Guide. 409
Known Issues
See a summary of key issues with suggested workarounds if available.
Related Information
BLAF UI Guideline(s) Javadoc File(s) oracle.apps.fnd.framework.webui.beans.message.OAMessageRichTextEditorBean Lesson(s) Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
410
Implementation
In general terms, you must ensure that any user navigation that might result in the loss of application module transaction state be flagged to raise a warning. Specifically, if you follow the Page-Level Control and ItemLevel Control instructions below, the OA Framework displays a Javascript Alert message asking the user if she wishes to proceed whenever she performs one of the following actions with pending data changes: Selecting a tab, horizontal navigation or side navigation menu entry Selecting a global button (implies retainAM=N) Selecting a breadcrumb link. Selecting a link with URL parameter retainAM=Y and the Warn About Changes property set to True (note that this applies only to declaratively defined links; this does not apply to menu links) Selecting an image which does not post your changes. For example, selecting an LOV icon or a long tip window will not trigger the save model warning. However, if the user selects on an image that navigates to Yahoo, for example, the warning is displayed. Selecting a link that performs a form submit and has the Warn About Changes property set to True.
Page-Level Control
For any single page, or first page in a navigation flow where the retainAM URL parameter value is set to Y (and the pages share the same root UI application module) as you navigate between each page, set the Warn About Changes property to True on the pageLayout region. Alternatively, call pageContext.activateWarnAboutChanges() in a processRequest() method associated with the same page where you might otherwise set this property declaratively. It is important that you implement this check on the first page of a flow. If, for example, you don't implement it until the third page in a six-page flow, the first two pages won't be covered (unless the user returns to these pages after accessing the third page). Note: The programmatic implementation overrides the declarative one. So, if you enable the check programmatically, but the Warn About Changes property is False, the check is still performed. For pages coded before release 11.5.10 that use the old pageContext.activateBlockOnNavigation() method to enable this check, this functionality has been extended to include all the pages in a flow where the retainAM URL parameter is set to Y as you navigate between pages. Prior to release 11.5.10, this method applied only to the single page where it was called.
Item-Level Control
Note: Item-level settings apply only if this check is enabled in the containing page. The item level controls are available on the following types: OAMessageStyledTextBean OAStaticStyledTextBean OAImageBean 411
OALinkBean OASubmitButtonBean OAButtonBean OAMessageCheckBoxBean OAMessageChoiceBean OAMessageDateFieldBean OAMessageListBean OAMessageLovChoiceBean OAMessageLovInputBean OAMessageRadioButtonBean OAMessageRadioGroupBean OAMessageTextInputBean OATreeDefinitionBean (hierarchy column) for an HGrid or a Gantt chart (see the respective documentation for these components for special implementation instructions) OASideNavBarBean (see the special implementation instructions below). By default, the Warn About Changes property is set to True for each of the items in this list except for the OASubmitButtonBean whose default value is False (a ccording to the UI guidelines, the "Warn About Changes" check should be performed for all submit button instances except for Cancel, Apply and Submit buttons). If you want to explicitly enable the check for a submit button, set this property to True. Note that can also set it programmatically by calling OASubmitButtonBean.setWarnAboutChanges(pageContext, Boolean.TRUE) in processRequest(). Tip: The Warn About Changes property is set to False in the standard Cancel button attribute set oracle/apps/fnd/attributesets/Buttons/Cancel. If you use this attribute set for your Cancel button, it will automatically comply with the UI guidelines. Side Navigation By default, selecting the links in a side navigation warns the user if the "Warn About Changes" feature is enabled for the current page and there are pending changes in the transaction. Since the side navigation component is not created declaratively, you must programmatically disable the "Warn About Changes" feature if you are not satisfied with the default behavior. So, for example, if you want users to be able to navigate within this component with pending changes, implement the following processRequest() logic (note that, as a rule, you should also retain your root UI application module as the user navigates back and forth because this design implies that the pages within the side navigation are part of the same task). OASideNavBean sideNav = (OASideNavBean)pageContext.getPageLayoutBean().getSideNav(); if (sideNav != null) { sideNav.setWarnAboutChanges(false); } Alternatively, you could get a handle to the side navigation as shown and selecting disable the save model warning for individual links, although for Oracle's internal E-Business Suite developers, this particular UI must be approved by the corporate UI team. Items Configured to Perform a Form Submit For items from the list above that do not ordinarily submit the form when selected (like an OALinkBean or an OAImageBean), you must configure the item to submit the form using the fireAction event if you want the "Warn About Changes" check to be enabled (see the Declarative Submit Form documentation for fireAction implementation instructions). These items cannot submit the form using a Javascript URL. Note: If you configure any of these beans to perform a form submit with the fireAction event, you must also disable client and server side validation if you want the save model test to be performed (set the Disable Client Side Validation and Disable Server Side Validation properties to True). Items Without a Data Source 412
Any changes to items that do not have associated view object attribute bindings (search fields, for example) should not cause the "Warn About Changes" message to display when the user navigates out of the page. To prevent this from happening, you should set the Warn About Changes property to False on any of the following item types used for this purpose: OAMessageCheckBoxBean OAMessageChoiceBean OAMessageDateFieldBean OAMessageListBean OAMessageLovChoiceBean OAMessageLovInputBean OAMessageRadioButtonBean OAMessageRadioGroupBean OAMessageTextInputBean Data Defaulting and Warn About Changes The "Warn About Changes" feature checks transaction state (whether view object rows are "dirty") to determine whether to show the warning message. If your application sets default data in a new page, and you don't want the "Warn About Changes" warning to display if the user leaves the page without making any changes, you must explicitly reset the row state as described in the OA Framework Model Coding Standard M69.
Personalization Considerations
See a summary of Save Model personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
In order to provide save model support for Javascript links, the OA Framework adds some special Javascript on the onClick event. The OA Framewwork does not currently support chaining Javascript functions on the onClick event. JTT applications that run OA Pages in embedded mode cannot use the "Warn About Changes" feature.
Related Information
BLAF UI Guidelines Save Model [ OTN Version ] OA Framework Developer's Guide Declarative Submit Form HGrid Gantt Javadoc oracle.apps.fnd.framework.webui.OAPageContext oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean oracle.apps.fnd.framework.webui.beans.OAStaticStyledTextBean oracle.apps.fnd.framework.webui.beans.OAImageBean oracle.apps.fnd.framework.webui.beans.nav.OALinkBean oracle.apps.fnd.framework.webui.beans.nav.OAButtonBean oracle.apps.fnd.framework.webui.beans.nav.OASideNavBarBean oracle.apps.fnd.framework.webui.beans.message.OAMessageCheckBoxBean oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean oracle.apps.fnd.framework.webui.beans.message.OAMessageDateFieldBean 413
oracle.apps.fnd.framework.webui.beans.message.OAMessageListBean oracle.apps.fnd.framework.webui.beans.message.OAMessageLovChoiceBean oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean oracle.apps.fnd.framework.webui.beans.message.OAMessageRadioButtonBean oracle.apps.fnd.framework.webui.beans.message.OAMessageRadioGroupBean oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
414
Search
Overview
Primary Search Regions
The Oracle Browser Look-and-Feel (BLAF) UI Guideline: Search and Query Templates [ OTN Version ] describes the following core design options for searching: Simple Search - presents users with a limited number of basic search criteria (usually 1 - 4 fields) with an optional hide/show control to view additional search criteria. Advanced Search - presents users with extensive search criteria and power search capabilities including the ability to declaratively specify "AND" or "OR" searches and datatype-specific operators on individual fields (for example, a "Salary" value must be greater than 100000). (User Personalizable) Views - presents users with a personalizable list of saved, named searches. Runtime Control - OAQueryBean - describes special instructions for manipulating the query region at runtime. Multiple Query Regions - describes special instructions for displaying multiple query regions on a single page. In all cases, these regions are presented on the same page with the associated results as shown in the following illustration of a simple search: Figure 1: Example of a simple search and results table on the same page
The Simple Search, Advanced Search and user-personalizable Views can be displayed individually or in combination to provide extremely flexible searching on a list of objects. Figure 2 shows how the user would toggle between these search panels if all three are enabled in a single page. Figure 2: toggle navigation between a Simple Search, Advanced Search and user-personalizable Views region on the same page
415
none
OA Framework displays an error message instead of executing the query if the underlying view object has pending changes. The search regions are rendered based on The underlying search must be the Simple Search and Advanced Search executed by the developer. regions that you define and specify as named children of the query region. Note that you must implement your own "Go" button in this mode.
Detailed instructions for implementing the Simple Search, Advanced Search and Views option are provided below.
Simple Search
As described above, a Simple Search displays a small number of search criteria items in a constrained format as shown in Figures 5 and 6 below. If you need to implement a simple list of items that map directly to the associated table columns, you can leverage the query bean to quickly configure a fully automated search. See the Declarative Implementation: Results Based Search for instructions. If you need to implement a simple search with custom items, and you need to manipulate the search itself (for example, the user selects a poplist value that must be translated to a particular date range) you can use the query bean with your custom query handling. See the Declarative Implementation: Auto Customization Criteria. Note that the custom Simple Search panel that you create must be a messageComponentLayout region. If you need to implement the search field with a poplist of search attributes, or if you need to implement the Hide/Show More Search Options design, you cannot use the query bean. See the Declarative Implementation: Manual Search for instructions. The None mode is provided for backward compatibility. For any new query regions that you create, the Results Based Search and Auto Customization Criteria options should satisfy all of your requirements. Figure 5: Example of valid Simple Search region designs per the BLAF UI Guidelines. Figure 6: Example of valid Simple Search regions with "Show More Search Options" hide/show controls.
Set the region's Style to query, specify an ID that complies with the OA Framework File Standards (all regions and items that you create must comply with these standards) and set the following properties: Construction Mode - set to resultsBasedSearch Include Simple Panel - set to True Initial Panel - if you include the Advanced Search and/or Views option, specify the initial display panel Simple Search Instructions - instruction text for the simple search region Simple Button Label - if you include the Advanced Search and/or Views option, specify the label of the button that the OA Framework renders for toggling to the simple search (the default label is "Simple Search") Note that, in the Results Based Search mode, the OA Framework automatically generates a "Simple Search" header for you at runtime to contain the query region. There is no need for you to add this to the component hierarchy yourself. Step 3: Select your query region in the structure pane, right-click and select New > Region Using Wizard to quickly create your table or hgrid search results regions. Remember to give the region a standards-compliant ID and specify appropriate attribute sets for the associated items. See the Tables and HGrid documentation for additional information about creating these components (this is particularly important for the HGrid as there are additional properties that you must set on that component to properly enable searching). Figure 7 illustrates a typical Results Based Search structure. Figure 7: Example of a Results Based Search structure in the ToolBox Sample Library.
Step 4: Select the table/hgrid region that you created in Step 3 and set the Search Allowed property to True for any items that should be used as search criteria. These items are automatically included in the Simple Search region according to the rules described below, and the OA Framework automatically executes the corresponding query when the user selects the Go button. If the searchable table item is a poplist, the corresponding search region item is the same poplist. If the searchable table item is a text input field, the corresponding search region item is a text input field or a date field as appropriate based on the column's datatype. If the searchable table item is an LOV text input field, the corresponding search region item is the same (with the same LOV definition). If the searchable table item is a display-only value (like a messageStyledText, a raw text, a formatted 419
text and so on), the OA Framework generates a text input field or date input filed as appropriate based on the column's datatype. Step 5: Set the Selective Search Criteria property to True for any search criteria items that ensure a performant query (see the OA Framework View Coding Standards for additional information about this). Note that the OA Framework treats these values as being individually required: if the user enters any one of the required items, the query can proceed. You currently cannot require that the user enter search criteria in more than one of these required items. As shown in Figure 8 below, if the user fails to specify at least one of the required search values, an error message displays with the list of candidate items so the user can enter a value and proceed with the search. Figure 8: Example of an error displayed when the user fails to enter a value for at least one of the "Selective Search Criteria" items in the simple search (note that the actual error message may differ slightly).
Note that the OA Framework treats these values as being individually required: if the user enters any one of the required items, the query can proceed. You currently cannot require that the user enter search criteria in more than one of these required items. As shown in Figure 8 above, if the user fails to specify at least one of the required search values, an error message displays with the list of candidate items so the user can enter a value and proceed with the search. Step 5: Create the query mappings between your custom Simple Search region and the table columns so the OA Framework can automatically execute the search when the user selects the Go button. Note: If you need to perform the mapping programmatically (for example, you derive a date range WHERE clause based on a poplist value of "ANY_TIME," "LAST_2_WEEKS," "LAST_MONTH" and so on) you should skip this step and implement the search execution as described in Runtime Control: OAQueryBean below. Step 5.1 Select your query region in the Structure pane, right-click and select New > simpleSearchMappings. Step 5.2 Configure the default mapping that JDeveloper creates for you to identify the item in the search region whose value should be used to query which item (table column) in the results region. Step 5.3 (optional) If you have more than one mapping, select the simpleSearchMapping node in the Structure pane, right-click and select New > queryCriteriaMap. Configure the node as you did in Step 7.2. Repeat as needed until all your search criteria items are mapped to results table/hgrid items. Figure 9 illustrates a Simple Search page structure created in Auto Customization Criteria mode. Figure 9: Example of an Auto Customization Criteria Simple Search structure in the OA Framework ToolBox Sample Library.
421
Manual Search
If you need to build a Search region that cannot be implemented with the query bean (you should always use the query bean if possible), follow these steps: Step 1: Create the view object that you will use for searching and add it to your page's application module. Bind the results items to this view object. Step 2: Create the layout for your search region (remember that your region should have a header with the title "Search"). If you need help with this task, see Page Layout (How to Place Content). Also see Hide/Show if you want to add a "Show More Options" to your search. Remember that the Go button should be a submitButton so the form is submitted when the user selects it. Step 3: Set the Selective Search Criteria property to True for any search criteria items that ensure a performant query (see the OA Framework View Coding Standards for additional information about this). Note that the OA Framework treats these values as being individually required: if the user enters any one of the required items, the query can proceed. You currently cannot require that the user enter search criteria in more than one of these required items. Step 4: Between your Search region and your results region, add a separator item as required by the BLAF guidelines. Figure 10 shows a typical Search page structure. Figure 10: Example of manually configured Search region from the OA Framework ToolBox Tutorial
Step 5: Add an initQuery() method to your view object to handle binding the incoming search criteria to the view object's WHERE clause. Note: Although you can manipulate the WHERE clause in your initQuery() method in addition to binding search parameters, for performance reasons, you should ideally include a static WHERE clause in your view object definition. You should make dynamic changes to the WHERE clause only if this is absolutely necessary due to the complexity and variety of the search criteria. The following example from the PoSimpleSummaryVOImpl in the OA Framework ToolBox shows an appropriate use case for WHERE clause manipulation, and is included to demonstrate the correct way to bind a dynamic number of parameters using Oracle-style binding. It also demonstrates the use of a Boolean executeQuery parameter to control whether this view object should explicitly query itself, or defer to the OA Framework's table handling (see View Objects in Detail -> Initialization Guidelines for additional information 422
about this). import java.util.Vector; import oracle.bali.share.util.IntegerUtils; import oracle.jbo.domain.Number; import oracle.apps.fnd.framework.OANLSServices; import oracle.apps.fnd.framework.server.OADBTransaction; import oracle.apps.fnd.framework.server.OAViewObjectImpl; ... public void initQuery(String orderNumber, String created, String showMyOrders, Boolean executeQuery) { StringBuffer whereClause = new StringBuffer(100); Vector parameters = new Vector(3); int clauseCount = 0; int bindCount = 0; setWhereClauseParams(null); // Always reset // Note that the use of Oracle-style bindings, while requiring a bit // more effort than the ANSI-style binding, is REQUIRED of framework // code. if ((orderNumber != null) && (!("".equals(orderNumber.trim())))) { Number orderNum = null; try { orderNum = new Number(orderNumber); } catch(Exception e) {} whereClause.append(" ORDER_NUMBER = :"); whereClause.append(++bindCount); parameters.addElement(orderNum); clauseCount++; } if ((created != null) && (!("".equals(created.trim()))) && (!("ANY".equals(created)))) { if (clauseCount > 0) { whereClause.append(" AND "); } whereClause.append(" CREATION_DATE >= :"); whereClause.append(++bindCount); whereClause.append(" - :"); whereClause.append(++bindCount); parameters.addElement(getClientSysdate()); parameters.addElement(getDaysToSubtract(created)); clauseCount++; } if ((showMyOrders != null) && (!("".equals(showMyOrders.trim())))) { // Ordinarily, you would set this value based on the current user. // Since the tutorial has its own data model for users, we'll // set this to the seeded buyer's ID. 423
if (clauseCount > 0) { whereClause.append(" AND "); } whereClause.append(" BUYER_ID = :"); whereClause.append(++bindCount); parameters.addElement(IntegerUtils.getInteger(6)); // 6 is the seeded buyer employee clauseCount++; } setWhereClause(whereClause.toString()); if (bindCount > 0) { Object[] params = new Object[bindCount]; // The copyInto() is 1.1.8 compliant which, as of 07/2004, is required by ARU parameters.copyInto(params); setWhereClauseParams(params); } if ((executeQuery != null) && (executeQuery.booleanValue())) { executeQuery(); } } // end initQuery() protected java.sql.Date getClientSysdate() { OADBTransaction txn = (OADBTransaction)getApplicationModule().getTransaction(); OANLSServices nls = txn.getOANLSServices(); oracle.jbo.domain.Date serverDate = txn.getCurrentDBDate(); java.util.Date javaClientDate = nls.getUserDate(serverDate); long longDate = javaClientDate.getTime(); return new java.sql.Date(longDate); } // end getclientSysdate() protected Integer getDaysToSubtract(String created) { int days = 0; if ("TODAY".equals(created)) { days = 0; } else if ("THIS_WEEK".equals(created)) { days = 6; } else if ("LAST_30_DAYS".equals(created)) { days = 29; } else if ("LAST_60_DAYS".equals(created)) 424
{ days = 59; } return IntegerUtils.getInteger(days); } // end getDaysToSubtract() Step 6: Add an initQuery() method to your application module that delegates to your view object's initQuery() method. Note that you can give this method an explicit name if your application module has multiple query initialization methods (for example, initEmployeeSummary(), initEmployeeDetails(), initDeparementSummary(), initDepartmentDetails() and so on). The application module initQuery() method that delegates to the initQuery() method shown in the previous steps looks like: public void initSummary(String orderNumber, String created, String showMyOrders, Boolean executeQuery) { PoSimpleSummaryVOImpl vo = getPoSimpleSummaryVO1(); if (vo == null) { MessageToken[] tokens = { new MessageToken("OBJECT_NAME","PoSimpleSummaryVO1")}; throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND",tokens); } vo.initQuery(orderNumber, created, showMyOrders, executeQuery); } // end initSummary() Step 7: Add controller processFormRequest() logic to handle the Search region's Go button press. The following example shows how to call the initSummary() method shown in the previous step. Since our query results are displayed in a table, note the call to the queryData() method at the bottom of the controller (the reasons for this are fully described in View Objects in Detail -> Initialization Guidelines). import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.webui.OAQueryUtils; ... public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { supper.processFormRequest(pageContext, webBean); // If the "Go" parameter value is not null, the user selected the "Go" submitButton. if (pageContext.getParameter("Go") != null) { // To complete the Selective Search Criteria implementation that you started above, // you must also perform the following test. Note that the webBean parameter // that you pass to the checkSelectiveSearchCriteria() // method MUST be the direct parent region containing the items for which you have // set the Selective Search Criteria property to True. If this test fails, the 425
// OA Framework displays the exception message described above and your query // is not executed. OAQueryUtils.checkSelectiveSearchCriteria(pageContext, webBean); // Get String String String the user's search criteria from the request. orderNumber = pageContext.getParameter("SearchOrder"); created = pageContext.getParameter("Created"); showMyOrders = pageContext.getParameter("MyOrders");
OAApplicationModule am = getApplicationModule(webBean); // Note the following is required for viw object initialization standards // around tables. Boolean executeQuery = BooleanUtils.getBoolean(false); Serializable[] parameters = { orderNumber, created, showMyOrders, executeQuery }; // Since the parameters that we're passing include a non-String type, you must // call the version of invokeMethod() that lets you specify the individual // parameter types as shown. Class[] paramTypes = { String.class, String.class, String.class, Boolean.class }; am.invokeMethod("initSummary", parameters, paramTypes); OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.findChildRecursive("ResultsTable"); // When handling a user initiated search, we always need to execute // the query so we pass "false" to queryData(). table.queryData(pageContext, false); } }
Advanced Search
As described above, an Advanced Search displays extensive search criteria and power search capabilities including the ability to declaratively specify "AND" or "OR" searches and datatype-specific operators on individual fields (for example, a "Salary" value must be greater than 100000). Note that the OA Framework implements this search region using the oracle.apps.fnd.framework.webui.beans.layout.OAAdvancedSearchBean. The resulting UI appears as shown in Figure 11. Figure 11: Example of an Advanced Search panel from the OA Framework ToolBox Sample Library
426
If you need to implement searches on items that map directly to the associated table columns, you can leverage the query bean to quickly configure a fully automated search. See the Declarative Implementation: Results Based Search for instructions. If you need to implement a standard advanced search, but you need to manipulate the search itself (for an intermedia search, for example) you can use the query bean with your custom query handling. See the Declarative Implementation: Auto Customization Criteria. If you need to implement an Advanced Search layout that differs from the OA Framework OAAdvancedSearchBean layout, you need to implement this manually. Note for Oracle's internal E-Business Suite developers: If you need to implement an intermedia search, please contact the Oracle Applications Performance Tuning team.
quickly create your table or hgrid search results regions. Remember to give the region a standards-compliant ID and specify appropriate attribute sets for the associated items. See the Tables and HGrid documentation for additional information about creating these components (this is particularly important for the HGrid as there are additional properties that you must set on that component to properly enable searching). Note that, in the Results Based Search mode, the OA Framework automatically generates a "Advanced Search" header for you at runtime to contain the query region. There is no need for you to add this to the component hierarchy yourself. Step 4: Select the table/hgrid region that you created in Step 3 and set the Search Allowed property to True for any items that should be used as search criteria. These items are automatically included in the Advanced Search region's search criteria poplists, and the OA Framework automatically executes the corresponding query when the user selects the Go button. Step 5: Set the Selective Search Criteria property to True for any search criteria items that ensure a performant query (see the OA Framework View Coding Standards for additional information about this). Note that the OA Framework treats these values as being individually required: if the user enters any one of the required items, the query can proceed. You currently cannot require that the user enter search criteria in more than one of these required items. As shown in Figure 12 below, if the user fails to specify at least one of the required search values, an error message displays with the list of candidate items so the user can enter a value and proceed with the search. Note that the error message for the advanced search differs from the simple search. Figure 12: Advanced search selective search criteria error message (note that the actual error message may differ slightly).
Step 4.2 Select the header region in the Structure pane, right-click and select New > advancedSearch. Give the resulting advancedSearch region a standards-complaint ID. Note that JDeveloper creates a criteria node and a default criteriaRow node with two items beneath it. Step 4.3 Configure the default criteriaRow for the first search criteria value you want to display: Give the criteriaRow node a meaningful ID as shown in Figure 11 below. In the first item that JDeveloper creates for you, specify the search criteria Prompt. Configure the second messageTextInput item for the criteria value. Specify a standards-compliant ID and apply an appropriate Attribute Set. Make sure you select the correct Data Type value (this drives the "Conditions" poplist that the OA Framework creates for you). Also, set the Selective Search Criteria property to True for any search criteria items that ensure a performant query (see the OA Framework View Coding Standards for additional information about this). Note that the OA Framework treats these values as being individually required: if the user enters any one of the required items, the query can proceed. You currently cannot require that the user enter search criteria in more than one of these required items. Finally, set the Addtional Text value to the same value that set for the search criteria Prompt (this is required per the Accessibility guidelines). As shown in Figure 8 above, if the user fails to specify at least one of the required search values, an error message displays with the list of candidate items so the user can enter a value and proceed with the search. Step 4.3 If you have additional seach criteria, select the criteria node in the Structure pane, right-click and select New > criteriaRow for each search criteria item you want to add. Repeat step 4.3 to configure each criteria row. Step 5: Create the query mappings between your custom Advanced Search region and the table columns so the OA Framework can automatically execute the search when the user selects the Go button. Step 5.1 Select your query region in the Structure pane, right-click and select New > advancedSearchMappings. Step 5.2 Configure the default mapping that JDeveloper creates for you to identify the item in the search region whose value should be used to query which item (table column) in the results region. Step 5.3 (optional) If you have more than one mapping, select the advancedSearchMapping node in the Structure pane, right-click and select New > queryCriteriaMap. Configure the node as you did in Step 5.2. Repeat as needed until all your search criteria items are mapped to results table/hgrid items. Figure 13 illustrates an Advanced Search page structure created in Auto Customization Criteria mode. Figure 13: example of an Auto Customization Criteria Advanced Search structure in the OA Framework ToolBox Sample Library
429
Manual Search
If you need to build an Advanced Search region that cannot be implemented with the query bean (you should always use the query bean if possible), follow the steps outlined in the Simple Manual Search section above.
Implementation
Step 1: Create the view object that you will use for searching. Note that, in this mode, there is no need for you 430
to create an initQuery() method on the view object (to set the WHERE clause, bind the search criteria and execute the query) since the OA Framework handles this on your behalf. Tip: If your view object's definition requires bind values, or you must manually append an unrelated WHERE clause yourself every time the query is executed, you can proceed in one of two ways. In either scenario, the OA Framework will append the user's search criteria to the WHERE clause immediately before executing the query, so any WHERE clause characteristics that you define are preserved. 1. Override the executeQuery() method in your *VOImpl to modify your WHERE clause, and then call super.executeQuery(). This is recommended if you exercise the same logic every time the view object is queried. 2. You can also handle the generated Go button's press and call an initQuery() method on your view object where you can modify the WHERE clause and/or set bind values. Step 2: Select your pageLayout region in the JDeveloper Structure pane, right-click and select New > Region. Set the Style to query, specify an ID that complies with the OA Framework File Standards (all regions and items that you create must comply with these standards) and set the following properties: Construction Mode - This has no effect in the views panel and applies to the simple and the avanced search panels only. Include Views Panel - set to True Initial Panel - if you include the Simple Search and/or Advanced Search options, specify the initial display panel Views Button Label -if you include the Advanced Search and/or Simple Search, specify the label of the button that the OA Framework renders for toggling to the Views region Views Panel Instructions - specify the instruction text for the Views region Views Panel Title - specify an alternate title if required. The default title is "Views". Save Search Button Text - specify the text to display on the Save Search button (the default label is Save Search). Step 3: Select your query region in the structure pane, right-click and select New > Region Using Wizard to quickly create your table or hgrid search results regions. Remember to give the region a standards-compliant ID and specify appropriate attribute sets for the associated items. See the Tables and HGrid documentation for additional information about creating these components (this is particularly important for the HGrid as there are additional properties that you must set on that component to properly enable searching). Step 4: Select the table/hgrid region that you created in Step 3 and set its User Personalization property to True. Step 5: Select the table/hgrid region that you created above and set each item's User Personalization property to True if the item should be personalizable (meaning the user can configure its display properties in the underlying table/hgrid and specify search criteria for the associated column value). Set its Search Allowed property to True if you want the user to be able to filter the search on the item's value. Note: If the item is administrator personalizable, he or she could change the Search Allowed property to True even if you set it to False. Step 6: Save your work. Step 7 (optional): If you need to do special view processing (like binding additional query criteria) you normally handle this in processFormRequest() as shown in the Runtime Control section below. If, however, the user creates a new view and opts to immediately use it by selecting the Apply and View Results button in the Personalization module, you also need to add the following processRequest() logic that checks the CUST_ANVR_VIEWID attribute value: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); ... OAQueryBean queryBean = (OAQueryBean)pageContext.findIndexedChildRecursive("Query"); String viewId = queryBean.getAttributeValue(OAWebBeanConstants.CUST_ANVR_VIEWID); 431
// If viewId is not null, then the user selected the "Apply and View Results" // button and the new view she just created is now the current view. Note that // this is the same viewId value that is returned when you call // queryBean.getCurrentCustomization() in processFormRequest(). If the // viewId value is null, this is the normal page flow. if (viewId != null) { ... } } Step 8: Make sure the Disable Self-service Personal profile option is set to No at the site or application level as appropriate for your page. If this is set to Yes, the Views option will not be accessible to the user even if it is properly enabled (if the Search region does not include either Simple or Advanced Search options, the Views option will render but the Views poplist will be empty).
starts with ends with contains before after greater than PROJECT_STATUS projectName startDate
like like like < > > projectName (Data type VARCHAR2)
SECURITY START_DATE
Rule 1: If your viewattribute is of type Number, Date, or DateTime, then the OA Framework generates a simple where clause using the CRITERIA_CONDITION based on the CRITERIA_VALUE. So, in the example above, the where clause for the "projectId" view attribute is generated as: PROJECT_ID = 101 and the where clause for the "startDate" view attribute is generated as: START_DATE > "1/1/03" The OA Framework finds the right database column correspond to a view attribute even if you use aliases. Rule 2 : If your view attribute is of type String(VARCHAR2), and if item has the Selective Search Criteria property set to false, then the OA Framework generates a case-insensitive simple where clause based on the CRITERIA_CONDITION and the CRITERIA_VALUE. So, in the above example, the where clause for the status view attribute is generated as: UPPER(PROJECT_STATUS) like UPPER('%Approved%') Rule 3: If your view attribute is of type String(VARCHAR2), and if the item has the Selective Search Criteria property set to true, then the OA Framework generates a case-insensitive where clause using a four-way join to ensure that the index is used.
Here are the steps that you should follow if you plan on using one of the methods above: Step 1: Determine the method to use. Determine whether you want to handle the entire criteria or the criteria for subset of attributes that donot really belong to the table, but is something that you would like to search on. You should use the getCriteria() method for the former case and the getNonViewAttrCriteria() method for the latter case. Step 2: Define the searchable field in the search panels. Define the item as a searchable field in the simple an/or the advanced search panels. For our example, let us define the following fields: 433
projectIdSimpleSearch on the simple search panel. projectIdAdvSearch on the advanced search panel. Step 3: Using the getNonViewAttrCriteria() method. Let us modify the above example, and state that projectId is a field that is not present on the viewobject (and not displayed in the results table), but is still something you want to search on. Option 1 - You should use this option if you want to search on a specific field, but not save its search as a user personalization view. In this case, you want to process this field in the simple and/or the advanced search panel only. Step 3.1: Do not define any simple or advanced search mappings for this field. Step 3.2: Handle the go button press in your query region's controller's processFormRequest() using: processFormRequest (OAPageContext pageContext, OAWebBean webBean){ // Make sure that you are in the right panel String currentPanel = pageContext.getCurrentSearchPanel(); // Handle the "Go" button click on the simple search panel if (SEARCH.equals (currentPanel) && pageContext.getGoButtonName() != null) { // retrieve your item and process it here. String value = pageContext.getParameter (<projectIdSimpleSearch>); // Build the appropriate where clause for projectIdSimpleSearch // and set it on your vo and execute its query // using the initQuery method. ... } // Handle the "Go" button click on the advanced search panel if (ADVANCED_SEARCH.equals (currentPanel) && pageContext.getGoButtonName() != null) { // retrieve your item and process it here. String value = pageContext.getParameter(<projectIdAdvSearch>); // build the appropriate where clause for projectIdAdvSearch // and set it on your vo and execute its query // using the initQuery method. ... }} The table belists the constants that you can use to determine your current search panel. All constants are defined in the oracle.apps.fnd.framework.webui.OAWebBeanConstants class. Constant Name Current Panel OAWebBeanConstants.SEARCH Simple Search Panel OAWebBeanConstants.ADVANCED_SEARCH AdvancedSearchPanel OAWebBeanConstants.CUSTOMIZE Views panel. Option 2 - You should use this option if you want to search on a specific field and save its search as a user personalization view. Note that in this case, you should process this field in the views panel in addition to the simple and/or advanced search panel. Step 3.1: Define an associated hidden field (oa:formValue) in the table region, with its userCustomizable property set to true and viewUsageName and viewAttributeName set to null. For our example, define a hidden field with its id set to projectId in the table region. Step 3.2: Add the appropriate mappings for this field: this includes the simple and/or the advanced search mappings. For our example, let us add both a simple and an advanced search mapping for the projectId table field: Simple Search mapping -- Search item:projectIdSimpleSearch; Results item: projectId Advanced search mapping -- Search item: projectIdAdvSearch; Results item: projectId 434
Step 3.4: Handle the criteria dictionary and build your where clause for the projectId attribute public void processFormRequest (OAPageContext pageContext, OAWebBean webBean) { // Find the current panel String currentPanel = pageContext.getCurrentSearchPanel(); // if you are on the search or the advanced search panels, // handle the criteria on the Go button press. if ((SEARCH.equals(currentPanel) || ADVANCED_SEARCH.equals(currentPanel)) && pageContext.getGoButtonName() != null) { handleCriteria (pageContext, webBean); }
// If you are on the views panel, handle the criteria on the personalize go // button press. if ((CUSTOMIZE.equals(currentPanel) && pageContext.getPersonalizeGoButtonName() != null) { handleCriteria (pageContext, webBean); } }
public void handleCriteria (OAPageContext pageContext, OAWebBean webBean) { OAQueryBean queryBean = (OAQueryBean) webBean; // This gives you the current non-view attribute criteria Dictionary[] dic = queryBean.getNonViewAttrCriteria(pageContext); // If the dictionary is empty, then it means that no non-view criteria // is available, so return. if (dic == null || dic.isEmpty()) return; // Otherwise process the dictionary to build your where clause. int size = dic.length; // Iterate through the dictionary to set your where clauses for (int i=0; i < dictSize; i++) { // Item for which the criteria is defined. String itemName = (String) dic[i].get(OAViewObject.CRITERIA_ITEM_NAME); // Condition is the SQL condition - examples: like , = etc String condition = (String) dic[i].get(OAViewObject.CRITERIA_CONDITION); // Value is the value entered with the appropriate % based on condition Object value = dic[i].get(OAViewObject.CRITERIA_VALUE); // Join condition is either AND or OR depending on what user chooses String joinCondition = (String) dic[i].get(OAViewObject.CRITERIA_JOIN_CONDITION); // You can use the following pieces of code if you need to find the actual 435
// database column name of the item. String viewAttributeName = (String) dic[i].get(CRITERIA_VIEW_ATTRIBUTE_NAME); String columnName = vo.findAttributeDef(viewAttributeName).getColumnNameForQuery(); // Now use the above information to build your where clause. String whereClause = ... // Finally invoke a custom method on your view object to set the where clause // you should not execute the query if you call getNonViewAttrCriteria. // where clause } Step 3.5: Repeat the code above that handles the criteria in the views panel in your processRequest() in order to handle the criteria associated with the default personalization (if any). public void processRequest (OAPageContext pageContext, OAWebBean webBean) { OAQueryBean queryBean = (OAQueryBean) webBean;
// Find the current panel String currentPanel = pageContext.getCurrentSearchPanel(); // If you are on the views panel, handle the criteria // for the default personalization if ((CUSTOMIZE.equals(currentPanel) && queryBean.getDefaultCustomization() != null) { handleCriteria (pageContext, webBean); } } Step 4: Using the getCriteria() method This is very similar to the Option 2 - getNonViewAttrCriteria, but the key difference being that the getCriteria() method returns the complete criteria defined by the user. The code sample above holds good as well.
OAQueryBean query1 = (OAQueryBean) webBean.findIndexedChildRecursive("queryRegion1"); query1.setAdvancedSearchButtonName("AdvancedSearch1"); query1.setClearButtonName("ClearButton1"); query1.setGoButtonName("GoButton1"); query1.setPersonalizationsPoplistName("PersPoplist1"); query1.setPersonalizeButtonName("PersButton1"); query1.setPersonalizeGoButtonName("PersGoButton1"); query1.setSaveSearchButtonName("SaveSearchButton1"); query1.setSaveSearchButtonText("Save Search 1"); 436
query1.setSimpleSearchButtonName("SimpleSearch1"); query1.setViewPersonalizationsButtonName("ViewPersButton1"); query1.setAddPoplistName("AddPoplist1"); query1.setAddButtonName("AddButton1"); query1.setAdvRadioGroupName("RadioGroup1"); OAQueryBean query2 = (OAQueryBean) webBean.findIndexedChildRecursive("queryRegion2"); query2.setAdvancedSearchButtonName("AdvancedSearch2"); query2.setClearButtonName("ClearButton2"); query2.setGoButtonName("GoButton2"); query2.setPersonalizationsPoplistName("PersPoplist2"); query2.setPersonalizeButtonName("PersButton2"); query2.setPersonalizeGoButtonName("PersGoButton2"); query2.setSaveSearchButtonName("SaveSearchButton2"); query2.setSaveSearchButtonText("Save Search 2"); query2.setSimpleSearchButtonName("SimpleSearch2"); query2.setViewPersonalizationsButtonName("ViewPersButton2"); query2.setAddPoplistName("AddPoplist2"); query2.setAddButtonName("AddButton2"); query2.setAdvRadioGroupName("RadioGroup2"); // In each subsequent query region after the first, add this line of code // to ensure that the OA Framework to properly name the criteria items. query2.setAttributeValue(OAWebBeanConstants.IS_NON_FIRST, Boolean.TRUE); }
Quick Search
Declarative Implementation
You cannot implement the Quick Search declaratively (you cannot select the appropriate beans for the Quick Search region, and you can't set the Quick Search region on the pageLayout).
Runtime Control
Instantiate Quick Search To create a Quick Search and associate it with a page, do the following: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAPageLayoutBean pageLayout = pageContext.getPageLayout();
// Note that there's no need to call prepareForRendering() when setting the // Quick Search component since the OA Framework doesn't manipulate it in // any way.
pageLayout.setQuickSearch(quickSearchRN); } Handle Go Button Press To handle the Go button press, see the basic search implementation instructions in the Simple Search's 437
To implement the side navigation Search region as shown in Figure 13 above: Step 1: Create the reusable Search region. Select File > New from the main JDeveloper menu. Step 1.1 In the New dialog, expand the Web Tier node, select OA Components and then select Region from the Items list. Select the OK button. Step 1.2 In the New Region dialog, enter a name that complies with the OA Framework File Standards, select the package and set the style to header. Select the OK button. Step 2: Select your header region in the JDeveloper Structure pane, right-click and select New > Region. Give this region a standards-compliant ID and set its Region Style to messageComponentLayout. Step 3: Select your messageComponentLayout region, right-click and select New > Item. Give this item a standards-compliant ID and set its Style to messageChoice. Configure the poplist to query a list of objects (see Standard Web Widgets for information about creating poplists), and set its Prompt to Objects. Step 4: Select the messageComponentLayout region again, right-click and select New > Item. Configure this messageTextInput field as described in Standard Web Widgets. Note that you should not specify a Prompt property for this field, but you should set its Additional Text value for accessibility compliance. Finally, set the Length to a reasonable value (this example is 15) so the side navigation does not render overly wide. Step 5: Select your messageComponentLayout region in the JDeveloper Structure pane, right-click and select New > Region. Give this region a standards-compliant ID and set its Region Style to messageLayout. Step 6: Select your messageLayout region, right-click and select New > Item. Give this item a standardscompliant ID and set its Style to submitButton. Set the Attribute Set to the standard OA Framework Button attribute set /oracle/apps/fnd/attributesets/Buttons/Go. Step 7: To associate a declaratively defined search region with a side navigation, do the following in a pagelevel controller: public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); // Instantiate a side navigation component. OASideNavBean sideNav = 438
(OASideNavBean)createWebBean(pageContext, OAWebBeanConstants.SIDE_NAV_BEAN, null, "hpSideNav"); // Instantiate the declaratively defined search region. Note that the second // "create" parameter is the fully qualified name of the reusable search region. OAHeaderBean search = (OAHeaderBean)createWebBean(pageContext, "/oracle/apps/fnd/framework/toolbox/tutorial/webui/HomeSearchRN", "SearchRN", // every component needs a name true); // using JDeveloper OA Extension sideNav.addIndexedChild(search); // // // // You don't have to do anything to get the correct CSS style for the header text/line (this renders automatically based on the color of the background). You do have to set the header text size (this cannot be changed by using a CSS style).
search.setSize(2); // 2 is the smallest size // Get a handle to the page layout component and set its "start" to the // side navigation we created. OAPageLayoutBean pageLayout = pageContext.getPageLayoutBean; // Note that you must call prepareForRendering() before setting the start or it // won't render. pageLayout.prepareForRendering(); pageLayout.setStart(sideNav); } Step 8: If the underlying query is not restricted (meaning that the query includes a WHERE clause the results in a performant query), you must implement Selective Search Criteria. To do this, follow the procedure described in the Simple Search's Declarative Implementation: Manual Search section. Step 9: To handle the Go button press, see the basic search implementation instructions in the Simple Search's Runtime Control: Manual Search section.
Known Issues
When implementation the autoCustomizationCriteria mode for a query region, the custom simple and advanced search regions must reside in the same XML as the query and table regions. This restriction is required because the search regions mappings don't use a fully qualified ID; the IDs are assumed to be valid only within the current document. If you use setQuery() on a view object associated with the query bean results region, then you should also call vo.setFullSqlMode(FULLSQL_MODE_AUGMENTATION) on the view object. This ensures that the order by or the where clause that is generated by the OA Framework can be appended to your VO correctly. Due to timing issues, you should always use the controller on the query region for any OAQueryBean specific methods.
Related Information
BLAF UI Guidelines Search and Query Templates [ OTN Version ] Javadoc 439
oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean oracle.apps.fnd.framework.webui.beans.layout.OAAdvancedSearchBean OA Framework ToolBox Tutorial / Sample Library Search Lab oracle/apps/fnd/framework/toolbox/samplelib/webui/SearchRBSPG oracle/apps/fnd/framework/toolbox/samplelib/webui/SearchACCPG oracle/apps/fnd/framework/toolbox/tutorial/webui/PoSearchPG oracle/apps/fnd/framework/toolbox/tutorial/server/PoSimmpleSummaryVOImpl oracle/apps/fnd/framework/toolbox/tutorial/server/SearchAMImpl Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
440
Separator Line
Overview
Per the BLAF UI Guideline: Separator Line [ OTN Version ] specification, this visual component is used to divide contextual or static content from primary content on a page. It is commonly used with both the Locator Element: Train and Quick Links, although you don't need to explicitly add a separator in these cases (the underlying beans add it automatically). It is also used to delineate Contextual Information as shown in Figure 1 below. Figure 1: Example of contextual information and separator bean above primary page content
Declarative Implementation
If you need to add a separator to your page, follow these steps. The OA Framework will create an oracle.apps.fnd.framework.webui.beans.layout.OASeparatorBean. Step 1: Select the region to which you want to add the separator line, right-click and select New > Item. Set the item's Style to separator. Step 2: Set the separator's ID property in accordance the OA Framework File Standards.
Runtime Control
Warning: You should create web beans programmatically only if you cannot create them declaratively. Programmatically created web beans cannot be personalized, reused, or extended easily. See the OA Framework Controller Coding Standards for additional information about this and other guidelines that you should consider when writing web bean manipulation code.
Instantiate
There is little reason to manipulate this component programmatically. If you must instantiate an OASeparatorBean, call the appropriate createWebBean() factory method in the oracle.apps.fnd.framework.webui.OAControllerImpl class. If you select a signature that requires a constant to determine what kind of bean to create, use oracle.apps.fnd.framework.webui.OAWebBeanConstants.SEPARATOR_BEAN.
Known Issues
None
Related Information
BLAF UI Guidelines Separator Line [ OTN Version ] Developer's Guide Locator Element (Train) Contextual Information Quick Links OA Framework Package / File / Directory Standards Javadoc oracle.apps.fnd.framework.webui.beans.layout.OASeparatorBean 441
ToolBox Sample Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
442
Shuttle
Overview
As described in the BLAF UI Guideline: Shuttle and/or Reorder Controls [OTN version], the Shuttle and/or Reorder feature lets the user move items between two lists, and optionally reorder the items in the list(s). The main function of the Shuttle is to move items from one list to the other. When you implement a Shuttle region, you define two lists: A Leading list - typically titled "Available {ObjectType | Items}" A Trailing list - typically titled "Selected {ObjectType | Items}" You can implement the Shuttle region to optionally allow the user to reorder the contents of the Trailing list by using icons on the side of the Trailing list to move the selected items up to the top of the list, up one slot in the list, down to the bottom of the list, or down one slot in the list. Figure 1: Shuttle region with Reorder controls for the Trailing list.
If you wish to implement a Shuttle region with just one list, to achieve only Reorder functionality, then you need only define a Leading list. You can also optionally define buttons or icons in the footer below each of the Shuttle lists as shown in the Figure 2 below. These buttons or icons take up only one row below the lists with no wrapping. Simply define a Leading footer named child or Trailing footer named child in your Shuttle region. This automatically creates a flowLayout region by default, to which you can add a button or image. Figure 2: Shuttle region with buttons in the footer of each list.
443
Another variation you can implement is to display a description of a selected item beneath a Shuttle list, as shown in the Figure 3 below. Figure 3: Shuttle region that displays a description of selected content below each list.
Contents
Declarative Implementation Runtime Control Adding a Leading List Data Filter 444
Getting the Leading or Trailing List Caching Personalization Considerations Known Issues Related Information
Declarative Implementation
Following is a brief outline of the steps to create a Shuttle region. Step 1: Create a page with a pageLayout region using OA Extension. Make sure the Form property on the pageLayout region is set to True. Step 2: Select the pageLayout region in the Structure pane, and choose New > Region from the context menu. Set the following properties on this new region (Required properties are marked with *): *ID - set the shuttle's ID property in accordance with the OA Framework File / Package/ Directory Standards. *Region Style - set the region style to shuttle. Add Indexed Children - make sure this property is set to True, so that OA Framework automatically generates the web beans under this web bean hierarchy. The default is True. Available Header - specify the header text of the first (leading) list. Selected Header - specify the header text of the second (trailing) list. If you want to implement just one list for Reordering, that is, you do not want to shuttle items between two lists, then leave this property blank. Ordering Allowed - set to True if you want to enable ordering of the contents of the Selected (second or trailing) list. If you implement only one (leading) list in the shuttle region to create a Reordering region, then setting this property to True enables ordering on that leading list. The default is False. Step 3: The Shuttle region can have a maximum of two list web beans, referred to as the leading and trailing lists. The trailing list is omitted when you want to implement a shuttle region with a single list for the purpose of reordering the contents of that list. When you define a shuttle region, OA Extension automatically creates a leading component for you, which contains a single list item. Be sure to set the following properties on the list item (Required properties are marked with *): *ID - set the list's ID property in accordance with the OA Framework File / Package/ Directory Standards. *Multi-Select Allowed - set to True to allow the multiple selection of items in the list. The default is False. Picklist View Definition - specify the fully qualified view object name that is the data source to the List web bean. (For example, oracle.apps.fnd.framework.server.FndApplicationVO.) *Picklist View Instance - alternately specify a view instance name for the data source of the list, if the Picklist View Definition is not available. Note that setting this property overrides the Picklist View Definition property. (For example, FndApplicationVO, which needs to be present in the Application Module.) *Picklist Display Attribute - specify the view attribute name that serves as the displayed values of the list's content. *Picklist Value Attribute - specify the view attribute name that serves as the internal values of the list's content. This property, and not the Picklist Display Attribute property, uniquely identifies the elements in the list. Picklist Description Attribute - specify the view attribute name that serves as the descriptions of the list's content. Rendered - specify True to render this list. *List Height - specify the suggested display height of the list, in characters. The default is null. If this property is not set, the height is determined based on the lengths of both lists and their minimum and maximum values. The value should be in the range of 10 to 20. Note: The List Height is only a suggested value. Your browser application and UIX determines the final 445
height of the list based on the number of items in the list and the size of the browser window. Step 4: To create an optional trailing list, select the shuttle region in the Structure pane and choose New > trailing from the context menu. OA Extension automatically creates a trailing component for you, which contains a single list item. Refer to Step 3 for the list of properties that you should also set on the trailing list item. Make sure you specify names for the Picklist Display Attribute, Picklist Value Attribute and Picklist Description Attribute properties that match the corresponding property of the leading list item. Note: If you do not want to pre-populate the trailing list when the page initially renders, you can leave the Picklist View Definition, Picklist View Instance, Picklist Display Attribute, Picklist Value Attribute and Picklist Description Attribute blank. OA Framework takes care of retaining user selected values in the trailing list when the page refreshes. Note: The Picklist Value Attribute uniquely identifies the elements in a list, so if you want to pre-populate both the leading list and trailing list with data, be sure to set the Picklist Value Attribute property to a different value for each list. Setting this property to the same value for both lists will result in undesirable behaviour, such as causing the values in the leading list to disappear. Step 5: You can include buttons or icons in the footer of each list, as shown in Figure 2. Select the shuttle region in the Structure pane, and choose New > leadingFooter (for a footer in the leading list) or New > trailingFooter (for a footer in the trailing list). OA Extension automatically creates a leadingFooter or trailingFooter component, respectively, each containing a flowLayout region. You can then add your buttons or icons to this flowlayout region. Note: If you set the Rendered property to False for either the leading or trailing list, the leading or trailing footer also does not render, respectively. Since the footer is directly linked to its respective list, if the list is not rendered, the footer is irrelevant.
Runtime Control
There are no programmatic steps necessary to implement a basic Shuttle region as described above. There is also no need to execute the query on the view objects as OA Framework takes care of querying the view objects for you.
If you need to get a handle to the leading or trailing lists, you can call the findChildRecursive method on the Shuttle web bean. For example: OADefaultShuttleBean shuttle = ... OADefaultListBean leadingList = (OADefaultListBean)shuttleBean.findChildRecursive("myLeadingList"); On form submission, you can also obtain the option values present in the leading and trailing lists using the following methods: public String[] getLeadingListOptionValues(OAPageContext pageContext, OAWebBean webBean) public String[] getTrailingListOptionValues(OAPageContext pageContext, OAWebBean webBean For example, the following code sample returns an array of values in the trailing list, ordered according to the order in which they appear in the list: String[] trailingItems = shuttle.getTrailingListOptionValues(pageContext, shuttle);
Caching
Like a picklist, the lists in a Shuttle web bean also cache their initial values forever (that is, as static values in the JVM). If the initial data in a Shuttle's Leading or Trailing list can change during the lifetime of the JVM, you should disable caching on the Shuttle using the oracle.apps.fnd.framework.webui.beans.form.OADefaultListBean method setListCacheEnabled(boolean). For example, suppose you want to display a different set of data in the Shuttle's Leading list based on the value that is selected in a poplist associated with the Leading list. You would need to disable the caching for the list in the Shuttle, as illustrated in the following code sample: OADefaultListBean list = (OADefaultListBean)webBean.findChildRecursive("your list here"); list.setListCacheEnabled(false);
Personalization Considerations
See a summary of Shuttle personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guideline Shuttle and/or Reorder Controls [OTN version] Javadoc Files oracle.apps.fnd.framework.webui.beans.form.OADefaultShuttleBean oracle.apps.fnd.framework.webui.beans.form.OADefaultListBean Lesson(s) Sample Code Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
447
Related Information
The content below focuses on the basic instructions for creating and configuring these items. See the following documents for additional information related to special behaviors: If you need to change component properties at runtime (for example, you want to make a text entry field read only), see the Dynamic User Interface documentation for recommended approaches. If you want to enable partial page rendering (PPR) events when users interact with these components, also see the Dynamic User Interface documentation. If you want to configure some of these items to perform form submits when selected, see Submitting the Form. If you need to disable "save for changes" warnings for certain components, see the Save Model documentation. If you want to configure field-level hints or tips, see Inline Messaging and Tips. Finally, for a description of all the possible properties that you can set for each item type, see the OA Component Reference in the JDeveloper online Help. To access this, select Help > Help Topics from the main menu. In the Help Navigator window, expand the OA Component Reference and OA Item Styles nodes.
Text Field
Declarative Implementation
Data Entry Text Field Step 1: Create an item whose Item Style is messageTextInput (see the List of Values documentation if you want to create an LOV field; see the Date Picker documentation if you want to create a text field for dates). Assign an ID in accordance with the OA Framework Package / File / Directory standards. Step 2: Apply an attribute set as required by the OA Framework View Coding Standards. See Implementing the View for additional information about attribute sets. Step 3: Specify the Prompt (if not specified by the attribute set), indicate whether the field is Required, and set the CSS Class to OraFieldText. Note: If you have even one required item on your page, you must add the "Indicates required field" key as shown in Figure 1: Figure 1: Example of required and optional fields with the "indicates required field key"
448
To do this, create a region beneath your main content header and set the Extends property to oracle/apps/fnd/framework/webui/OAReqFieldDescRG and set its Width to 100%. Step 4: Ensure the Data Type value is correct, and that the Length is appropriate for the amount of data that you want to display (if you want to set a limit on the number of characters the user can enter, make sure the Maximum Length property is set correctly). Remember that Maximum Length should equal the corresponding database column length, while the Length property should be optimized for the UI. Step 5: If your text field reads and/or writes to an underlying data source, set the View Instance and View Attribute names for the underlying data source. Step 6 (optional): Set the Secret property to True if the field's data should be illegible (a password field is a common example of this). Step 7 (optional): Set the Initial Value property to specify a default value (see Defaulting in Implementing the View for an overview of valid defaulting approaches and how they are resolved at runtime). At runtime, the OA Framework instantiates an oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean. Display-Only Text Field If there's any reason for the field to be updateable in different use case scenarios, you could simply create a messageTextInput field and set its Read Only property to True. If the field is always display-only, it's better to create a messageStyledText item instead. In this case: Step 1: Apply an attribute set as required by the OA Framework View Coding Standards. See Implementing the View for additional information about attribute sets. Step 3: Specify the Prompt (if not specified by the attribute set) and set the CSS Class to OraDataText to ensure that it renders in bold. Step 3: Set the View Instance and View Attribute names for the underlying data source. Step 4: (optional) Set the Destination URI if you want this data value to render as a link. In this case, set the CSS Class property to OraLinkText. See Buttons (Links) for more information about working with links. At runtime, the OA Framework instantiates an oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean.
Text Area
Declarative Implementation
A text area is simply a messageTextInput item whose Height property is set to the number of text rows that you want to display. For example, the following item's Height property is set to 4. Note that you should also set the Vertical Alignment property to top to ensure that the prompt renders as shown. Figure 2: Example of a text area with a height of 4 and a vertical alignment of top. 449
Tip: The browser automatically sizes the poplist to accommodate the largest item. You cannot override the display width. You also cannot add a separator line between values in the poplist. This poplist is based a view object that queries lookup codes. The associated SQL statement shown below returns the values in the following table. SELECT lookup_code, meaning FROM fwk_tbx_lookup_codes_vl WHERE lookup_type = 'FWK_TBX_POSITIONS' Developer Key Display Value BUYER Buyer PRESIDENT President VICE_PRESIDENT Vice President SALES_REPRESENTATIVE Sales Representative DIRECTOR Director GROUP_MANAGER Group Manager
Declarative Implementation
Step 1: Create a view object to be used by your poplist. Per the OA Framework Package / File / Directory standards, you should create this object in a *.poplist.server package. For example, we created this ToolBox Tutorial PositionsVO poplist in the oracle.apps.fnd.framework.toolbox.poplist.server package. As described above, the view object should have two attributes: one for the poplist display value, and one for the internal developer key. Step 2: Create an item whose Item Style is messageChoice . Assign an ID in accordance with the OA Framework Package / File / Directory standards. 450
Step 3: Apply an attribute set as required by the OA Framework View Coding Standards. See Implementing the View for additional information about attribute sets. Step 4: Specify the Prompt (if not specified by the attribute set). Step 5: Specify the view object that you created in Step 1. If you want a poplist's data to be cached on the JVM, set the Picklist View Definition property to the fully qualified name of the view object definition. For example, oracle.apps.fnd.framework.toolbox.poplist.server.PositionsVO. Cached poplists are shared by all users of the JVM, and are identified by a unique key comprised of the entire poplist view object SQL query string, WHERE clause parameter values, language, and orgID. If you want your poplist to be used exclusively by the current session, set the Picklist View Instance property instead (for example, PoplistVO1). In this case, remember to add your poplist view object to the root UI application module for the page (or application module for the shared regions) that will include this poplist. See the Cache Invalidation topic below for additional instructions if you want to enable automatic updates to the poplist view object values when underlying database values change. Note that you can leverage cache invalidation for both kinds of poplists (cached on the JVM and private to the current session). Step 6: Map the poplist to its view object display and developer key attributes. Set the Picklist Display Attribute to the view object attribute whose value you want to display in the poplist. Set the Picklist Value Attribute to the view object attribute whose value you want to use as the internal developer key. To use our lookup code example above, we would set the Picklist Display Attribute to Meaning, and the Picklist Value Attribute to LookupCode. Step 7: (optional) If the poplist should read/write its selected value from an underlying data source, set the View Instance and View Attribute values accordingly as you would for any other data entry component. Note: The View Attribute value must correspond to the Picklist Value Attribute value. For example, assume you want to use the Positions poplist shown above in Figure 3 to assign a position while creating an employee. The Picklist Value Attribute should map to the LookupCode value. Similarly, the POSITION_CODE column (that you intend to update with the poplist selection) in the FWK_TBX_EMPLOYEES table stores a lookup code value. Step 8: Set the Initial Value if you want the poplist to render with a default selected value. Remember that this effectively performs a selection of the Picklist Value Attribute value, and must therefore be among a valid value for the underlying view object attribute. For example, VICE_PRESIDENT (the developer keys value that maps to the LookupCode view object attribute) is a valid value for the PositionsVO described here. Vice President (the display value that maps to the Meaning view object attribute) is not. Step 9: Set the Required property to yes if you want the required indicator to render for the poplist. If you don't want a blank option to render in this case, you should specify an Initial Value. Step 10: (optional): If you want to create a poplist without a required indicator and without a blank option, set the Required property to no and set the Add Blank Value property to False (by default, optional poplists include a blank value as shown in Figure 3 above). If you choose to suppress the blank value for an optional poplist, be sure to specify an Initial Value. Note that you can also set this value programmatically by calling the setAllowBlankValue(false) method on the oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean. Tip: If you set the Add Blank Value property to True on a poplist that you have designated as being required, and you specify a default value, the OA Framework ignores this setting. The combined Required and Initial Value settings take precedence. Cache Invalidation Prior to release 11.5.10, poplist data was cached on the middle tier in a proprietary OA Framework cache that could not be refreshed without bouncing the Java Virtual Machine (JVM). As a consequence, poplists could not reflect changes in the underlying data source while users were actively working. Starting with release 11.5.10, poplist data is cached using the Oracle Applications Java Caching Framework, and as a result, you can implement cache invalidation to automatically refresh poplists when the data they query changes. For example, 451
if a poplist queries the values A, B, C, and D, and a new value E is inserted in the underlying table, your poplist can automatically reflect the addition of this fifth value the next time it renders its data. Tip: Most poplists would benefit from this functionality. To implement poplist cache invalidation, the owner of the underlying database table must first perform these prerequisite steps (for example, the Applications Technology Group owns FND_LOOKUPS, and will be providing the following for this shared data): Note: For additional information on database invalidation, refer to section 3.4.5 Configuration for DB Invalidation Feature of the Oracle Applications Java Caching Framework. Prerequisite: Apply patch 3688496 to any environment in which you plan to deploy this caching functionality. Step 1: Create business event(s) using Oracle Workflow (please consult the Java Business Event System Developer's Guide for additional information). Typically, you should create distinct update, delete and insert events, although it is acceptable to create a subset of these events as appropriate for the table at hand. Step 2: As described in the Java Business Event System Developer's Guide, create the required wf_event.raise(...) API calls in PL/SQL. The p_event_name parameter must match one of the event names from Step 1. The p_event_key parameter must uniquely identify the poplist data being updated. For example, for FND_LOOKUPS, p_event_key would be a lookup type. The owner of the poplist must then implement the following two methods for the poplist's associated view object: /** * Returns the database event names that are raised when the database * data represented by this View Object is updated. * @return the database event name. */ public String[] getCacheEventNames(); Note: getCacheEventNames() must return the list of event names registered in Step 1 above. For example, if your view object is based on FND_LOOKUPS, the getCacheEventNames() method should be implemented to return the following: { "oracle.apps.fnd.lookup.type.update", "oracle.apps.fnd.lookup.type.delete", "oracle.apps.fnd.lookup.code.insert", "oracle.apps.fnd.lookup.code.update", "oracle.apps.fnd.lookup.code.delete" } /** * Returns the key that uniquely identifies the data in this view * object instance. * @Return the key that identifies the data. */ Public String getCacheKey(); Note: getCacheKey() must return the same value as the p_event_key parameter used for raising the data change events. For example, if your view object is based on FND_LOOKUPS, the getCacheKey() method should return the lookup type being selected by the view object.
Runtime Control
List Box
A list box lets a user select one or more values provided by an associated view object. By default, the list box lets users choose a single value; you can configure it to select multiple values as shown in the code example below. Figure 4: Example of a list box with one selected value.
452
As of 11.5.10, you must create list boxes programmatically using the oracle.apps.fnd.framework.webui.beans.form.OADefaultListBean as shown in the following example. import oracle.apps.fnd.framework.webui.beans.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.form.OADefaultListBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { // Always call first super.processRequest(pageContext, webBean); // Create the list bean (be sure to give it a name). OADefaultListBean list = (OADefaultListBean)createWebBean(pageContext, OAWebBeanConstants.DEFAULT_LIST_BEAN, null, "positionsList"); // Specify the view object that you will use to populate the list bean values. list.setListViewObjectDefinitionName("oracle.apps.fnd.framework.toolbox.poplist.s erver.PositionsVO"); // Specify the display and internal value attributes in the associated view object. list.setListValueAttribute("LookupCode"); list.setListDisplayAttribute("Meaning"); // Configure the list box to allow selection of multiple values. list.setMultiple(true); // Even though you created the component with an ID, you must explicitly // make this call to setName(). list.setName("posList"); // In this example, we're adding the list box to a messageComponentLayout region, so we // get the declaratively defined messageLayout region that will contain this // component. Note that we declaratively set a prompt for the list box on the // messageLayout region. OAMessageLayoutBean listBoxLayout = (OAMessageLayoutBean)webBean.findChildRecursive("ListBoxLayout"); listBoxLayout.addIndexedChild(list); } Note that you cannot simply add more items directly to the list box; it must obtain its values from a view object. If you don't want to query your view object values from the database, you can manually populate values in a transient view object as described in View Objects in Detail. To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method: OADefaultListBean list = 453
(OADefaultListBean)webBean.findChildRecursive("positionsList"); String name = list.getName(); String[] selectedValues = pageContext.getParameterValues(name); To retrieve all the values in the list box, call list.getOptionsData().
A radio group, on the other hand, is a bit like a poplist but it always renders as a vertical list of radio buttons. Figure 6: Example of a radio group displaying them mutually exclusive values for a payment terms view object.
appleButton.setName("fruitRadioGroup"); appleButton.setValue("APPLES"); OAMessageRadioButtonBean orangeButton = (OAMessageRadioButtonBean)webBean.findChildRecursive("GroupButtonTwo"); orangeButton.setName("fruitRadioGroup"); orangeButton.setValue("ORANGES"); OAMessageRadioButtonBean grapeButton = (OAMessageRadioButtonBean)webBean.findChildRecursive("GroupButtonThree"); grapeButton.setName("fruitRadioGroup"); grapeButton.setValue("GRAPES"); OAMessageRadioButtonBean plumButton = (OAMessageRadioButtonBean)webBean.findChildRecursive("GroupButtonFour"); plumButton.setName("fruitRadioGroup"); plumButton.setValue("PLUMS"); You can then obtain the selected radio button in your processFormRequest() as follows: String radioGroupValue = pageContext.getParameter("fruitRadioGroup"); Note: If you configure individual radio buttons as a group, never select more than one radio button declaratively or programmatically. In this case, only the last radio button selected renders as being selected.
Step 9: Set the Required property to yes if you want the required indicator to render for the radio group.
Checkbox
A checkbox is a simple widget that has a "selected" and an "unselected" state. You can add a single checkbox to a region, or you can add a group of checkboxes identified with a label as shown below. Figure 7: Example of a series of checkboxes rendered with a common label.
To add an individual checkbox to your page: Step 1: Create an item and set its Style to messageCheckBox. Assign an ID in accordance with the OA Framework Package / File / Directory standards. Step 2: Set the Prompt to the label you want to display for your checkbox. Step 3: (optional) If the checkbox should read/write its selected value from an underlying data source, set the View Instance and View Attribute values accordingly as you would for any other data entry component. Step 4: (optional) Set the Checked Value and Unchecked Value properties if you want them to be something other than the default "on" (for checked) and null (for unchecked). Set the set the Initially Checked property to True or False as needed. The easiest way to add a series of checkboxes rendered with a label is to use a messageComponentLayout region. Wherever you want to add your checkbox group, add a messageLayout region and set its Prompt value (this is the checkbox group label). Then, add your individual checkboxes as described above. Note that, unlike the radio group options, each checkbox is still a discrete component; they are only related by layout proximity to the shared label. Tip: To ensure that your messageLayout prompt renders at the top of your checkbox list as shown in Figure 7 above, programmatically set its alignment as follows in your processRequest() method (you cannot set the vertical alignment for this component declaratively): OAMessageLayoutBean checkBoxLayout = (OAMessageLayoutBean)webBean.findChildRecursive("CheckboxSetLayout"); checkBoxLayout.setVAlign(OAWebBeanConstants.V_ALIGN_TOP);
Personalization Considerations
See a summary of Standard Web Widgets personalization considerations in the Oracle Applications Framework Personalization Guide.
Related Information
BLAF UI Guideline(s) Standard Web Widgets [ OTN Version ] Developer's Guide Dynamic User Interface Submitting the Form Save Model Inline Messaging and Tips List of Values Date Picker Javadoc oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean (poplist) oracle.apps.fnd.framework.webui.beans.message.OAMessageCheckBoxBean 456
oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean oracle.apps.fnd.framework.webui.beans.message.OAMessageRadioGroupBean oracle.apps.fnd.framework.webui.beans.message.OAMessageRadioButtonBean oracle.apps.fnd.framework.webui.beans.form.OADefaultListBean OA Framework ToolBox Tutorial / Sample Library oracle.apps.fnd.framework.toolbox.samplelib.webui.StandardWidgetsPG oracle.apps.fnd.framework.toolbox.samplelib.webui.StandardWidgetsCO Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
457
FireAction Implementation
To configure a component to submit the form that would otherwise not do so (for example, if you want a link item to issue an HTTP POST instead of an HTTP GET), follow these simple instructions. Declarative FireAction Step 1: Select the item for which you want to enable the form submission -- or the wrapping link you created in Step 1 above -- in the JDeveloper structure pane to open the property inspector. Set the Action Type property to fireAction. Ensure that the Submit property is set to True. Step 2 (optional): Set the Event property to any name that uniquely identifies this item's form submission event (if you are configuring this for a single item on the page, you may use the default value). This is a predefined form parameter that the OA Framework automatically adds to the request when the user performs an action that triggers for the form submit. You'll see in Step 4 how to check this value to ascertain which item raised the event. Step 3 (optional): If you need to add any supplemental values to the request when the form is submitted, you 458
can quickly create parameters by selecting the ... button in the Parameter property to open a Parameters window. In the Parameters window, specify the Name and Value of each parameter that you want to add to the request. Note that the values can be static text, or bound values using SPEL syntax (see Chapter 3: Implementing the View if you need information about SPEL). Tip: If you need to encrypt your parameter value, you can use the following SPEL syntax variant: ${oa.encrypt.<ViewInstanceName>.<ViewAttributeName>} Behind the scenes at runtime, the OA Framework creates an oracle.apps.fnd.framework.webui.beans.form.OAFormParameterBean for each parameter you define in this step. Note: You should leverage this feature instead of adding individual formParameter items to the page yourself. Step 4: Implement event handling code in the processFormRequest method. For example, the following code shows how to check for a fireAction (submit form) event with the name "SF" for which two parameters were defined: public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); if ("SF".equals(pageContext.getParameter(EVENT_PARAM))) { String fixedValue = pageContext.getParameter("FixedValue"); String boundValue = pageContext.getParameter("BoundValue"); } } If your page was defined prior to OA Framework Release 11.5.9, then please read the 11.5.10 release notes for instructions on how you can convert your submitForm to a FireAction. Programmatic FireAction If the parameters or the values that are required to submit the form need to be computed programmatically, then you can create and set the fireAction element on your bean at runtime using the following method. public void setFireActionForSubmit (String eventName, Hashtable params, Hashtable paramsWithBinds, boolean clientUnvalidated, boolean serverUnvalidated) Description The name of the event that is generated by this submit. The default event name is update. Hashtable of java.lang.String name-value parameters. Hashtable of parameters whose values are databound. You can use the OADataBoundValueFireActionURL class for substituting any tokens that are associated with your data source (view object) for this purpose. This is explained in detail in the example below. clientUnvalidated Defines whether or not validation is performed on the client (browser) when the action is invoked. You should set this to false if you want to enable validation. serverUnvalidated Defines whether or not validation is performed on the server when the action is invoked. You should set this to false if you want to enable validation. Parameter Name eventName params paramsWithBinds For example, you want to create a trashcan image as a column of your table and delete a specific row when the trash can image on that row is chosen. You also want to post two parameters with your delete event: param1 that has a value set to the id of the page, and param2 that has the primary key view attribute value for that row. Lets call the name of this viewAttribute as "Sequence". You should be able to set a token for this view attribute that evaluates to the correct view attribute value at runtime. // Get the pageName that you want to submit. String pageName = pageContext.getRootRegionCode(); 459
// Create a hashtable of string name-value parameters, if any. Hashtable params = new Hashtable (1); params.put ("param1", pageName); // Create a hashtable of parameters that are data bound. // You can use the OADataBoundValueFireActionURL to resolve // any databinding that is associated with the view object. // The webBean in the constructor is the webBean on which you set // the fireAction. Hashtable paramsWithBinds = new Hashtable(1); paramsWithBinds.put ("param2", new OADataBoundValueFireActionURL(webBean, "{$Sequence}")); // set the fire action on the trash can image. The name of // the event when the form is posted is "delete". // The client and the server validation is turned on by // setting the clientUnvalidated and serverUnvalidated // properties to false. trashCanImageBean.setFireActionForSubmit ("delete", params, paramsWithBinds,false, false); Alternately, if you need the FireAction object for any programmatic access, then you can use the following sample code to do so. // get a handle to the fireAction object. FireAction fireAction = OAWebBeanUtils.getFireActionForSubmit (trashCanImageBean, "delete", params, paramsWithBinds, false, false); // make any additional changes to the FireAction object .... // finally set it on your bean trashCanImageBean.setAttributeValue (PRIMARY_CLIENT_ACTION_ATTR, fireAction);
OABoundValueSubmit
If you have a use case where you cannot use a FireAction, and yet you still must force a form submit, you may use the oracle.apps.fnd.framework.webui.OABoundValueSubmit bound value instead. For example, you would use this if you have product-specific (approved!) Javascript before and/or after the form submission. When you use the OABoundValueSubmit object: Your request parameters are automatically secured. OAFormParameterBeans are automatically created for the parameters; you don't need to explicitly create any. For additional information, see the OABoundValueSubmit Javadoc.
OABoundValueEnterOnKeyPress
If you have a case where you want to submit the form when the user selects the Enter key, you may use the oracle.apps.fnd.framework.webui.OABoundValueEnterOnKeyPress bound value (you associate this bound value with the ON_KEY_PRESS_ATTR attribute for an active component that needs to submit the form when Enter key is selected). 460
Note: Internally, this bound value leverages the OABoundValueSubmit so the same behavior with regards to request parameters also applies to this. For example, assume you want to submit the form when the cursor is in a particular text input field and the user selects the Enter key. The following code shows how to configure this for the text field while adding two parameters (param1 and param2) to the request. See the OABoundValueEnterOnKeyPress Javadoc for additional information. import java.util.Hashtable; import oracle.apps.fnd.framework.webui.OABoundValueEnterOnKeyPress; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); ... Hashtable params = new Hashtable(); params.put ("param1", "value1"); params.put ("param2", "value2"); someTextField.setAttributeValue (OAWebBeanConstants.ON_KEY_PRESS_ATTR, new OABoundValueEnterOnKeyPress(pageContext, formName, // enclosing form name params, // request parameters false, // client unvalidated false)); // server unvalidated }
Personalization Considerations
None
Known Issues
As of release 11.5.10, the fireAction event is not yet supported on the mobile platform. Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
461
SubTab Navigation
Overview
As described the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Tabs / Navigation [ OTN Version ], the subtab navigation component lets you present a single page's contents in a tabbed layout (which should not be confused with the presentation of multiple pages and content areas using application-level tabs). For example, in an "Employee" page, you might use a subtab layout to organize the data into meaningful groups that users can access as needed: Identification (displays by default) Assignment(s) Compensation Performance History The resulting page would render as follows (this example shows the page state before any content is added to the "Identification" sub tab): Figure 1: Example of an "Employee" page with sub tabs for managing associated data
Tip: At runtime, users can quickly navigate from one subtab to the next using by selecting Alt + > and Alt + < from the keyboard. Selecting Enter displays the subtab contents.
Declarative Implementation
To add subtabs to your page: Step 1: Create a pageLayout region as you normally would. Step 2: Select the pageLayout region in the JDeveloper Structure pane, right-click and select New > Region. Name your new region in accordance with the OA Framework File naming standards, and set its Style property to subTabLayout. Step 3: Add one or more container regions to your subTabLayout region (for example, you might add four messageComponentLayout regions as children of the subTabLayout region). Each container region that you add corresponds to one of the subtabs, and holds the content to be displayed when that subtab is selected. If the container that you add is a header or one of its subclasses (defaultSingleColumn, for example) it's up to you whether or not you display the header's text beneath the subtab label (if you do, the header text and the subtab text are the same as shown in Figure 2 below). If you would prefer to hide the header's text value as shown in Figure 1 above, set its Hide Header property to True. Each container region that you add (or any of its children) can have its own controller. See Handling Tab Selection below for information about how the OA Framework initializes web bean hierarchy when sub tabs are used. 462
Figure 2: Example of a header container beneath the sub tab with its Hide Header property set to "False."
Step 4: Add whatever content you want to display beneath each of the sub tab containers. Step 5: (optional) Set the subTabLayout region's Initial Subtab property if you want to display any subtab other than the first by default (note that the subtabs are identified using a zero-based index where the first tab is 0, the second is 1 and so on). Be careful not to specify an "out of bounds" index! Step 6: Add the subtab links (the number of links should match the number of content containers that you added in Step 3 above). To do this: 1. Select the subTabLayout region, right-click and select New > SubTabs. JDeveloper creates a subTabs named child. 2. Select the subTabs named child, right-click and select New > SubTabBar. 3. Select the subTabBar region, right-click and select New > Link. Set the link's Text property to the label that you want to display in the subtab. Repeat for each subtab content region that you created in Step 3. Note: Before OA Framework release 11.5.10, you specified the subtab label by setting the text value in the content containers added in Step 3 (you could not add special subtab links as described in Step 6 above). Any pre-11.5.10 subtab layout implementations continue to work as expected. When you've completed this step, the content in the JDeveloper Structure pane displays as shown below in the ToolBox Sample Library example: Figure 3: JDeveloper structure of a subTabLayout region
Step 7: Enable partial page rendering (PPR) for the subtabs (if you have not already done so, please read the 463
Dynamic User Interface: PPR documentation). For each link that you defined in Step 6 above, set the Action Type property to firePartialAction. Make sure the Submit property is set to True, and specify appropriate values for the Event, Disable Client Side Validation and Disable Server Side Validation properties. Step 8: Save your work.
Usage Notes
Each page supports one and only one subTabLayout region. Do not try to nest subTabLayout regions beneath one another, and do not try to use the Auto-Repeating Layout feature with this region. You cannot add individual items to the subTabLayout (a button, text field, image and so forth). You must add a container region, even if you intend to display just a single item. Each subtab is automatically configured as a link which performs a form submission. This configuration ensures that the pending data changes are preserved as the user navigates between tabs (each time the user selects a sub tab, the OA Framework writes any user-entered data back to the underlying view object(s) as described in Implementing the View. If you add more content regions than links, the OA Framework doesn't render the regions. If you add more links than content regions, the OA Framework renders the links, but they cannot be selected (clicked) by the user. In both cases, if you are running your page in Developer Test Mode, warnings display. To set the selected tab when you forward to this page, or navigate to it with a URL, add the following parameter to the URL: ".......&" + OASubTabLayoutBean.OA_SELECTED_SUBTAB_IDX + "=" + N where N is index of the sub tab to be selected. Tip: If you want to set the selected index again in the same request, remember to simply reset the previous parameter value by setting the new value in one of the setForwardURL*() methods.
Runtime Control
When the OA Framework instantiates a page with a subTabLayout, it create an oracle.apps.fnd.framework.webui.beans.layout.OASubTabLayoutBean containing an oracle.apps.fnd.framework.webui.beans.layout.OASubtabBarBean with links for each tab. It also directly contains the regions that hold each tab's contents. The following illustrates the web bean hierarchy for the sub tab components shown in Figure 2 above. OASubTabLayoutBean |--------------- OASubtabBarBean (Named child of sub tab layout bean) |-------------- OALinkBean (Tab One) |-------------- OALinkBean (Tab Two) ... |-------------- OAMessageComponentLayoutBean (Indexed child, Tab One's container) |-------------- OAMessageComponentLayoutBean (Indexed child, Tab Two's container) ... With partial page rendering enabled, the OASubTabLayoutBean renders displayed subtabs as needed. In this case, when the user selects a subtab: The form is submitted as a PPR event. If the target subtab has not yet been accessed, the OA Framework recusively calls processRequest() on the regions, and their nested regions, within that subtab to render the content. The OA Framework then calls processFormRequest() on the rendered bean hierarchy as in a regular form submit. Note: This means that, for a subtab option selected for the first time, any processRequest() and processFormRequest() code that you have in the subtab's web bean hierarchy will be executed in sequence. Since objects are created as needed, if a user never selects a given subtab, its data objects and web beans are never created. 464
If you do not enable partial page rendering, by default, the OASubTabLayoutBean is configured to render displayed subtabs as needed. In this case: The OA Framework creates data objects and web beans only for the selected subtab. If you have a controller associated with each subtab container region, the OA Framework calls the processRequest() method only for the content to be displayed (so any initialization code that you have for a given sub tab is executed when the sub tab is selected). When a new subtab is selected (and the form is submitted), the OA Framework forwards back to the same page and renders the new subtab. Since objects are created as needed, if a user never selects a given subtab, its data objects and web beans are never created. Alternatively, you can enable a mode whereby the OA Framework creates the entire entire web bean hierarchy and all of the data objects for the subtab regions when the page initially renders: The OA Framework calls the processRequest() method associated with all the nested regions each time the page renders (so any initialization code that you have in processRequest() methods associated sub tab regions is executed at the outset). When a new subtab is selected (and the form is submitted), the OA Framework does not forward back to the same page. Instead, it calls the processFormRequest method in the OASubTabLayoutBean and the nested container bean associated with the current selected index is executed.
Instantiate
There is no reason to instantiate an OASubTabLayoutBean and its components yourself; you should create this declaratively.
OASubTabLayoutBean subTabLayout = (OASubTabLayoutBean)webBean.findChildRecursive("<YourSubTabLayoutRegionName>"); if (subTablayout != null) { // Hide the third tab subTabLayout.hideSubTab(2, true); // Hide the first tab subTabLayout.hideSubTab(0, true); // Show the second tab subtabBean.hideSubTab(1, false); } }
Since the subtab links each perform a form submit (which causes data to be written to the underlying data source and validated), you might want to disable validation on the subtab component. To do this, call setUnvalidated(true) on the OASubTabLayoutBean in a processRequest() method (see Implementing the Controller for detailed information about the setUnvalidated() method). Note: You cannot change the destination URL for the sub tabs; they always submit the form to the current page. To change the subtab creation mode, call one of the following as appropriate: // Enable the full web bean hierarchy sub tab creation mode OASubTabLayoutBean.setAttribute(MODE_ATTR, SUBTAB_FORM_SUBMISSION_MODE);
// Enable the "as needed" sub tab creation mode. This is the default mode. OASubTabLayoutBean.setAttribute(MODE_ATTR, SUBTAB_REDIRECT_MODE);
Personalization Considerations
See a summary of SubTab Navigation personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
None
Related Information
BLAF UI Guidelines Tabs/Navigation [ OTN Version ] Javadoc oracle.apps.fnd.framework.webui.beans.layout.OASubTabLayoutBean oracle.apps.fnd.framework.webui.beans.layout.OASubTabBarBean OA Framework ToolBox Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
466
Contents
Application Switchers Declarative Implementation Runtime Control Personalization Considerations Context Switchers Declarative Implementation Runtime Control Personalization Considerations Known Issues Related Information
Application Switchers
Declarative Implementation
OA Framework currently does not provide declarative support in implementing an Application Switcher.
Runtime Control
You can only implement an Application Switcher programmatically. The following code, added to the processRequest() method in the pageLayoutBean, creates an Application Switcher programmatically and adds it to the global button bar bean, after the global buttons. pageLayoutBean.prepareForRendering(pageContext(); //Global buttons have already bean added. UINode globalButtonBar = pageLayoutBean.getGlobalButtons(); OAApplicationSwitcherBean appSwitcher = (OAApplicationSwitcherBean)createWebBean(....); OAOptionBean optionBean1 = (OAOptionBean)factory.createWebBean(pageContext, OPTION_BEAN); optionBean1.setText(...); optionBean1.setValue(...); optionBean1.setSelected(true); OAOptionBean optionBean2 = (OAOptionBean)factory.createWebBean(pageContext, OPTION_BEAN); optionBean2.setText(...); optionBean2.setValue(...); OAOptionBean optionBean3 = (OAOptionBean)factory.createWebBean(pageContext, 467
OPTION_BEAN); optionBean3.setText(...); optionBean3.setValue(...); appSwitcher.addIndexedChild(optionBean1); appSwitcher.addIndexedChild(optionBean2); appSwitcher.addIndexedChild(optionBean3); globalButtonBar.addIndexedChild(appSwitcher); The oracle.apps.fnd.framework.webui.beans.nav.OAApplicationSwitcherBean does not render as a global button, but rather as a choice (also known as a poplist or pulldown) with a label and Go button. The Application Switcher bean takes the indexed option beans as values for the poplist.
Personalization Considerations
See a summary of Switchers personalization considerations in the Oracle Applications Framework Personalization Guide.
Context Switchers
A context switcher allows users to switch the content of a page or subsequent pages based on some specified context. For example, OA Framework implements a context switcher to allow users to switch responsibilities when they navigate from one page (A) to another (B), where the function context of page B belongs to a responsibility other than the current responsibility. Refer to the Oracle Framework Security document for additional information on function security to understand when the Responsibility context switcher may render on your page. You can implement a context switcher on your page, but be aware that OA Framework can also add a Responsibility context switcher to your page as described in the scenario above. The Responsibility context switcher occupies the same area as any other context switcher you may implement on your page, but renders after it. Refer to the Oracle BLAF UI Guideline: Switchers [ OTN version ] for proper placement of the Context switcher on the page.
Declarative Implementation
To implement a Context switcher: Step 1: Create a new standalone region. The region style can be set to any layout style, flowLayout, being the most common. Note that you can even set the style to a non-layout style if a layout is not required for your needs. Step 2: Add to the region, a poplist containing context values. Step 3: Add to the region, a Go button. Step 4: Programmatically create the web bean corresponding to the standalone region you defined. Step 5: Programmatically set the standalone region web bean as the Context switcher using: oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.setContextSwitcher(UINode).
Runtime Control
Other than Step 4 and 5 of the declarative implementation instructions, there are no specific runtime control steps necessary to implement a Context switcher in a page.
Personalization Considerations
See a summary of Switchers personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
See a summary of key issues with suggested workarounds if available
Related Information
468
BLAF UI Guideline(s) Switchers: Application and Context Switchers [ OTN version ] Javadoc File(s) oracle.apps.fnd.framework.webui.beans.nav.OAApplicationSwitcherBean Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
469
Advanced Tables
Overview
Previously, OA Framework used oracle.apps.fnd.framework.webui.beans.table.OATableBean, an Oracle Application implementation of UIX oracle.cabo.ui.beans.table.TableBean, to render tables (as described in Classic Tables). Now oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean extends OATableBean to provide declarative support for existing table features that previously required programmatic control. OAAdvancedTableBean also provides declarative support for features not available with OATableBean, such as column span in a table column header. As of Release 11.5.10, we recommend new tables be implemented as "advanced tables" based on oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean. A table can contain instruction text and tip, a navigation bar, selection column, control bar, add row(s) button, column tabulation, and a recalculate button. In addition, each column can be a simple web bean (such as a text input field, a link, a poplist, and so on), or a composite container that groups these simple beans. A common example of a composite container is a flow layout containing an image and a textual description. Please refer to the Oracle Browser Look-and-Feel (BLAF) Guidelines: Tables [OTN version] and Table Navigation/Action Methods [OTN version] and the OAAdvancedTableBean Javadoc for additional information about tables. This document describes how to define a table using OAAdvancedTableBean and discusses how to implement the various features and components of a table: Defining an Advanced Table Declarative Implementation Runtime Control Event Handling Personalization Considerations Partial Page Rendering (PPR) and Tables Table Features and Components Row Headers Column Headers Column Span Row Span Navigation Selection and Control Bar Table Actions Sorting Totalling Adding Rows Detail Disclosure Advanced Table-in-Advanced Table Formatting a Table Table Performance Issues Row-Level Error Prefix Known Issues Related Information
you can declaratively specify the following features/components/attributes on a table: Number of rows to display in a table Width of a table Header text for individual table columns Column span in column headers Table formatting Single selection and multiple selection on a table and adding other controls to a selection bar Sorting and initial sorting of a table on up to three columns Totalling a column Adding new rows Detail Disclosure Row Headers Wrap Settings Below is a brief outline of how to declaratively implement a table in OA Extension. You can refer to the Advanced Table example of the Sample Library for a quick understanding of the steps that follow. To modify the default behavior of a table or to implement other features of a table, refer to the specific table features and components for more detail. Step 1: To define a table, create a new region and set its Region Style property to advancedTable. At runtime, OA Framework instantiates an OAAdvancedTableBean. Note: Unless it is defined in or as a reusable region, the table region must be a recursive child of a page layout region. The page layout region has to have its Form property set to True because a table is capable of form submissions and hence should be enclosed in a form. Step 2: Using the OA Extension Property Inspector, set the following properties on the new advanced table region (* indicates a required property): ID* - Specify an identifier that uniquely identifies the table in the page. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. View Instance* - Enter the BC4J view object that provides data for the table. All columns in the table derives its data from this source. Note: Unless your tables are read-only, where no events are ever invoked on the tables (navigation, sorting, etc.), you can not have two tables on the same page based on the same view object. Table event handling results in modifications to the state of the underlying view object (range start, range size, etc.) and to the values of the view attributes. If you have two tables based on the same view object on the same page, any event on one table alters the content and state of the other table too. Text - Specify text that appears as the title above the table. Additional Text - To meet the standards of 508 (see Accessibility in Oracle Applications), specify summary text about the table. This text maps to the HTML summary tag on the table. Records Displayed - Set to the number of rows you wish to display in the table. The default is 10 as per Oracle Browser Look and Feel (BLAF) Guidelines [OTN version]. Width - Set the width of the table in pixels or as a percentage (by including the percent symbol '%' after the value.) If you set the Width to 100%, the Next and Previous links that allow you to navigate among the rows in a table, remain visible above the table, without horizontal scrolling. This is especially useful when you have a wide table that requires horizontal scrolling. Empty Table Text - Specify alternate text that you want to display if the table is empty. If no value is specified for this property, and the query associated with the table's view object has not been executed, the default text, "No search conducted.", appears in the empty table. However, if a search has been conducted, but fetches no rows, the default text, "No data exists.", appears in the empty table. Banding Type - Specify the type of banding for the table: noBanding, columnBanding, or rowBanding. The default is noBanding. Banding Interval - If you specify row or column banding, you can specify a number to indicate the banding interval. The default is 1. As an example, if you specify rowBanding and the banding interval is 1, the table displays an alternating gray band across every other row. 471
Controller Class - (Optional) If you want to handle specific table events and/or perform table-specific actions, you may want to centralize such code in a controller and specify the name of that controller in the Controller Class property for the table. Refer to Implementing the Controller for additional information and examples of Controllers. Admin Personalization - Set to True or False to indicate whether an admin can personalize this region. User Personalization - Set to True or False to indicate whether a user can personalize this region. Step 3: While no other properties are required, there are other optional properties you may set on the table to modify the default behavior of your table. You can see the full list of properties on a table in the OA Extension Property Inspector when you create a region of Region Style advancedTable. Some of these properties are discussed in more detail when you implement specific features in a table. You can also refer to the OA Component Reference in the Oracle9i JDeveloper Help. Step 4: Define columns for your table by adding a column or columnGroup container to the advanced table. The column and columnGroup containers are indexed children of the advancedTable region. A column is the encapsulation of one column of a table. It includes an actual item web bean (messageStyledText, messageTextInput, etc.), as well as column format, column header, and column header data/format information. Note that any properties you set for a column override the table-level settings of the same properties for that column. To create a column container, select the advancedTable region in the Structure pane. Choose New > column from the context menu. A columnGroup is a grouping of columns displayed under a common header. A columnGroup enables you to create a column containing "children" columns, also known as a column span. A columnGroup can contain columns and other columnGroups and encapsulates only the column header and column header data for the columnGroup, and not for the columns and columnGroups under it. To create a columnGroup, select the advancedTable region, choose New > columnGroup from the context menu. A child column is automatically added under the columnGroup. You can create additional children under the columnGroup by selecting the columnGroup, then choosing New > column or columnGroup from the context menu. Step 5: In the OA Extension Property Inspector, set the following optional properties on the column containers: Total Value -Set this property to True to enable totalling on this column. See the section on Totalling for additional information. No Wrap - Specify whether the column content can wrap. Banding Shade - Specify whether column banding should be dark or light in appearance. Alignment - Specify whether the column content alignment is textFormat (Start), iconButtonFormat (Center), or numberFormat (Right). The default alignment is textFormat. (Note that for old tables of the 'table' region style, the alignment defaulted to the data type of the item. Now with the 'advancedTable' regions, you must set the alignment yourself.) Note The BLAF standards for the alignment of numeric column content [OTN version] has been revised as of OA Framework 11.5.10. Read only and updateable numeric values that could be totaled or compared across cells in columns (like a currency formatted value or quantity) may be set as rightaligned together with their column headers. Numeric and alphanumeric values (for example, social security, passport, sku, or identification numbers, etc...) that are not used for totaling or comparisons across cells in columns are left-aligned together with their related column headers. Therefore, if your column contains numeric content of the latter type, you should set the Alignment property to textFormat. Grid Displayed - Specify whether the grid line to the left of the column should be displayed. Width - Specify the width of the column in pixels or percentage. Admin Personalization - Set to True or False to indicate whether an admin can personalize this column. User Personalization - Set to True or False to indicate whether a user can personalize this column. Note: Refer to the Oracle 9i JDeveloper OA Extension online help for information about other properties you can set on the columns. Step 6: Specify the actual web bean you want to render under each column container. Select the column in the Structure pane, then choose New from the context menu and select one of the following: item - (Also called a leaf item.) The item style you specify determines the properties you can set on the leaf item. You can see the full list of properties relevant to a specific leaf item in the OA Extension 472
Property Inspector. Examples of leaf items that you can implement include a checkbox or a poplist. switcher - Defines a table content switcher. A table content Switcher contains two or more leaf items representing possible display alternatives. The item that displays in the Switcher column at runtime depends on the nested child item name that is returned from a specific view object attribute mapped to the Switcher column. Refer to the discussion on Table Content Switchers for more information. hideShow - Defines a Hide/Show region. flowLayout - Defines a flow layout region. tableLayout - Defines a table layout region. stackLayout - Defines a stack layout region. messageComponentLayout - Defines a messageComponentLayout region. Note: The hideShow, flowLayout, tableLayout and stackLayout regions group their underlying leaf items into composite columns. An example of a composite column is a flowLayout region that displays an image and a description. Another example is a tableLayout or messageComponentLayout region that shows item prompts for the items that are rendered in a cell. In the case of the tableLayout region, it has a rowLayout child region, which in turn has a cellFormat child region. The cellFormat child region has two leaf items, both of which could be messageStyledText to render a prompt and a value for each cell under the column. The figure below shows an example of a composite column region (Column3FlowLayoutRN) containing two leaf items (TextItem and ImageItem). Attention: Defining a graphTable region under an Advanced Table column or under a layout region beneath an Advanced Table column, is not supported. Step 7: Set the following common properties for all leaf items of a column: View Attribute- Enter the name of the view object attribute that provides data for this column. The attribute should come from the same BC4J view object specified for the advancedTable region. Read Only - Set this property to False if you want the column to be updateable. Prompt - Set this property to display the prompt text for the leaf item if the leaf item is a child of a container region that represents a composite column. If the leaf item is not under a container, then this Prompt property is ignored, because the prompt text in this case is derived from the sortableHeader web bean. Note: If you plan to allow users to export data from an advanced table, you must specify a value for the Prompt property of each leaf item. The Prompt property of the sortableHeader web bean is not picked up during export, so if you do not specify a value for the Prompt property of a leaf item, the data will be exported without a column header. Admin Personalization - Set to True or False to indicate whether an admin can personalize this leaf item. User Personalization - Set to True or False to indicate whether a user can personalize this leaf item. Note: The optional property Export View Attribute allows you to specify a different view attribute from which to export data for the leaf item. In other words, if you specify a value for this property, and a user selects an export function to export data from the table's parent page or region, the data that is exported for this leaf item is from the view attribute specified in the Export View Attribute property, and may not be identical to the data displayed. Note: Refer to the Oracle 9i JDeveloper OA Extension online help for information about other properties you can set on the leaf items. Step 8: Remember that both column and columnGroup containers encapsulate column header and column header data information. When you create a column or columnGroup container, a columnHeader grouping is automatically created under each column or columnGroup in the Structure pane. Add a sortableHeader child under the columnHeader grouping to encapsulate all the information related to the column header that you want to define. You must create a sortableHeader child even if you do not want your column to be sortable. Select the columnHeader in the Structure pane, then choose New > sortableHeader from the context menu. Step 9: Set the following properties on the sortableHeader (* indicates a required property): Prompt* - Set the text for the column header area. No Wrap - Specify whether the column header content can wrap. 473
Required Indicator - Set this property to yes if you want the 'Required' field indicator displayed in the column header of this column. Note that to make a column actually perform client-side validations for the required field, the actual web bean added under the column bean must also have the Required property set to yes. Sort Allowed - Set this property to yes to enable sorting on the column. See the section on Sorting for more information. You can also refer to the Advanced Table example of the Sample Library for an illustration. Initial Sort Sequence - Set this property to specify the level at which this column is sorted when the page first renders. Refer to the Sorting section for more information. Admin Personalization - Set to True or False to indicate whether an admin can personalize the column. User Personalization - Set to True or False to indicate whether a user can personalize the column. Note: Refer to the Oracle 9i JDeveloper OA Extension online help for information about other properties you can set on the column headers. Step 10: If you want to optionally add a formValue web bean (a value that gets submitted with your form, but is not displayed to the user) to your Advanced Table, select the Advanced Table region, and choose New > formValue from the context menu.
Runtime Control
When OA Framework first renders your table, it does not automatically execute the query on the view instance for performance reasons. To complete this implementation, you must perform one programmatic step. Include code in your controller to bind in your parameters and execute the view instance to populate the table with data. You can find an example of how this is done in the Framework Toolbox Tutorial Lesson 3: Exercise. Unlike tables implemented with OATableBean, there is no post-processing required to set up the behavior of a table implemented with OAAdvancedTableBean. All properties and named children defined in OA Extension get handled before the control goes to your controllers. As a result, there is no longer a need to use the OATableBean prepareForRendering method. Event Handling Table events are HTTP requests that are trapped and processed by OA Framework and handled during the processFormRequest phase. The various table events are: Navigation - user selects the Next or Previous link to navigate between different ranges of rows. Sorting - user selects a beveled column heading to sort that column in ascending or descending order. Insertion of a new row - user selects the Add Another Row button. Recalculate column Total - user selects the Recalculate button to update the column total. Detail Disclosure - user selects the Hide or Show link to collapse or expand the detail disclosure region. Table Control - user selects the Action/Navigation button in the table Control bar. You may wish to familiarize yourself with the set of UIX "hidden" fields so you can capture these events and implement custom behavior on them. The "hidden" fields are UIX attributes in the UIConstants interface. These parameters are set only when a form submit event is induced from a table. They are: SOURCE_PARAM - indicates the source of the event that is generating the current browser request. This maps to the name attribute of the web bean. If you wish to check whether a table generated an event, you include in your code: if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM))){ ...} EVENT_PARAM - indicates the event generated by a web bean (a table, in this case). The possible events generated by a table are: GOTO_EVENT - when 'Next' or 'Previous' navigation links are selected SORT_EVENT - when a column header is selected to sort that column HIDE_EVENT - when the 'Hide' link of a detail disclosure is selected 474
SHOW_EVENT - when the 'Show' link of a detail disclosure is selected ADD_ROWS_EVENT - when the 'Add Another Row' button is selected UPDATE_EVENT - when the total row 'Recalculate' button is selected VALUE_PARAM - indicates a value that is relevant to a particular event: When a detail disclosure Hide/Show is selected, the value parameter contains the row index corresponding to the row whose Hide/Show was selected. When the 'Next' or 'Previous' link of table navigation bar is selected, the value parameter contains the index of the first row of the current range. For example, when the row range 1-10 is displayed, the value is 1 and when the row range 11-20 is displayed, the value is 11. SIZE_PARAM - indicates the number of rows currently displayed in the table (relevant only to the navigation event). STATE_PARAM - indicates the current sort state (ascending or descending) of the column on which sorting is invoked (relevant only for the sort event).
Example Usage
To check for the "Add Rows" event: if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM))) && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) { ... }
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Declarative Implementation
To implement a row header, you need only specify a value for the Row Header View Attribute property on the advancedTable region in OA Extension. 475
The Row Header View Attribute is the view attribute associated with the table view object that determines the values for the row headers. Just as the view attribute for a column leaf item supplies values for the cells of that column on query execution, the Row Header View Attribute supplies values for the row header cells.
Runtime Control
There is no runtime control code necessary to format a row header.
Personalization Consideration
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Column Headers
The figure below illustrates a table with column headers.
Declarative Implementation
The header text of a column is set by the value that you enter in the Prompt property of the column's sortableHeader. If a column is a composite column of tableLayout region style, each child (leaf item) of the tableLayout region also displays a prompt if you specify a value in the Prompt property of the leaf item.
Runtime Control
There is no runtime control code necessary to format a column header.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Column Span
You can use column span when you have a need to display a column that contains "children" columns. A column span is implemented in OA Extension as a columnGroup container. A columnGroup can contain columns and other columnGroups and encapsulates only the column header and column header data for the columnGroup, and not for the columns and columnGroups under it. An example of column span is shown in the figure below, where the first column is actually a top level columnGroup labeled as Column Header. Beneath it are two "children" columns labeled Winter and Spring that are actually columnGroups. These columnGroups consist of another level of columns that are labeled for the months of each season. The figure below shows that you can have a combination of columns with and without column span in a single table.
476
Declarative Implementation
Column span implementation is integrated in the advancedTable creation steps and is described specifically in Step 4 of Defining an Advanced Table.
477
To implement the column span example shown in the figure above, follow the steps below. (Note that these steps merely highlight how to create the column span structure, without going into detail about how to set the various properties of the advanced table region and its children.) Step 1: Select the advanceTable region and choose New > columnGroup from the context menu. Select the sortableHeader for this columnGroup and specify a value for its Prompt property. In the figure above, the value is set to Column Header. Step 2: Select the columnGroup you just created and choose New > columnGroup from the context menu to create the next level of columns that represent the seasons. Select the sortableHeader for this columnGroup and enter the value Fall for its Prompt property. Select the columnGroup you created in Step 1 again, and choose New > columnGroup from the context menu. Select the sortableHeader for this columnGroup and enter the value Spring for its Prompt property. Step 3: Select the columnGroup you created for 'Fall' in Step 2 and choose New > column from the context menu. Select the sortableHeader for this column and enter the value Sep for its Prompt property. Repeat for the other two months in the 'Fall' columnGroup. Repeat this entire step to similarly create columns for each month in the 'Spring' columnGroup. Step 4: Select the advanceTable region and choose New > column from the context menu. Select the sortableHeader for this column and specify a value for its Prompt property. In the figure above, the value for the column without column span is also set to Column Header.
Runtime Control
478
Although you should implement a column span declaratively, there may be occasions when you need to create a column span dynamically because you do not know the number of sub-columns until runtime. First, perform the following outline of steps to create the column web beans: Step 1: Create a web bean of style COLUMN_BEAN and add it as an indexed child of the advanced table bean in your controller. Set the mandatory property - ID. Step 2: Create a web bean of style SORTABLE_HEADER_BEAN and set it as the column header (setColumnHeader) of the column web bean created in Step 1. Set the mandatory property - Prompt. Step 3: Create the actual leaf item, such as messageStyledText, etc., and add it as an indexed child of the column web bean created in Step 1. Set the mandatory property - View Attribute. Second, create a column group web bean to achieve the column span as follows: Note: Be sure to set the View Instance property on the advancedTable region declaratively. If not, do so before proceeding. Step 1: Create a web bean of style COLUMN_GROUP_BEAN and add it as an indexed child of the advanced table bean in your controller. Set the mandatory property - ID. Step 2: Create a web bean of style SORTABLE_HEADER_BEAN and set it as the column header (setColumnHeader) of the column group web bean created in Step 4. Set the mandatory property - Prompt. Step 3: Create as many column web beans as needed following Step 1 to Step 3. Add them as indexed children of the column group web bean created in Step 4. Step 4: You can add column groups under column groups following this outline of steps. Example The following code example creates a column group and that contains two columns. ... // Get a handle to the advanced table OAAdvancedTableBean tableBean = ...; // Create a column group, create the set the column header, // and add the column group under the advanced table OAColumnGroupBean columnGroup = (OAColumnGroupBean) createWebBean(pageContext, COLUMN_GROUP_BEAN, null, "ColGroup"); OASortableHeaderBean columnGroupHeader = (OASortableHeaderBean) createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "ColGroupHeader"); columnGroupHeader.setText("Column Group"); // Retrieve from message dictionary columnGroup.setColumnHeader(columnGroupHeader); tableBean.addIndexedChild(columnGroup); // Create a column, create the set the column header, and add the column // under the column group OAColumnBean column1 = (OAColumnBean)createWebBean(pageContext, COLUMN_BEAN, null, "Column1"); OASortableHeaderBean column1Header = (OASortableHeaderBean) createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "Column1Header"); column1Header.setText("Column 1"); column1.setColumnHeader(column1Header); columnGroup.addIndexedChild(column1); // Create the actual leaf item under the first column OAMessageStyledTextBean leaf1 = (OAMessageStyledTextBean) createWebBean(pageContext, MESSAGE_STYLED_TEXT_BEAN, null, "Leaf1"); leaf1.setViewAttributeName("<viewAttr1>"); column1.addIndexedChild(leaf1); // Create another column, create the set the column header, and // add the column under the column group OAColumnBean column2 = (OAColumnBean) 479
createWebBean(pageContext, COLUMN_BEAN, null, "Column2"); OASortableHeaderBean column2Header = (OASortableHeaderBean) createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "Column2Header"); column2Header.setText("Column 2"); column2.setColumnHeader(column2Header); columnGroup.addIndexedChild(column2); // Create the actual leaf item under the second column OAMessageStyledTextBean leaf2 = (OAMessageStyledTextBean) createWebBean(pageContext, MESSAGE_STYLED_TEXT_BEAN, null, "Leaf2"); leaf2.setViewAttributeName("<viewAttr2>"); column2.addIndexedChild(leaf2); ...
Personalization Considerations
When an end-user creates a personalized view of the advanced table region, the Available Columns/Columns Displayed shuttle in the Create/Update/Duplicate page appends the complete hierarchy of columnGroup names, if any are defined as the parent of the column, to the actual column name listed. This ensures that a user hides/shows the correct column, especially in the case where multiple columns of the same name may exist within different columnGroups. See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Row Span
The figure below illustrates a table with row spans. Since an advanced table requires a view usage, and the same view usage for all columns, it is difficult to support row spans that require different amounts of data under each column. In order to implement an advanced table with row spans, you must strip the advanced table's dependence on the view object. The current support of rowspan is ideal only for the static display of a small amount of data. It currently has the following limitations: Does not scale when the data must come for a view object or if there are a large number of rows or columns. Supports read-only data. It cannot and will not support form data, as without a view object, it is difficult to push back data. Does not support table events.
Declarative Implementation
Step 1: Create the advanced table, the columns, the leaf items and sortable headers declaratively, but do not specify any view object information for any of these components (that is, no view instance or view attribute names). Step 2: In the column for which you want to have row span, set the Use Separate Rows property on the Column to True. (This property will be available in a future version of OA Extension.)
Runtime Control
480
In the column for which you want to have row span, set the setUseSeparateRows attribute on the Column to true. On setting this attribute to true, the advanced table does not take the view instance (whether it is set declaratively or programmatically) into account. You must therefore provide all the data to the advanced table using UIX DataObject and DataObjectList, in a row-wise manner, in your controller. The following code example illustrates how you can programmatically implement the row span that is shown in the figure above: // Set a dummy view usage on the table OAAdvancedTableBean tableBean = ...; tableBean.setViewUsageName(""); // Set text binding for the leaf items OAMessageStyledTextBean item1 = (OAMessageStyledTextBean) tableBean.findIndexedChildRecursive("item1"); item1.setTextBinding("text1"); OAMessageStyledTextBean item2 = (OAMessageStyledTextBean) tableBean.findIndexedChildRecursive("item2"); item2.setTextBinding("text2"); // Set the column bean's properties OAColumnBean column2 = (OAColumnBean)tableBean.findIndexedChildRecursive ("column2"); column2.setUseSeparateRows(true); UINodeList col2List = new DataObjectListNodeList (item2,new DataBoundValue("childDataList")); column2.setIndexedNodeList(col2List); // Create the row data DictionaryData rowData[] = new DictionaryData[3]; rowData[0] = new DictionaryData("text1", "value"); DictionaryData row1Col2Data[] = new DictionaryData[2]; row1Col2Data[0] = new DictionaryData("text2", "value"); row1Col2Data[1] = new DictionaryData("text2", "value"); rowData[0].put("childDataList", new ArrayDataSet(row1Col2Data)); rowData[1] = new DictionaryData("text1", "value"); DictionaryData row2Col2Data[] = new DictionaryData[3]; row2Col2Data[0] = new DictionaryData("text2", "value"); row2Col2Data[1] = new DictionaryData("text2", "value"); row2Col2Data[2] = new DictionaryData("text2", "value"); rowData[1].put("childDataList", new ArrayDataSet(row2Col2Data)); rowData[2] = new DictionaryData("text1", "value"); DictionaryData row3Col2Data[] = new DictionaryData[1]; row3Col2Data[0] = new DictionaryData("text2", "value"); rowData[2].put("childDataList", new ArrayDataSet(row3Col2Data)); tableBean.setTableData(new ArrayDataSet(rowData));
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Navigation
The navigation bar allows you to traverse across different row ranges of a table and is rendered at the top of the table if the number of rows in the table is less than 10 and is rendered at both the top and bottom of the table if the rows in the table is equal to or greater than 10. Further, no navigation bar is displayed if the number of rows in the view instance is less than the value specified for the advancedTable Records Displayed property. When a user first navigates to the page, OA Framework does not know how many rows will be returned to the table. The navigation bar simply shows the Previous and Next links. 481
Once the user navigates through all the rows, the navigation bar displays the row range as a poplist so you can navigate directly to a specific range of rows, as shown below:
Declarative Implementation
There are no declarative steps necessary to implement the default behavior of the navigation bar. Note: If you have a wide table that requires horizontal scrolling, you can prevent the Next and Previous links from appearing off the screen, to the right, by setting the Width property of the advancedTable region to 100%.
Runtime Control
For event handling, you can specify the following code in your controller's processFormRequest to check for a navigation event: if (GOTO_EVENT.equals(pageContext.getParameter(EVENT_PARAM))
{ ... } To check whether the 'Next' link or 'Previous' link is selected: if ((tableBean.getName().equals(SOURCE_PARAM)) && (GOTO_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) { String value = pageContext.getParameter(VALUE_PARAM); if (value != null) { int val = Integer.parseInt(value); int newRangeStart = val - 1; if (tableVO.getRangeStart() < newRangeStart) { // next pressed ... } else { // previous pressed ... } } } Navigation and Performance The table rendering logic brings in only the rows you need in an incremental fashion. In other words, if your table display size is 10 rows, then only the first 10 rows from the query are brought in to the middle tier. If you press the Next link, another 10 rows are brought in from the database through the JDBC cursor. This is called Incremental Fetch logic. Time spent on network roundtrips is conserved by bringing in rows only on demand. 482
This is also the reason why the total row count is unknown when the table is first rendered and the poplist in the table navigation area does not initially appear. Once the fetch is complete, a poplist always displays, even as you navigate back and forth with the Previous and Next links.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
If multiple selection is enabled for a table, OA Framework renders a control bar and a Selection column that displays a checkbox.
Users can use the Select column to select a specific row or rows and then choose a control such as a button or poplist on the control bar to apply an action on the selected row(s). In the case of multiple selection, the table filter area, located above the Select column, also contains the Select All or Select None links, allowing you to quickly select or deselect all your rows.
Declarative Implementation
Step 1: To enable table selection, select your advancedTable region in the Structure pane of OA Extension. Display the context menu and under New, choose either the singleSelection or multipleSelection named child. If you choose singleSelection, OA Framework renders a Selection column with radio buttons, so you can select a single row in the table. If you choose multipleSelection, OA Framework renders a Selection column with checkboxes, so you can select multiple rows in the table. Note: The selection bean (column) is always rendered with a default label of Select, in accordance with the BLAF guidelines. This default label cannot be changed. Step 2: For the singleSelection or multipleSelection named child, set the following properties: 483
ID - specify an identifier that uniquely identifies the item. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. View Attribute - specify a view attribute for this selection named child. Note that the view attribute must be a String, such as "Y" or "N", or a Boolean (0 or 1). Text - set the text that appears in the Control bar. In the examples shown in the figures above, the control bar displays the text "Select Item(s) and ...". Step 3: Add selection controls to the control bar. In the Structure pane, select the selection named child that you just created in Step 1. Display the context menu and under New, choose flowLayout. This creates a flowLayout region that is added as an indexed child of the selection bean. Step 4: Under the flowLayout region, layout the children you want to render in the contol bar, such as buttons, submit buttons and poplists. The Select All and Select None links in the table filter area appear when you choose multipleSelection as the table selection named child.
Runtime Control
OA Framework applies the check/unchecked values of the table selection to the corresponding view attributes. You can use your controller to identify which records are selected and then take programmatic action from there. A code example of how to locate rows with certain attribute values is available in the Iterating View Object Rows section of Chapter 5: View Objects in Detail. If you wish to disable one or more rows from single or multiple selection in your table, add the following code to your controller processRequest method: OAAdvancedTableBean tableBean = ...; tableBean.setSelectionDisabledBindingAttr("Disabled"); "Disabled", in the example above, represents a Boolean view attribute that returns 1/"Y" if one or more rows is (are) to be disabled, otherwise it returns 0/"N". Note that the view attribute "Disabled" must belong to the same view object as the one associated with the advanced table items. You can also programmatically set the text in your table control bar. As an example, you can add the following code in your controller processRequest method: // Can be OASingleSelectionBean or OAMultipleSelectionBean
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Table Actions
Table actions are global table-level action components that are rendered in the control bar of the table. Prior to 11.5.10E, you had to define tableLayout-rowLayout-cellFormat web beans above the table to include global action items for the table. Now, using the UIX tableActions named child, you can define any number of items under a flowLayout or rowLayout. Generally, submitButtons and on rare occasions, poplists, are defined in this area. The tableAction component is also supported in HGrid and Gantt regions.
Declarative Implementation
Step 1: To define table actions, select your advancedTable region in the Structure pane of OA Extension. Display the context menu and under New, choose the tableActions. This automatically creates a tableActions named child consisting of a flowLayout region. 484
Step 2: Specify a standards-compliant ID for the region and leave the Region Style as flowLayout or set it to rowLayout. Suggestion: If you have only buttons to add to the table actions area, then you can use either layout styles, flowLayout being preferrable. However, if you are adding message web beans such as messageChoice or messageTextInput, along with buttons to the table action area, then you should use the rowLayout style. Using a flowLayout instead of a rowLayout in this case may cause alignment problems. Step 3: Under the Layout region, layout the children you want to render as table actions, such submitButton or messageChoice. Select the Layout region, and choose New > Item from the context menu. Select the new Item that is created and set the item style as appropriate.
Runtime Control
There is no runtime control code necessary to implement table actions.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Sorting
An advancedTable column can be sorted by a user at any time, and can also be automatically sorted when the page is initially rendered, (known as initial sorting). In the case of initial sorting, you can sort your table based on one, two or three columns of data. When a column is sortable, the column heading appears beveled, but does not display the sort direction arrow icon until the user selects the column heading to sort the column. If a user selects a beveled column heading to sort, the sort direction is ascending and displayed as such through the sort direction arrow that appears. If the user selects the sort direction arrow again, it toggles to the opposite direction, in this case, sorting the column in descending order. If a table is initially sorted, the column set as the first level of sorting displays the sort direction arrow icon, that is, until the user sorts another column, at which point the sort direction arrow icon appears in that column header.
Declarative Implementation
To enable sorting on an advancedTable column, you need to set the Sort Allowed and Initial Sort Sequence properties on the column container sortableHeader. The following list identifies the possible combination of values you can set on these two properties and how they affect sorting: Sort Allowed no yes Initial Sort Sequence none first,second, or third none none Result Column is not sortable and is not initially sorted when the table is rendered. The column is sortable and is also initially sorted as either the first, second, or third level of sorting performed on the table, in ascending direction (default), when the table is rendered. The column is available for sorting by the user, but is not initially sorted when the table is rendered. The column is available for sorting by the user, but is not initially sorted when the table is rendered. This usage should not be used. Instead, set Sort Allowed to yes, and Initial Sort Sequence to none to achieve the same result. The column is sortable by user in the specified direction and is also initially sorted as either the first, second, or third level of sorting performed on the table.
Enabling Internal Sorting On Another View Attribute Generally, you can specify sorting on a table when you define the table. In some cases, especially when you 485
use a raw HTML column with a HTML link, you may want the sorting to occur on the link value displayed in the user interface rather than on the actual link value itself (with <a href ...). To accomplish this, you can set the Sort By View Attribute property on the column container sortableHeader, to the name of the view object attribute on which you want to sort. If this property is not set or set to null, sorting is performed on the view attribute name associated with the column child. Attention: If a table column contains a nested region, such as a switcher region, and you want to enable sorting on this column, it is mandatory that you set the Sort By View Attribute property on the column container's sortableHeader.
Runtime Control
Restrictions and Limitations of Sorting Sorting is performed by requerying the database. Sorting may not work well with view objects that contain custom 'expert-mode' SQL. Basically the view object setOrderByClause is invoked on the view object using the column name associated with this web bean. An alternative for 'expert-mode' SQL may involve overriding the view object setOrderByClause and performing custom logic. Note: The orderByParameter contains the column name and either desc or asc. Sorting does not work with view objects that contain the view attribute expression "See the SQL...". To sort on these view attributes, modify the view object XML directly and change the view attribute expression to the SQL column name. Sorting is not allowed for tables that allow inserts. Sorting is not supported for tables containing updateable columns (unless the updateable columns are mapped to transient view object columns). No exception is thrown if the table contains updateable columns, since there may be a rare case when it makes sense, as in a table where the contents fit on one page. Modified transient columns are reset. This is normal and expected behavior. Sorting is not supported on the Select column, the optional first column of a table that contains a checkbox or radio button. Sorting is disabled when the Select column is checked for a row in a table or when Hide/Show is present in a table. See Sorting with Table Selection and Hide/Show for more information. Sorting is not supported on table rows created in the middle-tier. The table bean invokes the following two methods on the view object to perform sorting: viewObject.setOrderByClause(orderByClause); viewObject.executeQuery(); Debugging can be performed by setting a break on these methods on the view object (or a superclass of the view object). You can programmatically make a column sortable by using the isSortable and setSortable methods on oracle.apps.fnd.framework.webui.beans.OAWebBeanDataAttribute. Refer to the following code as an example: // We assume that all children of the advanced table are those that implement // OAWebBeanDataAttribute // Alternately, the exact bean type can be used, such // as OAMessageStyledTextBean. OAWebBeanDataAttribute webBean = (OAWebBeanDataAttribute)advtableBean.findIndexedChildRecursive("<columnName>"); webBean.setSortable(true); Enabling Internal Sorting On Another View Attribute You can also programmatically enable internal sorting on another view attribute. For example, suppose you have a view attribute named Emplink. When you click on the sort icon of the table column for Emplink, you want the actual internal sorting to occur on the Ename attribute. You can programmatically control this as follows: OAAdvancedTableBean advtable = ()createWebBean(pageContext, webBean, 486
"EmpTable"); OAAdvancedTableBean OAWebBeanDataAttribute empno = (OAWebBeanDataAttribute)advtable.findChildRecursive("<EmpnoItemID>"); empno.setSortByAttributeName("Ename"); If this sort by attribute is not set or set to null, sorting is performed on the view attribute name associated with the column child. Sort with Manually Populated Transient Attributes When you try to sort a column in a table that has one or more manually populated transient columns, the transient value are lost upon sorting. This is because the query is executed by OA Framework. In order to avoid this, you can use the following solution: 1. Encapsulate the logic to populate transient columns (view attributes) in a method. 2. On a sort event, redirect back to the same page in processFormRequest. 3. In processRequest, handle the redirect, by calling the TableBean prepareForRendering followed by a call to the method that populates transient columns. Sorting with Table Selection and Hide/Show By default, when the selector item is checked in a table that supports table selection, the underlying view object attribute value is updated. This action leaves the view object with pending changes (even for a view-only table). When the view object is in this state, table sorting is disabled. If you need the ability to sort the table under these circumstances, follow these steps: Step 1: Define a transient view attribute for the selector item using the BC4J view object wizard in JDeveloper. Do not add a dynamic attribute by calling ViewObject.addDynamicAttribute. Step 2: If you want the transient attribute value for the selector item to persist after sorting, define the transient attribute at the entity object level instead of at the view object level. Step 3: Following the OA Framework coding standards, you should always generate an OAViewRowImpl for each view object so you can call named accessors. In this case, override your set<AttributeName> method as shown below: public void setSelectFlag(String val) { populateAttribute(SELECTFLAG, val); } This example assumes the selector's view attribute is named "SelectFlag," and the code is calling the populateAttribute method to set its value without marking the view object as being "dirty." A similiar situation occurs when Hide/Show is present in a table. See Entity Object and View Object Setters in Chapter 5 for additional information.
Personalization Considerations
If you expect your users to personalize the sort order of a table, do not set explicit order by statements in your view objects. Instead, use the Initial Sort Sequence and Sort Allowed properties in OA Extension. When the table is rendered the first time, OA Framework provides an order by statement on the view object based on how you set these properties. For more information on how to personalize the sorting of data in a table, refer to Admin-Level Personalizations in the Personalization Guide. As of OA Framework 11.5.10, if you define an end-user personalizable page, where the advanced table under the query region, contains a column with a nested region (such as a table content switcher), users will be able to sort on that column in the Create/Update/Duplicate View page. Previously in OA Framework 11.5.7, users were not able to set a column with a nested region as a sort column in the Sort Settings because that column was not exposed in the Column Name poplist. Note that when a user specifies the column with the nested region as the column to sort, the actual content that is sorted will depend on what you set the Sort By View Attribute property to on the sortableHeader for the column container. If a user sets sorting on a column that contains a nested region using the Create View page, but finds 487
that the change is not taking effect on the table, it is likely that the Sort By View Attribute property on the sortableHeader for that column was not set. In this case, the personalization administrator would have to set the Sort By View Attribute property on that column using the Admin Personalization UI. If you do not want sorting on the nested region to be modified by users, you can set the User Personalization property to False so that the nested region does not display in the Column Name poplist of the Create View page's Sort Settings. See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Adding Rows
OA Framework displays an Add Another Row button to the table footer if a table is insertable, as described in the Oracle Browser Look-and-Feel (BLAF) Guidelines: Tables [OTN version]. You can refer to the Advanced Table example of the Sample Library for a quick look at an implementation of this feature.
Note: When you add another row, the row is added as the last row in the current range. The existing last row in the current range is pushed into the next range. You can also add new rows to a detail table that is associated to some master row via a detail view instance. In the past, you had to setAutoInsertion(false) on such a table, and handle row insertions yourself. Now, you can add rows automatically to detail tables because foreign keys are automatically populated for a table associated with a detail view instance of some master row. Of course, you still have to setAutoInsertion(false) if there is custom SQL in the view link, or if you have to perform some custom population of detail row data.
Declarative Implementation
The following outline of steps describe how to display an Add Another Row button to the footer of an advanced table. Step 1: In the Structure pane of OA Extension, select your advancedTable region and chose New > footer from the context menu. OA Extension creates an advancedTables Components folder containing a footer named child, that contains a tablefooter container (labeled tableFooter1). Step 2: Select the tableFooter and choose New > addTableRow from the context menu.
488
Step 3: In the Structure pane, select the addTableRow item that is newly created, as shown in the figure above, and use the Property Inspector to set its following properties (* Required): ID* - specify an identifier that uniquely identifies the addTableRow item in the page. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. Add Rows Label - specify text to override the "Add Another Row" default text that appears in the Add Another Row button. Rows to Add - specify the number of rows to add each time a user chooses the Add Another Row button. The value for this property must not be greater than the value set for the Records Displayed property on the advanced table. The default is 1. Note that this property is valid only if the Insert Rows Automatically property is set to True. Insert Rows Automatically - specify True to indicate rows are to be added automatically when the Add Another Row button is chosen. Specify False if you want to respond to the event in your controller, so that you can, for example, set the primary keys or set some default row attributes. Note: The Insert Rows Automatically property is equivalent to the 'autoInsertion' property that was set in your controller using the setAutoInsertion API for classic tables. Step 4: If you want to allow new rows to be added to a detail table (as in the case of an Advanced Table-inAdvanced Table, Detail Disclosure drilldown, or a master-detail template), then in addition to setting Insert Rows Automatically to True, you must also attach the master and detail tables together by specifying an identical value in the View Link Name property of both the master and detail tables. Note: Auto-insertion in detail tables only work for cases where the view link has no custom SQL.
Runtime Control
There is no runtime control code necessary to implement the Add Another Row button in the advanced table footer. However, if you wish to do special handling when a user chooses the Add Another Row button, (you must first declaratively set the Insert Rows Automatically property to False for the addTableRow item), you can do so in the processFormRequest method of your controller code. You can also modify properties of the Add Another Row feature in your controller, as shown in the following example: // Get a handle to the table footer bean OATableBean tableBean = ...; OATableFooterBean tableFooterBean = tableBean.getFooter(); if (tableFooterBean != null) { 489
// Get a handle to the add table row bean OAAddTableRowBean addTableRowBean = tableFooterBean.findIndexedChild("<addRowBeanId>"); // Add 5 rows everytime add row button is clicked addTableRow.setText("Add 5 Rows"); addTableRow.setRows(5); // Handle add row insertion yourself addTableRow.setAttributeValue(AUTO_INSERTION, Boolean.FALSE); } Note: If you add multiple rows to a table, the new rows are shown at the bottom of the current range, pushing any existing rows into the top of the subsequent range. You should only add, at most, a number of rows that is less than or equal to the number of rows displayed in your table. Add Another Row and View Object Execution If the view object associated with the advanced table is not executed and you select "Add Another Row", you get a state loss error on the page. For any successful table event, the table view object query must be executed before a table event occurs. In the case where you do not want to display any rows when the page renders, yet want to let the user select "Add Another Row" to add rows into the table, then before you add rows to the table, you must properly initialize the view object as described in the Initialization Guidelines. Empty Rows In A Table Multiple empty rows can be added into a table when any of the following occur: When your code inserts rows into the view object before the table renders, so the table displays new blank rows. When a user selects the 'Add Another Row' button multiple times. When a user selects the 'Add n Rows' button, which you have programmatically implemented to add 'n' rows into your view object. In any of these cases, if the user does not enter values into some of the rows, you must include logic to recognize those empty rows (if any), and remove them from the view object. For example, if you prepopulate ten new empty rows in an expense reports table, but the user enters only three expense lines, you must provide code to recognize and remove the remaining seven empty rows from the view object.
Personalization Consideration
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Totalling
OA Framework supports the totalling of values in any numeric table column. If totalling is enabled in a table, the table footer displays a column total and a Recalculate button, as shown below. The total displays a double precision summation of all visible rows in the table. Note that the total reflects only the current visible records and not all the records queried. Note Totalling can be enabled for any column except for the first column in a table.
490
Declarative Implementation
The following outline of steps describe how to enable totalling for a column in the footer of an advanced table. Step 1: In the Structure pane of OA Extension, select the column container for which you want to enable totalling. Any column except for the first column can be totalled. Set the Total Value property for this column container to True. Note: Totalling is supported only on leaf items immediately under a column container of an advanced table. It is not supported on regions, such as a messageComponentLayout region, under a column container of an advanced table. Step 2: In the Structure pane, select your advancedTable region and chose New > footer from the context menu. OA Extension creates an advancedTables Components folder containing a footer named child, that contains a tablefooter container (labeled tableFooter1). Step 3: Select the tableFooter container and choose New > total from the context menu. OA Extension creates a tableFooter Components folder containing a total named child, that contains a new totalRow item as shown in the figure below.
491
Step 4: In the Structure pane, select the totalRow item and use the Property Inspector to set its following properties (* Required): ID* - Specify an identifier that uniquely identifies the totalRow item in the page. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. Recalculate Totals Label - specify text to override the "Recalculate" default text that appears in the Recalculate button. Disable Total Recalculation - specify True or False to indicate whether or not to render the Recalculate button. The default is False. Note: Although the Rendered property on the totalRow item may be changed, you should always set this property to True so you can render and see the total. If you do not want the totalRow web bean to render, then you should not set the Total Value property to True for any of the columns in your advanced table.
Runtime Control
There is no runtime control code necessary to implement totalling in the advanced table footer. However, you can modify properties of the Totalling feature in your controller, as shown in the following example: // Get a handle to the table footer bean OATableBean tableBean = ...; OATableFooterBean tableFooterBean = tableBean.getFooter(); if (tableFooterBean != null) { // Get a handle to the total row bean OATotalRowBean totalRowBean = tableFooterBean.getTotal();
// If you want to set text for the total button totalRowBean.setText("Re-Total"); // If you want to hide the recalculate total button totalRowBean.setReadOnly(true); 492
} Also, If you wish to bypass OA Framework's mechanism to control the value generation for a table column footer so you can provide your own value (such as a percentage), you should set the oracle.apps.fnd.framework.webui.OAWebBeanConstants TABULAR_FUNCTION_VALUE_ATTR on the appropriate table column. This overrides OA Framework's internal behavior of footer value generation. Like all web bean attributes, you can data bound this attribute if required. Sample usage: OAAdvancedTableBean advtableBean = ...; OAMessageStyledTextBean salaryBean = advtableBean.findChildRecursive(...); String formattedTotal = ...; // compute the total salaryBean.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR,formattedTotal); or: salaryBean.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR, new OADataBoundValueViewObject(...)); Grand Totals Declarative or programmatic support for Grand Totals is currently not available in advanced tables. If you wish to implement grand totals, you must build your own layout below the advanced table, in accordance with the Oracle Browser Look-and-Feel (BLAF) Guidelines: Tables: Grand Totals [OTN version]. You should use the messageComponentLayout region style to build this layout. In addition, you will have to programmatically provide the values for the grand total fields. Since these fields are like any other form fields, you can first calculate the grand total value in your controller code by looping through the entire view instance row range, and then call setText() for the grand total field to set it with the calculated grand total value.
Personalization Consideration
As mentioned earlier, you can not enable totalling for the first column in a table. If you attempt to personalize the first column of an advanced table by setting the Total Value property to True in the Personalize page, it is simply ignored. To total the contents of that first column, you must use the OA Personalization Framework to reorder the column within the advanced table so that it is no longer the first column in the table, then set the Total Value property to True for that column. See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Detail Disclosure
Detail disclosure is also known as a row-level Hide/Show in a table.
Note: The BLAF Hide/Show guidelines for Tables [OTN version] do not allow embedding secondary or children objects in the details of a table row. This means that you should not create a hideShow or hideShowHeader region under the detail region of a table. (To display hierarchical information in a table, see HGrids). Similarly, you should not create a hideShow region under an inner table of a Table-in-Table or implement detail disclosure inside the inner table of a Table-in-Table.
Declarative Implementation
Follow the steps given below to implement the detail disclosure feature. For a working example of this feature, you can refer to the Advanced Table example of the Sample Library. Step 1: Select the advancedTable region in the Structure pane of OA Extension. Under New in the context menu, select detail. This creates a detail named child that you can use to show additional information for any row in the table. Step 2: The default region style of the detail region is header, but you can change the style, if required, and 493
494
Step 3: Select the advancedTable region in the Structure pane. Set the Detail View Attribute property to the name of the Boolean/String ("Y" or "N") attribute (from the view object specified for the advancedTable region) that determines the shown or hidden state of the detail child of the rows. Note: Specifying the named child detail region alone is sufficient to enable the addition of a row-level Hide/Show. You do not need to explicitly add a hideShow as the detail region. Note: In OA Framework 11.5.9 tables (using OATableBean), you are able to set the All Details Enabled property for the table to render the 'Hide All Details|Show All Detail' link above the table. Selecting Show All Details expands all the detail disclosure regions, and selecting Hide All Details collapses all the detail disclosure regions. However, Performance team guidelines strongly discourage the use of this feature. As a result, you can not set this property declaratively in OA Extension for advancedTable regions. If you still want to enable this property, you must do so using the setAllDetailsEnabled method. Refer to the Runtime Control section for an example.
Runtime Control
You can also set in your controller, the properties discussed in the Declarative Implementation section above: import oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean; ... OAAdvancedTableBean advtableBean = (OAAdvancedTableBean)webBean.findIndexedChildRecursive("<advtableBeanName>"); // Set the detail named child OAWebBean detailNode = (OAWebBean)... // Get a handle to the detail node advtableBean.setDetail(detailNode); // Set the detail view attribute name advtableBean.setDetailViewAttributeName("<detailViewAttributeName>"); ... 495
The Performance team strongly discourages the use of the 'Hide All Details|Show All Detail' link above a table with Detail Disclosure. As a result, this feature can only be enabled by using the UIX TableBean setAllDetailsEnabled method in your processRequest method. If you feel a need to use this feature, please review your functionality and UI design with the performance team first. // Turn on the "Hide All Details | Show All Details" links advtableBean.setAllDetailsEnabled(true);... For information on nested tables or table inside detail disclosure, refer to table-in-table.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
The inner table bears a master-detail relation with the outer table. For each master row, corresponding detail rows are displayed in an inner table. Users can control the rows in the inner table by defining additional search criteria to the criteria already defined in the view link, which relates the outer view object with the inner view object. Note that a table-in-table user interface can be costly in terms of performance because multiple view objects and the bean hierarchy are created and replicated at runtime. Performance cost is reduced when the inner table is read-only because the same view object can be reused. The creation of the view object attached to a detailed section is done during rendering time. If you never open the detailed section of a row, the view object is not created. So if you have ten master rows in the outer table and you open the detail section of only two rows, the performance cost is only for those two rows. You can make the inner table editable by adding form-elements in the inner table so the data is pushed to the 496
view object just like a regular table. The inner table also supports navigation, sorting, adding another row, totalling, single and multiple selection, row-level and column-level banding and exporting to a Microsoft Excel spreadsheet.
Declarative Implementation
Note: The BLAF Hide/Show guidelines for Tables [OTN version] do not allow embedding secondary or children objects in the details of a table row. This means that you should not create a hideShow or hideShowHeader region under the detail region of a table. (To display hierarchical information in a table, see HGrids). Similarly, you should not create a hideShow region under an inner table of an Advanced Table-in-Advanced Table or implement detail disclosure inside the inner table of a Advanced Table-in-Advanced Table. To create a table like the one shown above, you need to define the region definition in XML using OA Extension, and add code in your controller. Xml Structure Step 1: Create an advancedTable region. Step 2: Select the (outer) advancedTable region in the Structure pane of OA Extension. Under New in the context menu, select detail.
This creates a detail named child that you can use to show additional information for any row in the table. The default style of the detail region created is header. Set this detail region to be the header for your inner table. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. Step 3: Select the inner table header region, select New > Region from the context menu to create an advancedTable region that is to become your inner table. Step 4: Follow the standard instructions for defining an advanced table to create your inner table.
497
Step 5: Select the outer advancedTable region in the Structure pane. Set the Detail View Attribute property for this region to the name of the Boolean/String ("Y" or "N") attribute (of the same view object as that of the other table columns) that determines the shown or hidden state of the detail child of each row. Note: The BLAF Hide/Show guidelines for Tables [OTN version] do not allow embedding secondary or children objects in the details of a table row. This means that you should not create a hideShow or hideShowHeader region under the detail region of an advanced table. (To display hierarchical information in a table, see HGrids). Similarly, you should not create a hideShow region under an inner table of a Advanced Table-inAdvanced Table or implement detail disclosure inside the inner table of a Advanced Table-in-Advanced Table.
Runtime Control
After creating the XML page structure, you need to initialize some properties on the beans in your code. As a example, suppose your BC4J setup is as follows: 1. View object is DeptVO. 2. Primary Key of DeptVO is Deptno. 3. View object is EmpVO. 4. DeptVO and EmpVO are connected by a view link called DeptEmpVL. The two view objects are connected by the query WHERE DEPTNO = :1. 5. Application module contains the two view objects and the view link. Note: The view link is used in the master-detail relationship to display the correct detail rowset. To achieve the advanced table-in-advanced table display, you would add these lines in your controller: public void processRequest(...) 498
{ OAWebBean outerTable = (OAWebBean)webBean.findChildRecursive("outerTable"); OAWebBean innerTable = (OAWebBean)webBean.findChildRecursive("innerTable"); if (outerTable != null) { outerTable.setAttributeValue(CHILD_VIEW_ATTRIBUTE_NAME,"Deptno"); outerTable.setAttributeValue(VIEW_LINK_NAME,"DeptEmpVL"); } if (innerTable != null) { innerTable.setAttributeValue(CHILD_VIEW_ATTRIBUTE_NAME,"Deptno"); innerTable.setAttributeValue(VIEW_LINK_NAME,"DeptEmpVL"); } ... ... } Note: The two properties that are set in the example above are required for the proper functioning of the bean ID generation and master-detail relationship. If you omit any of the above, you may end up with a JavaScript error or see incorrect records in the inner table. RowSets The advanced table-in-advanced table detail template (inner table) uses the RowSets interface to interact with the OA Framework Model. When you query data using a view object, the results of the query are stored in a RowSet. Each RowSet can have multiple iterators which allows scrolling through the set of rows and each view object can have multiple RowSets. As a result of the RowSet implementation, if you want to handle rows manually in an advanced table-inadvanced table, you'll need to go about it differently than when you handle rows in just an advanced table. Generally, with a advanced table, you can get a handle to the advanced table view object and manipulate it, such as by adding or deleting a row, and see the change reflected on the UI. This is not the case for the inner table of an advanced table-in-advanced table. As a matter of fact, any changes that you make to the detail view object is never even considered. To insert a new row or update the state of an existing row in an inner table, you must create an OAInnerDataObjectEnumerator and use it to get a handle to the RowSet attached to the inner table. Once you have the RowSet, you can manipulate it in any manner and the changes are reflected in the UI. In previous versions of OA Framework, oracle.apps.fnd.framework.webui.OAInnerDataObjectEnumerator used to scroll through the different view objects associated with each inner table. Now since a RowSet is associated with each inner table, the behavior of this enumerator has been updated. Following is an example of how to use the enumerator to go through the rows of a RowSet attached to an inner table: // get a handle to inner table OATableBean innerTable = (OATableBean)webBean.findChildRecursive("InnerTableBean"); // create an enumerator OAInnerDataObjectEnumerator enum = new OAInnerDataObjectEnumerator(pageContext, innerTable);while (enum.hasMoreElements()) { RowSet innerRowSet = (RowSet) enum.nextElement(); // get all rows Row []rowsInRange = innerRowSet.getAllRowsInRange(); for (int i = 0; i < rowsInRange.length; i++) { Row nextRow = (Row) rowsInRange[i]; if ("Y".equals(nextRow.getAttribute("DeleteFlag"))) { 499
// delete the marked row nextRow.remove(); } } // In case you want to add new rows in this RowSet, you can do the same OARow newRow = (OARow) innerRowSet.createRow(); // initialize value for some attribute and insert the row newRow.setAttribute("SomeAttr", "SomeValue"); innerRowSet.insertRow(newRow); } // In case you want to change the WhereClause of the containing view object OAViewObject innerViewObject = (OAViewObject) innerRowSet.getViewObject(); String newWhereClause = "DEPT.LOC = :1"; innerViewObject.setWhereClause(newWhereClause); // Each RowSet can now bind parameter specific to each inner web bean The association of a RowSet instead of a view object to the inner table improves the performance of a advanced table-in-advanced table. The amount of memory and other JDBC resources required is limited because all RowSets of an inner table are part of the same view object, and therefore share the same query. Also the implementation of an advanced table-in-advanced table is now consistent with other web beans of similar hierarchical nature. The master table is always in synchronization with the inner table, because any change in the master table triggers changes in the inner table via a view link. Note: If you use the OAInnerDataObjectEnumerator in the processRequest method, you may not be able to scroll through the RowSets because they may not yet be created. A RowSet for an inner table is created only when a user actually displays the inner table in the UI.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Formatting a Table
There are several ways to format an advanced table. They are as follows: Full Table Formatting - affects the table as a whole. Column Formatting - affects only the columns of the table. Row Formatting - affects only the rows of the table. Column Header/Row Header Formatting - affects only the column headers or row headers of the table. Refer to the section of interest for additional information.
500
The second type of formatting that affects the table as a whole is setting the width of the table. You can refer to the Advanced Table example in the Sample Library for see how row banding is implemented.
Declarative Implementation
You can change the banding and width of a table by setting the Banding Interval, Banding Type, and Width properties of the advancedTable region in OA Extension, as described in Step 2 of Defining an Advanced Table. For row banding or column banding, set Banding Type to rowBanding or columnBanding, respectively. Use the Banding Interval property to specify the interval of banding you want to render. For example, if you set Banding Type to columnBanding and Banding Interval to 2, you get a table that alternates two dark column with two light columns over the entire table. Although the width can be specified by pixels or percentages of the width of the parent element, percentages are commonly preferred. If you set the Width to 100%, the Next and Previous links that allow you to navigate among the rows in a table, remain visible above the table, without horizontal scrolling. This is especially useful when you have a wide table that requires horizontal scrolling. Note: No matter what value you specify for the table width, if the width is not large enough to accommodate the table content, the value is overridden at display time to take up the minimum amount of necessary space.
Runtime Control
No runtime code is required to format a table.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Column Formatting
You can modify the formatting of a table's columns as follows: Turn on/off the line wrap within the cells of a column. Alter the alignment of a column's content. Turn on/off the display of the grid line to the left of a column. Alter the width of a column. Set the column banding shade to dark or light.
Declarative Implementation
You can change the formatting of a column by setting the No Wrap, Alignment, Grid Displayed, Banding Shade, and Width properties of the column container in OA Extension, as described in Step 5 of Defining an Advanced Table. Set the No Wrap property to False (default) to allow wrapping of a column's cell content. Unlike the tables of OA Framework 11.5.9, the alignment of data in the columns of an advancedTable region is no longer automatically determined by the data type of the column's child. You must set the alignment using 501
the Alignment property of the column. The default is textFormat, which aligns the data to the Start position. You can also set the alignment to iconButtonFormat (Center) or numberFormat (Right). Note: The BLAF standards for the alignment of numeric column content [OTN version] has been revised as of OA Framework 11.5.10. Read only and updateable numeric values that could be totaled or compared across cells in columns (like a currency formatted value or quantity) may be set as right-aligned together with their column headers. Numeric and alphanumeric values (for example, social security, passport, sku, or identification numbers, etc...) that are not used for totaling or comparisons across cells in columns are leftaligned together with their related column headers. Therefore, if your column contains numeric content of the latter type, you should set the Alignment property to textFormat. Set the Grid Displayed property to True to render grid lines to the left of each column. Use the Width property on the column to set the width of the column in terms of pixels or percentage of the parent element (advancedTable). To specify a percentage, include the percent symbol after the value, as in 50%.
Runtime Control
No runtime code is required to format a column.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Row Formatting
OA Framework does not set any default row formatting, except to render a horizontal grid line above each row.
Declarative Implementation
There is currently no declarative support for formatting the rows in a table.
Runtime Control
The UIX TableBean rowFormats object determines the row format of a table. To modify a row's formatting, you can use the TableBean getRowFormats method. This method returns a DataObjectList. Each DataObject in the list corresponds to one row from top to bottom in the table format. You specify a format inside each DataObject to alter the formatting of each row accordingly. These formatting DataObjects store their values under the known, publicized key (UIConstants) DISPLAY_GRID_KEY. UIX queries each of the DataObjects for the DISPLAY_GRID_KEY property to determine if it returns BOOLEAN.TRUE or BOOLEAN.FALSE. Each one that returns BOOLEAN.FALSE from this query suppresses a grid line above that row. Note: If a DataObject returns a value for a key, the value is used to change the row format, if not, the table assumes the default format. The following code example illustrates how you can override the default row format by suppressing a row's grid line. processRequest {
... // get a handle on the array of Row Format Dictionaries DataObjectList myRowFormats = tableBean.getRowFormats(); if (myRowFormats = null) DictionaryData[] myRowFormats = new DictionaryData[size]; // set the DISPLAY_GRID_KEY property to FALSE for the second row // which corresponds to index 1 in the DictionaryData array rowFormats[1] = new DictionaryData(DISPLAY_GRID_KEY, Boolean.FALSE);
502
... }
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Declarative Implementation
You can format a column header by setting the No Wrap property on the column's sortableHeader. The default is False, to allow wrapping. There is currently no declarative support for formatting row headers.
Runtime Control
To format a row header, you can use the TableBean getRowHeaderFormats method. This method returns a DataObjectList. Each DataObject in the list corresponds to one row header from top to bottom, in the table format. You specify formats inside each DataObject to alter the formatting of each row header accordingly. These formatting DataObjects store their values under the known, publicized key (UIConstants) CELL_NO_WRAP_FORMAT_KEY. This property determines whether the row header should be rendered with line wrapping disabled. To override the default, return Boolean.TRUE to render the row header without wrapping the contents. Note: If a DataObject returns a value for a key, the value is used to change the row format, if not, the table assumes the default format.
Personalization Considerations
See a summary of Advanced Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
than 0). These rules may sound a little odd and confusing to you, because BC4J performs some implicit fill up logic, but these rules are based on some heuristics and experiments. In general you should be careful when you use the setRangeSize and setRangeStart methods on a table view object. 4. The table rendering logic makes the following three assumptions to render a table without any extra logic that would degrade performance (to avoid unnecessarily re-setting and adjusting the range size multiple times): i. If you want the table to render properly, you should make sure the table view object range start is the default value 0 before the table bean is created and rendered for the first time. If your code performs row navigation through methods like the view object next or last methods before the table bean is rendered, these methods move the range start to a value greater than 0. (The view object methods first or previous moves up the range.) Please perform the following in this case:
Option 1:
int fetchedRowCount = vo.getFetchedRowCount(); if (fetchedRowCount > 0) { // Save the range start and size. int savedRangeStart = vo.getRangeStart(); int savedRangeSize = vo.getRangeSize(); // When you set the range size to a size that // is potentially larger than the current size,you should // set the range start first to 0 and then set the range size. vo.setRangeStart(0); vo.setRangeSize(fetchedRowCount); try { for (int i = 0; i < fetchedRowCount; i++) { //Or you can use getAllRowsInRange() outside the for loop. Row row = vo.getRowAtRangeIndex(i); ... // Perform row operation. } } finally { // Restore the original range - do in finally clause, // in case action on row throws an exception. // When you set the range size to a size that is // potentially smaller than the current size // (usually when you restore the original range size and start), // then reverse the order // -- that is, set the range size first and then the range start. vo.setRangeSize(savedRangeSize); vo.setRangeStart(savedRangeStart); }
Option 2:
Alternatively, use a secondary iterator if you do not want to deal with messing up the default row set range or row currency: RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter"); int fetchedRowCount = vo.getFetchedRowCount(); if (fetchedRowCount > 0) { 504
deleteIter.setRangeStart(0); deleteIter.setRangeSize(fetchedRowCount); for (int i = 0; i < fetchedRowCount; i++) { Row row = deleteIter.getRowAtRangeIndex(i); ... } } finally { if (deleteIter != null) deleteIter.closeRowSetIterator(); } Note: You can also use the following convenience methods if you want to find rows matching some criteria: OAViewObject.getFilteredRows and OAViewObject.getFilteredRowsInRange. ii. Exception to assumption 1: If you redirect to current page with retainAM=Y in the URL, range start can be greater than 0 if the user is already in some range other than the first range. To preserve the current table range upon redirect, you should place the following check on the executeQuery call: if (!vo.isPreparedForExecution()) vo.executeQuery(); This is because executeQuery resets the range start to 0, which may not be what you want when you redirect with retainAM=Y. iii. If you programmatically set the number of rows displayed for the table, it takes effect only if the table view object range start is initially 0.
Known Issues
See a summary of key table issues with suggested workarounds if available
Related Information
BLAF UI Guideline(s) Tables [OTN version] Personalization of Tables and HGrids [OTN version] Javadoc File(s) oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean oracle.apps.fnd.framework.webui.beans.OAWebBean oracle.apps.fnd.framework.webui.beans.OAWebBeanDataAttribute oracle.apps.fnd.framework.webui.OAWebBeanConstants oracle.apps.fnd.framework.webui.beans.table.OAAddTableRowBean oracle.apps.fnd.framework.webui.beans.table.OATotalRowBean oracle.apps.fnd.framework.webui.OAInnerDataObjectEnumerator oracle.cabo.ui.beans.table.TableBean Lesson(s) Framework Toolbox Tutorial Lesson 3: Exercise ToolBox Tutorial / Sample Library To view Advanced Table examples implemented in the Sample Library project of the Toolbox workspace, run the toolbox.jws -> SampleLibrary.jpr -> SampleBrowserPG.xml file in OA Extension. Select the Advanced Table link in the SampleBrowserPG page that displays in your browser to view 505
the implementation of the Column Span, Table Actions, Required Fields indicator, Row Banding, Detail Disclosure, and Add Another Row UI features. The following package files in the Sample Library display the declarative and runtime implementation of the Advanced Table examples: oracle.apps.fnd.framework.toolbox.samplelib.webui.SampleBrowserPG.xml oracle.apps.fnd.framework.toolbox.samplelib.webui.AdvancedTablePG.xml oracle.apps.fnd.framework.toolbox.samplelib.webui.AdvTablePageCO.java FAQs Tables and Advanced Tables Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
506
Classic Tables
Overview
Note: This document describes the implementation of tables, based on oracle.apps.fnd.framework.webui.beans.table.OATableBean. As of Release 11.5.10, we recommend new tables be implemented as Advanced Tables, based on oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean. A table is a UI component used for tabular representation of data derived from the contents of a view instance, with accompanying features like column sorting, row-level selection/action, user-controlled row insertion, column totalling, hide/show of supplemental rows and/or column content, and more. A table can contain instruction text and tip, a navigation bar, selection column, control bar, add row(s) button, column tabulation, and a recalculate button. In addition, each column can be a simple web bean (such as a text input field, a link, a poplist, and so on), or a composite container that groups these simple beans. A common example of a composite container is a flow layout containing an image and a textual description. Please refer to the Oracle Browser Look-and-Feel (BLAF) Guideline: Tables [OTN version] and OATableBean javadoc for more guidelines and information about tables. This document describes how to define a table and discusses how to implement the various features and components of a table: Defining a Table Declarative Implementation Runtime Control Event Handling Personalization Considerations Partial Page Rendering (PPR) and Tables Table Features and Components Row Headers Column Headers Navigation Selection and Control Bar Table Actions Sorting Totalling Adding Rows Detail Disclosure Table-in-Table Formatting a Table Table Performance Issues Row-Level Error Prefix Known Issues Related Information
Defining a Table
Declarative Implementation
You can create a table by specifying appropriate information in Oracle 9i JDeveloper OA Extension. Currently, you can declaratively specify the following features/components/attributes on a table: Number of rows to display in a table Header text for individual table columns Sorting and initial sorting of a table on up to three columns 507
totalling a column Single selection and multiple selection on a table Detail Disclosure Row Headers Wrap Settings Following is a brief outline of how to declaratively implement a simple table in OA Extension. To modify the default behavior of a table or to implement other features of a table, refer to the specific table features and components for more detail. Step 1: To define a table, create a new region and set its Region Style property to table. Note: The table region has to be a recursive child of a page layout region. The page layout region that has to have its Form property set to true. This is required as a table is capable of form submissions and hence should be enclosed in a form. Step 2: Using the OA Extension Property Inspector, set the following properties on the new table region: Region Style - Set to table, as mentioned in step 1. At runtime, OA Framework instantiates an OATableBean. ID - Specify an identifier that uniquely identifies the table in the page. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. Text - Specify text that appears as the title above the table. Additional Text - To meet the standards of 508 (see Accessibility in Oracle Applications), specify summary text about the table. This text maps to the HTML summary tag on the table. Number of Rows Displayed - Set to the number of rows you wish to display in the table. The default is 10 as per Oracle Browser Look and Feel (BLAF) Guidelines [OTN version]. Controller Class - (Optional) If you want to handle specific table events and/or perform table-specific actions, you may want to centralize such code in a controller and specify the name of that controller in the Controller Class property for the table. Refer to Implementing the Controller for additional information and examples of Controllers. Width - Set the width of the table in pixels or as a percentage. If you set the Width to 100%, the Next and Previous links that allow you to navigate among the rows in a table, remain visible above the table, without horizontal scrolling. This is especially useful when you have a wide table that requires horizontal scrolling. Message Appl Short Name - If the table is empty when the page renders, and you want to display a custom message in the empty table, then set this property to the application short name of the product that owns the message to display. The default message that displays is "No search conducted" if no search has been conducted on the table or "No data exists" if a search has been conducted but no rows were found. Setting this property and the Message Name property overrides the default message. Message Name - If the table is empty when the page renders, and you want to display a message in the empty table other than the default message, then set this property to the name of the message to display. For example, you may define a message with the text "Empty table text" in FND_MESSAGES under the product FND, and name the message FND_EMPTYTAB_TEXT. To override the default message that displays in the table, you would set the Message Appl Short Name property to FND, and set the Message Name property to FND_EMPTYTAB_TEXT. Step 3: While no other properties are required, there are other optional properties you may set on the table to modify the default behavior of your table. You can see the full list of properties on a table in the OA Extension Property Inspector when you create a region of Region Style table. Some of these properties are discussed in more detail when you implement specific features in a table. You can also refer to the Oracle Applications Component Reference for additional information. Step 4: For each column you wish to render in your table, define a region and/or item (also referred to as a leaf item) directly to your table region. These regions and/or leaf items are added as indexed children of the table. You can add regions of the following Region Style to a table. These regions group their underlying leaf items into composite columns: flowLayout - Defines a flow layout region. For example, you can define a flowLayout region to display an image and description. 508
stackLayout - Defines a stack layout region. hideShow - Defines a Hide/Show region. messageComponentLayout - Defines a messageComponentLayout region. switchers - Defines a table content switcher. A table content Switcher contains two or more leaf items representing possible display alternatives. The item that displays in the Switcher column at runtime depends on the nested child item name that is returned from a specific view object attribute mapped to the Switcher column. Refer to the discussion on Table Content Switchers for more information. Note: The hideShow, flowLayout, messageComponentLayout and stackLayout regions group their underlying leaf items into composite columns. An example of a composite column is a flowLayout region that displays an image and a description. Another example is a messageComponentLayout region that shows item prompts for the items that are rendered in a cell. The messageComponentLayout region has two leaf items, both of which could be messageStyledText to render a prompt and a value for each cell under the column. The figure below shows an example of a composite column region (Column3FlowLayoutRN) containing two leaf items (TextItem and ImageItem). You do not have to set any table-specific properties on these composite column regions.
Attention: Defining a graphTable region under a table region or under a layout region beneath a table region, is not supported. Step 5: The properties you can set on the leaf items of a table vary depending on the item style of the child. You can see the full list of properties relevant to a specific leaf item in the OA Extension Property Inspector. Following is a list of some optional properties you can set, that are common to leaf items of the table: View Instance - Enter the BC4J view object that provides data for the table. This must be the same for all leaf items in a table. Note: Unless your tables are read-only, where no events are ever invoked on the tables (navigation, sorting, etc.), you can not have two tables on the same page based on the same view object. Table event handling results in modifications to the state of the underlying view object (range start, range size, etc.) and to the values of the view attributes. If you have two tables based on the same view object on the same page, any event on one table alters the content and state of the other table too. View Attribute- Enter the name of the particular attribute within the view object that provides data for this column. Read Only - Set this property to False if you want the column to be updateable. Total Value -Set this property to True to enable totalling on this column. See the section on Totalling for additional information. Sort Allowed - Set this property to yes to enable sorting on the column. See the section on Sorting for more information. Initial Sort Sequence - Set this property to specify the level at which this column is sorted when the page first renders. Refer to the Sorting section for more information. Note: The optional property Export View Attribute allows you to specify a different view attribute from which to export data for the leaf item. In other words, if you specify a value for this property, and a user selects an export function to export data from the table's parent page or region, the data that is exported for this leaf item is from the view attribute specified in the Export View Attribute property, and may not be identical to the data displayed. 509
Note: Refer to the Oracle 9i JDeveloper OA Extension online help or to the Oracle Applications Component Reference for more information about the specific properties you can set on the children of a table.
Runtime Control
When OA Framework first renders your table, it does not automatically execute the query on the view instance for performance reasons. To complete this implementation, you must perform one programmatic step. Include code in your controller to bind in your parameters and execute the view instance to populate the table with data. You can find an example of how this is done in oracle.apps.fnd.framework.toolbox.labsolutions.server.EmployeeFullVOImpl.java and oracle.apps.fnd.framework.toolbox.labsolutions.server.EmployeeAMImpl.java, of Task 3: Implement the View Object Query of the Toolbox Tutorial Lesson 3: Details Page exercise. Note: If a table is empty, then by default, it can display one of two possible messages. If the query associated with the table's view object has not been executed, the default text that appears in the empty table is "No search conducted." However, if a search has been conducted, but fetches no rows, the default text that appears in the empty table is "No data exists." You can override both of these defaults by including code in your controller to display alternate text if the table is empty. The table constructs the bean hierarchy, executes any attached controller, and then performs post-processing that sets up most of the default behavior of the table in an OATableBean method called prepareForRendering. To change the default behavior at runtime, please refer to the sections describing the table features and components you want to modify. Generally the modifications fall under two possible scenarios with respect to prepareForRendering: Scenario 1: Modify the table before calling the prepareForRendering method. Suppose the modification you plan to make involves calling a public API on the OATableBean. The API is invoked in the controller and causes changes in the behavior of the table before prepareForRendering is called. In this case, prepareForRendering takes these changes into account when it prepares the default behavior of the bean. An example of this scenario is when you want to include the Add Another Row button to the column footer of a table. To accomplish this, you must call setInsertable(true) in your controller before calling prepareForRendering. Scenario 2: Call prepareForRendering first, then modify the table. Some modifications require you to explicitly invoke prepareForRendering within a controller first and then alter the resulting table. To support this, OA Framework executes prepareForRendering once and only once. It detects if prepareForRendering has been executed and does not execute it again so as to preserve any modifications you make to the table after explicitly calling prepareForRendering. An example of this scenario is when you want to change the default label on the Add Another Row button in the column footer. Your controller code would first call setInsertable(true) and then call prepareForRendering to render the Add Another Row button, as described in scenario 1. After prepareForRendering sets up the default table behavior, your code would need to get a handle on the column footer by calling getColumnFooter and then use the setText API from oracle.cabo.ui.beans.table.AddTableRowBean to change the button text. // A controller attached to a region above the table processRequest(...) { ... OATableBean tableBean = (OATableBean) webBean.findChildRecursive("<tableName>"); if (tableBean != null) { // enable row insertion tableBean.setInsertable (true);
510
// prepare table properties tableBean.prepareForRendering(pageContext); // override the add row button attribute OAAddTableRowBean addRowBean = (OAAddTableRowBean)tableBean.getColumnFooter(); addRowBean.setText("Add 5 Rows"); } ... } Event Handling There are two event points in the controller at which you can hook in code to modify the behavior of a table: processRequest and processFormRequest. processRequest - As mentioned earlier, OA Framework calls prepareForRendering after the processRequest phase. You can include code in the controller of the table bean or its parent bean to explicitly call prepareForRendering and modify the table. processFormRequest - Table events are HTTP requests that are trapped and processed by OA Framework and handled during the processFormRequest phase. The various table events are: Navigation - user selects the Next or Previous link to navigate between different ranges of rows. Sorting - user selects a beveled column heading to sort that column in ascending or descending order. Insertion of a new row - user selects the Add Another Row button. Recalculate column Total - user selects the Recalculate button to update the column total. Detail Disclosure - user selects the Hide or Show link to collapse or expand the detail disclosure region. Table Control - user selects the Action/Navigation button in the table Control bar. You may also wish to familiarize yourself with the set of UIX "hidden" fields so you can capture these events and implement custom behavior on them. The "hidden" fields are UIX attributes in the UIConstants interface. These parameters are set only when a form submit event is induced from a table. They are: SOURCE_PARAM - indicates the source of the event that is generating the current browser request. This maps to the name attribute of the web bean. If you wish to check whether a table generated an event, you include in your code: if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM))) { ...} EVENT_PARAM - indicates the event generated by a web bean (a table, in this case). The possible events generated by a table are: GOTO_EVENT - when 'Next' or 'Previous' navigation links are selected SORT_EVENT - when a column header is selected to sort that column HIDE_EVENT - when the 'Hide' link of a detail disclosure is selected SHOW_EVENT - when the 'Show' link of a detail disclosure is selected ADD_ROWS_EVENT - when the 'Add Another Row' button is selected UPDATE_EVENT - when the total row 'Recalculate' button is selected VALUE_PARAM - indicates a value that is relevant to a particular event: When a detail disclosure Hide/Show is selected, the value parameter contains the row index corresponding to the row whose Hide/Show was selected. When the 'Next' or 'Previous' link of table navigation bar is selected, the value parameter contains the index of the first row of the current range. For example, when the row range 1-10 is displayed, the value is 1 and when the row range 11-20 is displayed, the value is 11. SIZE_PARAM - indicates the number of rows currently displayed in the table (relevant only to the navigation event). STATE_PARAM - indicates the current sort state (ascending or descending) of the column on which 511
To check for the "Add Rows" event: if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM))) && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) { ... }
Personalization Considerations
You can personalize limited aspects of a table. See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Declarative Implementation
To implement a row header, you need only specify a value for the Row Header View Attribute property on the table in OA Extension. The Row Header View Attribute is the view associated with the table that determines the values for the row headers. Just as the table column view attribute supplies values for the cells of that column on query execution, the Row Header View Attribute supplies values for the row header cells.
Runtime Control
In OA Framework 11.5.57 and above: You can also set the row header programmatically in the controller using the accessors provided on the table bean: // To get the row header view attribute, if any tableBean.getRowHeaderViewAttributeName(); // To set the row header view attributetableBean.setRowHeaderViewAttributeName(); 512
In OA Framework 11.5.56 and prior: Note: This section is intended for Oracle Applications developers only as historical reference. The following three UIX properties associated with the oracle.cabo.ui.beans.table.TableBean need to be specified to enable row headers in a table: rowHeaderStamp rowHeaderData rowHeaderFormats The row header DataObjectList supplies a DataObject for each row in the table. Each DataObject has these three properties associated with it. Following is an example of how to programmatically implement row headers in a table in OA Framework 11.5.56 and prior. The example creates two row headers called Current and YTD. processRequest { ... tableBean.prepareForRendering(pageContext); // Use translated strings rather than hard-coded English DictionaryData[] rowHeaderData = new DictionaryData[2]; rowHeaderData[0] = new DictionaryData("rowHeaderText", "Current"); rowHeaderData[1] = new DictionaryData("rowHeaderText", "YTD"); OAStaticStyledTextBean rowStamp = (OAStaticStyledTextBean) createWebBean(pageContext,STATIC_STYLED_TEXT_BEAN); rowStamp.setTextBinding("rowHeaderText"); tableBean.setRowHeaderData(new ArrayDataSet(rowHeaderData)); tableBean.setRowHeaderStamp(rowStamp); }
Personalization Consideration
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Column Headers
The column header provides the heading for the column and is defaulted from the Prompt value of the table children.
Declarative Implementation
The header text of a column is set by the value that you enter in the Prompt property for the corresponding item in OA Extension.
Runtime Control
The following three UIX properties associated with the UIX TableBean enables column headers in a table: columnHeaderStamp 513
columnHeaderData columnHeaderFormats To turn off column headers that OA Framework adds by default, use the following code example. Note that the code renders the table inaccessible. processRequest { ... tableBean.prepareForRendering(pageContext); tableBean.setColumnHeaderStamp(null); ... }
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Navigation
The navigation bar allows you to traverse across different row ranges of a table and is rendered at the top of the table if the number of rows in the table is less than 10 and is rendered at both the top and bottom of the table if the rows in the table is equal to or greater than 10. Further, no navigation bar is displayed if the number of rows in the view instance is less than the table Number of Rows Displayed property. When a user first navigates to the page, OA Framework does not know how many rows are being returned to the table. The navigation bar simply shows the Previous and Next links.
Once the user navigates through all the rows, the navigation bar displays the row range as a poplist so you can navigate directly to a specific range of rows, as shown below:
Declarative Implementation
There are no declarative steps necessary to implement the default behavior of the navigation bar. Note: If you have a wide table that requires horizontal scrolling, you can prevent the Next and Previous links from appearing off the screen, to the right, by setting the Width property of the table definition to 100%.
Runtime Control
For event handling, you can specify the following code in your controller's processFormRequest method to check for a navigation event: if (GOTO_EVENT.equals(pageContext.getParameter(EVENT_PARAM)) { ... } To check whether the 'Next' link or 'Previous' link is selected: if ((tableBean.getName().equals(SOURCE_PARAM)) && (GOTO_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))) { String value = pageContext.getParameter(VALUE_PARAM); if (value != null) 514
{ int val = Integer.parseInt(value); int newRangeStart = val - 1; if (tableVO.getRangeStart() < newRangeStart) { // next pressed ... } else { // previous pressed ... } } } Navigation and Performance The table rendering logic brings in only the rows you need in an incremental fashion. In other words, if your table display size is 10 rows, then only the first 10 rows from the query are brought in to the middle tier. If you press the Next link, another 10 rows are brought in from the database through the JDBC cursor. This is called Incremental Fetch logic. Time spent on network roundtrips is conserved by bringing in rows only on demand. This is also the reason why the total row count is unknown when the table is first rendered and the poplist in the table navigation area does not initially appear. Once the fetch is complete, a poplist always displays, even as you navigate back and forth with the Previous and Next links.
Personalization Considerations
Not applicable.
If multiple selection is enabled for a table, OA Framework renders a control bar and a Selection column that displays a checkbox.
515
Users can use the Select column to select a specific row or rows and then choose a control such as a button or poplist on the control bar to apply an action on the selected row(s). In the case of multiple selection, the table filter area, located above the Select column, also contains the Select All or Select None links, allowing you to quickly select or deselect all your rows.
Declarative Implementation
Step 1: To enable table selection, select your table region in the Structure pane of OA Extension. Display the context menu and under New, choose either the singleSelection or multipleSelection named child. If you choose singleSelection, OA Framework renders a Selection column with radio buttons, so you can select a single row in the table. If you choose multipleSelection, OA Framework renders a Selection column with checkboxes, so you can select multiple rows in the table. Note: The selection bean (column) is always rendered with a default label of Select, in accordance with the BLAF guidelines. This default label cannot be changed. Step 2: Using the Property Inspector, set the following properties on the singleSelection or multipleSelection named child: ID - specify an identifier that uniquely identifies the item. Refer to the OA Framework File / Package/ Directory Standards for guidelines on defining an ID. View Instance - specify a view object instance for this selection child. View Attribute - specify a view attribute for this selection named child. Note that the view attribute must be a String, such as "Y" or "N", or a Boolean (0 or 1). Step 3: You can optionally add selection buttons to the control bar. In the Structure pane, select the selection named child that you just created in the previous step. Display the context menu and under New, choose selectionButton. This is a special type of submit button that is added as an indexed child of the selection bean. Once UIX finds that the selection bean has one or more indexed children, it renders a control bar in the table and puts the selection button(s) there. Step 3: The Select All and Select None links in the table filter area appear when the table selection named child is multipleSelection.
Runtime Control
OA Framework applies the check/unchecked values of the table selection to the corresponding view attributes. You can use your controller to identify which records are selected and then take programmatic action from there. A code example of how to locate rows with certain attribute values is available in the Iterating View Object Rows section of Chapter 5: View Objects in Detail. Disabling One or More Rows of Single or Multiple Selection If you wish to disable one or more rows of single or multiple selection in your table, add the following code to your controller processRequest method: OATableBean tableBean = ...; tableBean.setSelectionDisabledBindingAttr("Disabled"); "Disabled", in the example above, represents the Boolean view attribute that returns 1/"Y" if one or more rows is (are) to be disabled, otherwise it returns 0/"N". Note that the view attribute "Disabled" must belong to the same view object as the one associated with the table items. Setting the Table Selection Text You can also programmatically set the text in your table selection bar by calling the following in your controller: tableBean.setTableSelectionText("<newText>"); This should precede any call to prepareForRendering in the controller. Modifying the Control Bar The following code illustrates how you can suppress the control bar: processRequest { 516
... // NOTE: this must be called prior to prepareForRendering() tableBean.setControlBarDisplayed(false); ... } In some occasions, you may want to add something other than a button to the control bar. Following is a controller code example that illustrates how you can add an action poplist to the table selection control bar: // first prepare the Table Bean for rendering tableBean.prepareForRendering(pageContext); // get a handle on the Table Selection Bean OAWebBeanTable tableSelectionBean = (OAWebBeanTable)tableBean.getTableSelection(); // dynamically create your PopList and Button etc OAMessageChoiceBean myPoplist = (OAWebBeanChoice)createWebBean(pageContext, MESSAGE_CHOICE_BEAN); myPoplist.setListViewObject(...); myPoplist.setListDisplayAttribute(...); myPoplist.setListValueAttribute(...);
// The following is required according to the accessibility standards // to set the alt text value for the poplist myPoplist.setShortDesc(...); OASubmitButtonBean myButton = (OASubmitButtonBean)createWebBean(pageContext, BUTTON_SUBMIT_BEAN); myButton.setText(...); // add the PopList, Button etc to the Table Selection Bean tableSelectionBean.addIndexedChild(myPoplist); tableSelectionBean.addIndexedChild(goButton);
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Table Actions
Table actions are global table-level action components that are rendered in the control bar of the table. Prior to 11.5.10E, you had to define tableLayout-rowLayout-cellFormat web beans above the table to include global action items for the table. Now, using the UIX tableActions named child, you can define any number of items under a flowLayout or rowLayout. Generally, submitButtons and on rare occasions, poplists, are defined in this area. The tableAction component is also supported in HGrid and Gantt regions.
Declarative Implementation
Step 1: To define table actions, select your table region in the Structure pane of OA Extension. Display the context menu and under New, choose the tableActions. This automatically creates a tableActions named child consisting of a flowLayout region. Step 2: Specify a standards-compliant ID for the region and leave the Region Style as flowLayout or set it to rowLayout. Suggestion If you have only buttons to add to the table actions area, then you can use either layout styles, flowLayout being preferrable. However, if you are adding message web beans such as messageChoice or 517
messageTextInput, along with buttons to the table action area, then you should use the rowLayout style. Using a flowLayout instead of a rowLayout in this case may cause alignment problems. Step 3: Under the Layout region, layout the children you want to render as table actions, such submitButton or messageChoice. Select the Layout region, and choose New > Item from the context menu. Select the new Item that is created and set the item style as appropriate.
Runtime Control
There is no runtime control code necessary to implement table actions.
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Sorting
A table column can be sorted by a user at any time, and can also be automatically sorted when the page is initially rendered, (known as initial sorting). In the case of initial sorting, you can sort your table based on one, two or three columns of data. When a column is sortable, the column heading appears beveled, but does not display the sort direction arrow icon until the user selects the column heading to sort the column. If a user selects a beveled column heading to sort, the sort direction is ascending and displayed as such through the sort direction arrow that appears. If the user selects the sort direction arrow again, it toggles to the opposite direction, in this case, sorting the column in descending order. If a table is initially sorted, the column set as the first level of sorting displays the sort direction arrow icon, that is, until the user sorts another column, at which point the sort direction arrow icon appears in that column header.
Declarative Implementation
To enable sorting on a table column, you need to set the Sort Allowed and Initial Sort Sequence properties on the item (column) of interest. The following list identifies the possible combination of values you can set on these two properties and how they affect sorting: Initial Sort Sequence Result Sort Allowed Column is not sortable and is not no none initially sorted when the table is rendered. The column is sortable and is also yes first,second, or third initially sorted as either the first, second, or third level of sorting performed on the table, in ascending direction (default), when the table is rendered. The column is available for sorting yes none by the user, but is not initially sorted when the table is rendered. The column is available for sorting ascending or descending none by the user, but is not initially sorted when the table is rendered. This usage should not be used. Instead, set Sort Allowed to yes, and Initial Sort Sequence to none to achieve the same result. The column is sortable by user in ascending or descending first, second, or third the specified direction and is also 518
initially sorted as either the first, second, or third level of sorting performed on the table. Enabling Internal Sorting On Another View Attribute Generally, you can specify sorting on a table when you define the table. In some cases, especially when you use a raw HTML column with a HTML link, you may want the sorting to occur on the link value displayed in the user interface rather than on the actual link value itself (with <a href ...). To accomplish this, you can set the Sort By View Attribute property on the region item, to the name of the view object attribute on which you want to sort. If this property is not set or set to null, sorting is performed on the view attribute name associated with the table column. Attention If a table column contains a nested region, such as a switcher region, and you want to enable sorting on this region, it is mandatory that you set the Sort By View Attribute property on the region.
Runtime Control
Restrictions and Limitations of Sorting Sorting is performed by requerying the database. Sorting may not work well with view objects that contain custom 'expert-mode' SQL. Basically the view object setOrderByClause is invoked on the view object using the column name associated with this web bean. An alternative for 'expert-mode' SQL may involve overriding the view object setOrderByClause and performing custom logic. Note: The orderByParameter contains the column name and either desc or asc. Sorting does not work with view objects that contain the view attribute expression "See the SQL...". To sort on these view attributes, modify the view object XML directly and change the view atttribute expression to the SQL column name. Sorting is not allowed for tables that allow inserts. Sorting is not supported for tables containing updateable columns (unless the updateable columns are mapped to transient view object columns). No exception is thrown if the table contains updateable columns, since there may be a rare case when it makes sense, as in a table where the contents fit on one page. Modified transient columns are reset. This is normal and expected behavior. Sorting is not supported on the Select column, the optional first column of a table that contains a checkbox or radio button. Sorting is disabled when the Select column is checked for a row in a table or when Hide/Show is present in a table. See Sorting with Table Selection and Hide/Show for more information. Sorting is not supported on table rows created in the middle-tier. The table bean invokes the following two methods on the view object to perform sorting: viewObject.setOrderByClause(orderByClause); viewObject.executeQuery(); Debugging can be performed by setting a break on these methods on the view object (or a superclass of the view object). You can programmatically make a column sortable by using the isSortable and setSortable methods on oracle.apps.fnd.framework.webui.beans.OAWebBeanDataAttribute. Refer to the following code as an example: // We assume that all children of the table are those that implement // OAWebBeanDataAttribute // Alternately, the exact bean type can be used, such // as OAMessageStyledTextBean. OAWebBeanDataAttribute webBean = (OAWebBeanDataAttribute) tableBean.findIndexedChildRecursive("<columnName>"); webBean.setSortable(true); Enabling Internal Sorting On Another View Attribute 519
You can also programmatically enable internal sorting on another view attribute. For example, suppose you have a view attribute named Emplink. When you click on the sort icon of the table column for Emplink, you want the actual internal sorting to occur on the Ename attribute. You can programmatically control this as follows: OATableBean table = (OATableBean)createWebBean(pageContext, webBean, "EmpTable"); OAWebBeanDataAttribute empno = (OAWebBeanDataAttribute)table.findChildRecursive("<EmpnoItemID>"); empno.setSortByAttributeName("Ename"); If this sort by attribute is not set or set to null, sorting is performed on the view attribute name associated with the table column. Sort with Manually Populated Transient Attributes When you try to sort a column in a table that has one or more manually populated transient columns, the transient value are lost upon sorting. This is because the query is executed by OA Framework. In order to avoid this, you can use the following solution: 1. Encapsulate the logic to populate transient columns (view attributes) in a method. 2. On a sort event, redirect back to the same page in processFormRequest. 3. In processRequest, handle the redirect, by calling the tableBean prepareForRendering followed by a call to the method that populates transient columns. Sorting with Table Selection and Hide/Show By default, when the selector item is checked in a table that supports table selection, the underlying view object attribute value is updated. This action leaves the view object with pending changes (even for a view-only table). When the view object is in this state, table sorting is disabled. If you need the ability to sort the table under these circumstances, follow these steps: Step 1: Define a transient view attribute for the selector item using the BC4J view object wizard in JDeveloper. Do not add a dynamic attribute by calling ViewObject.addDynamicAttribute. Step 2: If you want the transient attribute value for the selector item to persist after sorting, define the transient attribute at the entity object level instead of at the view object level. Step 3: Following the OA Framework coding standards, you should always generate an OAViewRowImpl for each view object so you can call named accessors. In this case, override your set<AttributeName>() method as shown below: public void setSelectFlag(String val) { populateAttribute(SEELCTFLAG, val); } This example assumes the selector's view attribute is named "SelectFlag," and the code is calling the populateAttribute() method to set its value without marking the view object as being "dirty." A similiar situation occurs when Hide/Show is present in a table. See Entity Object and View Object Setters in Chapter 5 for additional information.
Personalization Considerations
If you expect your users to personalize the sort order of a table, do not set explicit order by statements in your view objects. Instead, use the Initial Sort Sequence and Sort Allowed properties in OA Extension. When the table is rendered the first time, OA Framework provides an order by statement on the view object based on how you set these properties. For more information on how to personalize the sorting of data in a table, refer to Admin-Level Personalizations in the Personalization Guide. As of OA Framework 11.5.10, if you define an end-user personalizable page, where the classic table under the query region, contains a nested region column (such as a table content switcher), users will be able to sort on that column in the Create/Update/Duplicate View page. Previously in OA Framework 11.5.7, users were not able to set a nested region column as a sort column in the Sort Settings because that column was not exposed in the Column Name poplist. Note that when a user specifies the nested region column as the column to sort, the actual content that 520
is sorted will depend on what you set the Sort By View Attribute property to for the column. If a user sets sorting on a nested region column using the Create View page, but finds that the change is not taking effect on the table, it is likely that the Sort By View Attribute property on the nested region column was not set. In this case, the personalization administrator would have to set the Sort By View Attribute property on that column using the Admin Personalization UI. If you do not want sorting on the nested region to be modified by users, you can set the User Personalization property to False so that the nested region does not display in the Column Name poplist of the Create View page's Sort Settings. See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Adding Rows
OA Framework displays an Add Another Row button to the table footer if a table is insertable.
Note: When you add another row, the row is added as the last row in the current range. The existing last row in the current range is pushed into the next range. You can also add new rows to a detail table that is associated to some master row via a detail view instance. In the past, you had to setAutoInsertion(false) on such a table, and handle row insertions yourself. Now, you can add rows automatically to detail tables because foreign keys are automatically populated for a table associated with a detail view instance of some master row. Of course, you still have to setAutoInsertion(false) if there is custom SQL in the view link, or if you have to perform some custom population of detail row data.
Declarative Implementation
There is currently no declarative implementation available for adding another row to a table. If you want to allow new rows to be added to a detail table (as in the case of a Table-in-Table, Detail Disclosure drilldown, or a master-detail template), then in addition to specifying setAutoInsertion(true) in your controller code, you must also attach the master and detail tables together by specifying an identical value in the View Link Name property of both the master and detail tables. Note: Auto-insertion in detail tables only work for cases where the view link has no custom SQL.
Runtime Control
OA Framework renders an optional Add Another Row button in the column footer, if the table is programmatically marked as insertable by calling setInsertable(true) in your controller before calling the prepareForRendering method. When a user selects the Add Another Row button, OA Framework calls processFormRequest and adds a new row to the view instance associated with the table, at the bottom of the visible range. If the table region is programmatically marked as insertable, OA Framework creates an OAAddTableRowBean and designates it as the columnFooter named child of the OATableBean. If the OATableBean, is also 521
configured to total column values, then the total bean (see the Javadoc for oracle.apps.fnd.framework.webui.beans.table.OATotalRowBean) becomes an indexed child of the OAAddTableRowBean. You can make various modifications to a column footer. Modifying Column Footers - Example 1 You can change the label on the Add Another Row button, by getting a handle to the Add Another Row button and modifying its prompt. processRequest(...) { ... // Prepare the table before accessing column footers tableBean.prepareForRendering(pageContext); // Get a handle to "Add Another Row" button OAAddTableRowBean addRowBean = (OAAddTableRowBean)tableBean.getColumnFooter(); if (addRowBean != null) { addRowBean.setText("<newCustomText>"); } ... } Modifying Column Footers - Example 2 The other change you can make is to suppress the default Add Another Row button behavior of adding a single row to the view instance associated with the table so you can handle the event with your own code. The following code example illustrates how to accomplish this: processRequest { ... // Enabled add row and turn off the default "Add Another Row" table event // The add row event has to be auto-handled by developer in processFormRequest tableBean.setInsertable(true); tableBean.setAutoInsertion(false); ...} processFormRequest { ... if ((tableBean.getName()Equals(pageContext.getParameter(SOURCE_PARAM))) && (ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))) { OAApplicationModule am = pageContext.getApplicationModule(tableBean); am.invokeMethod("handleInsertRow", null); } ...} // The ***AMImpl.java in which method "handlInsertRow" has been defined public void handleInsertRow() { OAViewObject vo = findViewObject("voName"); vo.invokeMethod("handleInsertRow"); } // The ***VOImpl.java which is associated with the table; and in which the // handleInsertRow is defined 522
public void handleInsertRow() { Row row = createRow(); // Set any default attributes row.setAttribute(...); ... // Insert the row into the VO insertRow(row); } Modifying Column Footers - Example 3 The following code example shows how you can change the default Add Another Row button, so that it instead displays Add 5 Rows and adds five new rows instead of one: processRequest { ... tableBean.setInsertable(true); tableBean.setAutoInsertion(false); tableBean.prepareForRendering(pageContext); OAAddTableRowBean addRow = (OAAddTableRowBean)tableBean.getColumnFooter(); // In general, rather than use hard-coded strings, use messages from // the message dictionary to set UI text. addRow.setText(Add 5 Rows); ... } processFormRequest { ... if ((table.Bean.getName().equals(source)) && (ADD_ROWS_EVENT.equals(event))) { // invoke method on view instance that will add 5 rows ... } } Note: If you add multiple rows to a table, the new rows are shown at the bottom of the current range, pushing any existing rows into the top of the subsequent range. You should only add, at most, a number of rows that is less than or equal to the number of rows displayed in your table. Add Another Row and View Object Execution If the view object associated with the table is not executed and you select "Add Another Row", you get a state loss error on the page. For any successful table event, the table view object query must be executed before a table event occurs. In the case where you do not want to display any rows when the page renders, yet want to let the user select "Add Another Row" to add rows into the table, then before you add rows to the table, you must properly initialize the view object as described in the Initialization Guidelines. Empty Rows In A Table Multiple empty rows can be added into a table when any of the following occur: When your code inserts rows into the view object before the table renders, so the table displays new blank rows. When a user selects the 'Add Another Row' button multiple times. When a user selects the 'Add n Rows' button, which you have programmatically implemented to add 'n' rows into your view object. In any of these cases, if the user does not enter values into some of the rows, you must include logic to recognize those empty rows (if any), and remove them from the view object. For example, if you prepopulate 523
ten new empty rows in an expense reports table, but the user enters only three expense lines, you must provide code to recognize and remove the remaining seven empty rows from the view object.
Personalization Consideration
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Totalling
OA Framework supports the totalling of numeric values in a table column. If totalling is enabled in a table, the table footer displays a column total and a Recalculate button, as shown below. The total displays a double precision summation of all visible rows in the table. Note that the total reflects only the current visible records and not all the records queried and that the content of the totalled column is automatically right aligned. Note: Totalling can be enabled for any column except for the first column in a table. Note: You cannot total columns in the inner table of a Table-in-Table.
Declarative Implementation
You can tabulate a total for a table column if the column data type is a number and it is not the first column in the table. To create a total for a column, set the Total Value property in OA Extension to True for the corresponding region item. Note: Totalling is supported only on items immediately under a classic table. It is not supported on regions, such as a messageComponentLayout region, under a classic table. If the region item associated with the totalled column is updateable, that is, Read Only is False, a Recalculate button also appears to the left of the Total. OA Framework can support totals for one or more columns.
Runtime Control
If the column data displays currency, you can programmatically set the currency code to tabulate a currency total. Use the setCurrencyCode(String) method on OAWebBeanDataAttribute to do this. The oracle.apps.fnd.framework.webui.OAWebBeanConstants public constant CURRENCY_CODE, which is defined on the web beans, formats the contents of the Total cell according to the precision and format of the specified currency. The OATotalRowBean implements totals in the column footer. If the Total Value property in OA Extension is set on the table region, OA Framework creates an OATotalRowBean and specifies it as the columnFooter named child of the OATableBean. If OATableBean is also configured to insert rows (so it has an Add Another Row button), then OATotalRowBean becomes an indexed child of the add table row bean (see OAAddTableRowBean), which OA Framework in turn designates as the table's columnFooter object. Controlling Tabular Values 524
If you wish to implement a total on a table column programmatically, call the method setTabularFunctionCode(TABULAR_FUNCTION_SUM) on the web bean. This method places the total value column footer. If you wish to bypass OA Framework's mechanism to control the value generation for a table column footer (such as the total) so you can provide your own value (such as a percentage), you should set the OAWebBeanConstants TABULAR_FUNCTION_VALUE_ATTR on the appropriate table column. This overrides OA Framework's internal behavior of footer value generation. Like all web bean attributes, you can data bound this attribute if required. Sample usage: OATableBean tableBean = ...; OAMessageStyledTextBean salaryBean = tableBean.findChildRecursive(...); String formattedTotal = ...; // compute the total salaryBean.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR,formattedTotal); or: salaryBean.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR, new OADataBoundValueViewObject(...)); Updating the Recalculate Button Label If you wish to change the prompt for the Recalculate button (and there is no Add Another Row button present in the column footer) : processRequest(...) { ... // Prepare the table before accessing column footers tableBean.prepareForRendering(pageContext); // Get a handle to total row bean. NOTE: This code sample assumes that // there is NO "Add Another Row" button. If present, see next example. OATotalRowBean totalRowBean = (OATotalRowBean)tableBean.getColumnFooter(); if (totalRowBean != null) { totalRowBean.setText("<newCustomText>"); } ... } If you wish to change the prompt for the Recalculate button and there is an Add Another Row button present in the column footer, then use the following code example (which gets a handle for both the add another row and total row beans): processRequest(...) { ... // Prepare the table before accessing column footers tableBean.prepareForRendering(pageContext); // The column footer will be the "Add Another Row" button OAAddTableRowBean addRowBean = (OAAddTableRowBean)tableBean.getColumnFooter(); if (addRowBean != null) { addRowBean.setText("<newCustomText>"); // The total row bean will be an indexed child of the add row bean int childCount = addRowBean.getIndexedChildCount(); for (int i = 0; i < childCount; i++) 525
{ OAWebBean webBean = (OAWebBean)addRowBean.getIndexedChild(i); if (webBean instanceof OATotalRowBean) { OATotalRowBean totalRowBean = (OATotalRowBean)webBean; totalRowBean.setText("<newCustomText>"); break; } } } ... }
Personalization Consideration
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Detail Disclosure
Detail disclosure is also known as a row-level Hide/Show in a table, as described in the BLAF Guidelines for Tables [OTN version].
Note: The BLAF Hide/Show guidelines for Tables [OTN version] do not allow embedding secondary or children objects in the details of a table row. This means that you should not create a hideShow or hideShowHeader region under the detail region of a table. (To display hierarchical information in a table, see HGrids). Similarly, you should not create a hideShow region under an inner table of a Table-in-Table or implement detail disclosure inside the inner table of a Table-in-Table.
Declarative Implementation
You can define the detail disclosure in a table as follows: Step 1: Select the table region in the Structure pane of OA Extension. Under New in the context menu, select Detail. This creates a detail named child that you can use to show additional information for any row in the table. The recommended UI layout for the region is labeledFieldLayout. The default region style of the detail region is header, but you can change the style, if required, and add children to the region.
526
Step 2: For the table region, set the Detail View Attribute property to the name of the Boolean/String ("Y" or "N") attribute (of the same view object as that of the other table columns) that determines the shown or hidden state of the detail child of the rows. Note: Specifying the named child detail region alone is sufficient to enable the addition of a row-level Hide/Show. You do not need to explicitly add a hideShow as the detail region. Show All Details/Hide All Details To hide or show all the detail disclosures in a table simultaneously, you have to set the All Details Enabled property for the table to True in OA Extension. OA Framework/UIX ensures that the Hide All Details | Show All Details links automatically render at the top of the table. Selecting Show All Details expands all the detail disclosure regions, and selecting Hide All Details collapses all the detail disclosure regions.
Runtime Control
You can also set in your controller, the properties discussed in the Declarative Implementation section above: import oracle.apps.fnd.framework.webui.beans.table.OATableBean; ... OATableBean tableBean = (OATableBean)webBean.findIndexedChildRecursive("<tableBeanName>"); // Set the detail named child OAWebBean detailNode = (OAWebBean)...; // Get a handle to the detail node tableBean.setDetail(detailNode); // Set the detail view attribute name tableBean.setDetailViewAttributeName("<detailViewAttributeName>"); // Turn on the "Hide All Details | Show All Details" links tableBean.setAllDetailsEnabled(true); ... For information on nested tables or table inside detail disclosure, refer to table-in-table. 527
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Table-in-Table
If you have number of records that are inter-related, you can display them in tabular form using a table bean. This is an intuitive way to display data that is independent of other entities. Table-in-Table allows all interrelated information, typically master-detail relationships, to be seen and updated on one page by embedding an inner table within an outer table. This is possible because you can add a table bean as a named child of another table. The information in the inner table is based on the corresponding master row in the outer table. The inner table associated with each row is opened/closed using the Hide/Show links that appear in the Details column as shown in the sample table-in-table user interface below.
The inner table bears a master-detail relation with the outer table. For each master row, corresponding detail rows are displayed in an inner table. Users can control the rows in the inner table by defining additional search criteria to the criteria already defined in the view link, which relates the outer view object with the inner view object. Note that a table-in-table user interface can be costly in terms of performance because multiple view objects and the bean hierarchy are created and replicated at runtime. Performance cost is reduced when the inner table is read-only because the same view object can be reused. The creation of the view object attached to a detailed section is done during rendering time. If you never open the detailed section of a row, the view object is not created. So if you have ten master rows in the outer table and you open the detail section of only two rows, the performance cost is only for those two rows. You can make the inner table editable by adding form-elements in the inner table so the data is pushed to the view object just like a regular table. The inner table also supports navigation, sorting, adding another row, single and multiple selection, row-level and column-level banding and exporting to a Microsoft Excel spreadsheet. 528
Note: The inner table does not support totalling. The totalling feature in the inner table is part of the advanced tables infrastructure only.
Declarative Implementation
To create a table like the one shown above, you need to define the region definition in xml using OA Extension, and add code in your controller. Xml Structure Step 1: Select the (outer) table region in the Structure pane of OA Extension. Under New in the context menu, select Detail. This creates a detail named child that you can use to show additional information for any row in the table. The default style of the detail region created is header. The detail region becomes the header for your inner table.
Step 2: Under the inner table header region, create an region of style table, to become your inner table.
529
Step 3: Follow the standard instructions for defining a table to create your inner table. Step 4: For the outer table region, set the Detail View Attribute property to the name of the Boolean/String ("Y" or "N") attribute (of the same view object as that of the other table columns) that determines the shown or hidden state of the detail child of each row. Note: The BLAF Hide/Show guidelines for Tables [OTN version] do not allow embedding secondary or children objects in the details of a table row. This means that you should not create a hideShow or hideShowHeader region under the detail region of a table. (To display hierarchical information in a table, see HGrids). Similarly, you should not create a hideShow region under an inner table of a Table-in-Table or implement detail disclosure inside the inner table of a Table-in-Table.
Runtime Control
After creating the XML page structure, you need to initialize some properties on the beans in your code. As a example, suppose your BC4J setup is as follows: 1. View object is DeptVO. 2. Primary Key of DeptVO is Deptno. 3. View object is EmpVO. 4. DeptVO and EmpVO are connected by a view link called DeptEmpVL. The two view objects are connected by the query WHERE DEPTNO = :1. 5. Application module contains the two view objects and the view link. Note: The view link is used in the master-detail relationship to display the correct detail rowset. To achieve the table-in-table display, you would add these lines in your controller: public void processRequest(...) { OAWebBean outerTable = (OAWebBean)webBean.findChildRecursive("outerTable"); OAWebBean innerTable = (OAWebBean)webBean.findChildRecursive("innerTable"); if (outerTable != null) 530
{ outerTable.setAttributeValue(CHILD_VIEW_ATTRIBUTE_NAME,"Deptno"); outerTable.setAttributeValue(VIEW_LINK_NAME,"DeptEmpVL"); } if (innerTable != null) { innerTable.setAttributeValue(CHILD_VIEW_ATTRIBUTE_NAME,"Deptno"); innerTable.setAttributeValue(VIEW_LINK_NAME,"DeptEmpVL"); } ... } Note: The two properties that are set in the example above are required for the proper functioning of the bean ID generation and master-detail relationship. If you omit any of the above, you may end up with a JavaScript error or see incorrect records in the inner table. RowSets The table-in-table detail template (inner table) uses the RowSets interface to interact with the OA Framework Model. When you query data using a view object, the results of the query are stored in a RowSet. Each RowSet can have multiple iterators which allows scrolling through the set of rows and each view object can have multiple RowSets. As a result of the RowSet implementation, if you want to handle rows manually in a table-in-table, you'll need to go about it differently than when you handle rows in a regular table. Generally, with a table, you can get a handle to the table view object and manipulate it, such as by adding or deleting a row, and see the change reflected on the UI. This is not the case for the inner table of a table-in-table. As a matter of fact, any changes that you make to the detail view object is never even considered. To insert a new row or update the state of an existing row in an inner table, you must create an oracle.apps.fnd.framework.webui.OAInnerDataObjectEnumerator and use it to get a handle to the RowSet attached to the inner table. Once you have the RowSet, you can manipulate it in any manner and the changes are reflected in the UI. In previous versions of OA Framework, OAInnerDataObjectEnumerator used to scroll through the different view objects associated with each inner table. Now since a RowSet is associated with each inner table, the behavior of this enumerator has been updated. Following is an example of how to use the enumerator to go through the rows of a RowSet attached to an inner table: // get a handle to inner table OATableBean innerTable = (OATableBean)webBean.findChildRecursive("InnerTableBean"); // create an enumerator OAInnerDataObjectEnumerator enum = new OAInnerDataObjectEnumerator(pageContext, innerTable);while (enum.hasMoreElements()) { RowSet innerRowSet = (RowSet) enum.nextElement(); // get all rows Row []rowsInRange = innerRowSet.getAllRowsInRange(); for (int i = 0; i < rowsInRange.length; i++) { Row nextRow = (Row) rowsInRange[i]; if ("Y".equals(nextRow.getAttribute("DeleteFlag"))) { // delete the marked row nextRow.remove(); } } // In case you want to add new rows in this RowSet, you can do the same 531
OARow newRow = (OARow) innerRowSet.createRow(); // initialize value for some attribute and insert the row newRow.setAttribute("SomeAttr", "SomeValue"); innerRowSet.insertRow(newRow); } // In case you want to change the WhereClause of the containing view object OAViewObject innerViewObject = (OAViewObject) innerRowSet.getViewObject(); String newWhereClause = "DEPT.LOC = :1"; innerViewObject.setWhereClause(newWhereClause); // Each RowSet can now bind parameter specific to each inner web bean The association of a RowSet instead of a view object to the inner table improves the performance of a table-intable. The amount of memory and other JDBC resources required is limited because all RowSets of an inner table are part of the same view object, and therefore share the same query. Also the implementation of a tablein-table is now consistent with other web beans of similar hierarchical nature. The master table is always in synchronization with the inner table, because any change in the master table triggers changes in the inner table via a view link. Note: If you use the OAInnerDataObjectEnumerator in the processRequest method, you may not be able to scroll through the RowSets because they may not yet be created. A RowSet for an inner table is created only when a user actually displays the inner table in the UI.
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Formatting a Table
There are several ways to format a table, both declaratively and programmatically. They are as follows: Full Table Formatting - affects the table as a whole. Column Formatting - affects only the columns of the table. Row Formatting - affects only the rows of the table. Column Header/Row Header Formatting - affects only the column headers or row headers of the table. Refer to the section of interest for additional information.
532
Declarative Implementation
The easiest way to change the appearance of a table is to change its width, done by changing the Width property on the table region in OA Extension. Although the width can be specified by pixels or percentages of the width of the parent element, percentages are commonly preferred. Note: that no matter what value you specify for the table width, if the width is not large enough to accommodate the table content, the value is overridden at display time to take up the minimum amount of necessary space.
Runtime Control
The UIX TableBean tableFormat object determines banding in a table. If a table Format DataObject is set on the table, it is queried for format information applicable across the entire table rendering. Currently, the table format DataObject is queried for the type of banding to render, using the key tableBanding (UIConstants.TABLE_BANDING_KEY). If the table format DataObject returns the UIConstant, ROW_BANDING, the table data rows alternate colors. If it returns the UIConstant, COLUMN_BANDING, the table columns alternate colors. Otherwise, no banding is rendered (the default). If the table format indicates that banding is desired, the table format DataObject is also queried with the BANDING_INTERVAL_KEY. If this key returns an Integer greater than 1, that interval is used as the number of rows or columns to group in a band. For instance, if a row-banded table returns "2" as the banding interval, the table alternates two dark rows with two light rows over the course of the rendering of the table. The default is the integer 1. The following controller code example illustrates how you can set row banding or column banding on a table: import oracle.cabo.ui.data.DictionaryData; ... processRequest(...) { ... OATableBean tableBean = ...; DictionaryData tableFormat = tableBean.getTableFormat(); if (tableFormat == null) tableFormat = new DictionaryData(); // Set either column banding (COLUMN_BANDING) or row banding (ROW_BANDING) tableFormat.put(TABLE_BANDING_KEY, COLUMN_BANDING); // Set the table format tableBean.setTableFormat(tableFormat); ... } The UIX oracle.cabo.ui.beans.table.TableStyle class also provides a convenient way to set most table, row, or column formatting options. The following example illustrates how you can enable row and column banding on a table using the UIX TableStyle class: import oracle.cabo.ui.data.DictionaryData; import oracle.cabo.ui.beans.table.TableStyle; ... processRequest(...) { ... OATableBean tableBean = ...; // Set both column banding (COLUMN_BANDING) and row banding (ROW_BANDING) 533
TableStyle tableFormat = new TableStyle(TableStyle.ROW_BANDING | TableStyle.COLUMN_BANDING); // Set the table format tableBean.setTableFormat(tableFormat); ... }
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Column Formatting
You can modify the formatting of a table's columns as follows: Alter the alignment of a column's content. Turn on/off the line wrap within the cells of a column. Alter the width of a column. Turn on/off the display of the grid line to the left of a column. Only one type of column formatting is set automatically, and that is the alignment of a column's content. The alignment of a column's content is based on its content's data type: Start justified - for characters and dates. End justified - In 11.5.9, all numbers are End justified. In11.5.10, numbers that are totalled or have currency code set are End justified. For all other numbers, the alignment is Start justified. Center justified - for icon images and button.
Declarative Implementation
There is declarative support for one column formatting option in OA Extension, and that is to enable or disable cell content wrapping for the columns of a table. Set the No Wrap property to False (default) for an item under a table region to enable the wrapping of a column's cell content. You can also modify this column format programmatically, as discussed in the Runtime Control section.
Runtime Control
The TableBean columnFormats object determines the column format of a table. To modify a column's formatting, you can use the TableBean getColumnFormats method. This method returns a DataObjectList. Each DataObject in the list corresponds to one column from left to right in the table format. You specify formats inside each DataObject to alter the formatting of each column accordingly. These formatting DataObjects store their values under the following known, publicized keys (UIConstants): Note: If a DataObject returns a value for a key, the value is used to change the column format, if not, the table assumes the default format. COLUMN_DATA_FORMAT_KEY (columnDataFormat) - Although OA Framework automatically sets column content alignment based on the column content data type, you can programmatically override the default using this key. This property can return any one of three legal values depending on the object in the column and/or its data type. All three values are UIConstants: TEXT_FORMAT (textFormat)- column content is Start justified. NUMBER_FORMAT (numberFormat)- column content is End justified. ICON_BUTTON_FORMAT (iconButtonFormat)- column content is center justified. CELL_NO_WRAP_FORMAT_KEY (cellNoWrapFormat)- This property determines whether the cell should be rendered with line wrapping disabled. It is often used for LOV or date fields. To override the default, return Boolean.TRUE to render the cell in the column without wrapping the contents. The default behavior is to wrap the cell contents because disallowing wrapping can cause tables to become too wide, and is thus discouraged. WIDTH_KEY (width)- This property returns a string that represents your recommended column width. It can be used to indicate what percentage of extra width in the table this particular column should take. If 534
a table takes up more space than its content needs, the table apportions that space among its columns. However, some columns (like buttons) don't need any more space than the minimum they are given. Other columns, like those containing text, should take extra space if it allows them to reduce the number of lines needed to display their content. The width can be in pixels or percentages, like "50%" or "100%" to indicate how much of the extra space that column should receive.The total among all the columns should add to 100%. Note that if no column formats in the table request a specific width, the space is divided evenly among the data columns as much as possible. DISPLAY_GRID_KEY (displayGrid)- This property determines whether to display or suppress the vertical grid line to the left of your column. By default, a grid line is shown to the left of every column. But in some cases, you may want to use vertical grid lines more sparingly to emphasize the relationship between some columns and de-emphasize it between others. Return Boolean.FALSE to override the default by suppressing the grid lines. BANDING_SHADE_KEY (bandingShade)- This property determines the banding shade of a column, allowing you to control the banding patterns of your columns. Note that when you explicitly band a column, you override the use of banding specified by the table format DataObject. This key can return one of two UIConstants values: BANDING_SHADE_LIGHT (light)- a light shaded column BANDING_SHADE_DARK (dark)- a dark shaded column The following code example illustrates how you can override the default column format by forcing a column's content to not wrap. processRequest { ... tableBean.prepareForRendering(pageContext); // now get a handle on the array of Column Format Dictionaries DataObjectList myColumnFormats = tableBean.getColumnFormats(); // get a handle on the specific Column Format Dictionary you // are interested in oracle.cabo.ui.data.DictionaryData myIconColumnFormat = (oracle.cabo.ui.data.DictionaryData) myColumnFormats.getItem(pageContext.findChildIndex(tableBean,<yourChildItemName>) ); // set the CELL_NO_WRAP_FORMAT_KEY property to TRUE myIconColumnFormat.put(CELL_NO_WRAP_FORMAT_KEY, Boolean.TRUE); ... } Attention: If your table includes a column that contains a messageTextInput item and you change the column formatting for that column, immediately after your myColumnFormat.put() call, you should call the setDataAlignment(String dataAlignmentFormat) method of oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean on the messageTextInput item under that column. dataAlignmentFormat may only be TEXT_FORMAT or NUMBER_FORMAT, but should be set to match the column format. If you do not call the setDataAlignment method, the messageTextInput field itself will be aligned with the column header, but the data within the field will not be aligned.
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Row Formatting
OA Framework does not set any default row formatting, except to render a horizontal grid line above each row.
Declarative Implementation
There is currently no declarative support for formatting the rows in a table. 535
Runtime Control
The UIX TableBean rowFormats object determines the row format of a table. To modify a row's formatting, you can use the TableBean getRowFormats method. This method returns a DataObjectList. Each DataObject in the list corresponds to one row from top to bottom in the table format. You specify a format inside each DataObject to alter the formatting of each row accordingly. These formatting DataObjects store their values under the known, publicized key (UIConstants) DISPLAY_GRID_KEY. UIX queries each of the DataObjects for the DISPLAY_GRID_KEY property to determine if it returns BOOLEAN.TRUE or BOOLEAN.FALSE. Each one that returns BOOLEAN.FALSE from this query suppresses a grid line above that row. Note: If a DataObject returns a value for a key, the value is used to change the row format, if not, the table assumes the default format. The following code example illustrates how you can override the default row format by suppressing a row's grid line. processRequest { ... tableBean.prepareForRendering(pageContext); // now get a handle on the array of Row Format Dictionaries DataObjectList myRowFormats = tableBean.getRowFormats(); if (myRowFormats = null) { DictionaryData[] myRowFormats = new DictionaryData[size]; } // set the DISPLAY_GRID_KEY property to FALSE for the second row // which corresponds to index 1 in the DictionaryData array rowFormats[1] = new DictionaryData(DISPLAY_GRID_KEY, Boolean.FALSE);
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
Declarative Implementation
There is currently no declarative support for formatting the column headers and row headers in a table.
Runtime Control
To modify a column header or row header formatting, you can use the TableBean getColumnHeaderFormats or getRowHeaderFormats method, respectively. These methods returns a DataObjectList. Each DataObject in the list corresponds to one column header from left to right or one row header from top to bottom, in the table format. You specify formats inside each DataObject to alter the formatting of each column header or row header accordingly. These formatting DataObjects store their values under the known, publicized key (UIConstants) CELL_NO_WRAP_FORMAT_KEY. This property determines whether the column header or row header should be rendered with line wrapping disabled. To override the default, return Boolean.TRUE to render the column header or row header without wrapping the contents. 536
Note: If a DataObject returns a value for a key, the value is used to change the row format, if not, the table assumes the default format. The following code example illustrates how you can modify wrap settings for a column: // To modify wrap settings for the column named <columnName> if (tableBean.getColumnHeaderFormats() == null) { DictionaryData columnHeaderFormats[] = new DictionaryData[tableBean.getIndexedChildCount(null)]; int columnNumber = pageContext.findChildIndex(tableBean, "<columnName>"); columnHeaderFormats[columnNumber] = new DictionaryData(); columnHeaderFormats[columnNumber].put(CELL_NO_WRAP_FORMAT_KEY, Boolean.TRUE); tableBean.setColumnHeaderFormats(new ArrayDataSet(columnHeaderFormats)); } The following code example illustrates how to use the default wrapping information defined declaratively (using the No Wrap property) on the column (cell) for the column header: int childCount = tableBean.getIndexedChildCount(null); DictionaryData columnHeaderFormats[] = new DictionaryData[childCount]; for (int i = 0; i < childCount; i++) { columnHeaderFormats[i] = new DictionaryData(); // Get column wrapping info Boolean isWrapEnabled = ((OAWebBean)tableBean.getIndexedChild(i)).isWrapEnabled(); Boolean cellNoWrap = isWrapEnabled ? Boolean.FALSE : Boolean.TRUE; // Set header wrapping info columnHeaderFormats[i].put(CELL_NO_WRAP_FORMAT_KEY, cellNoWrap); }
Personalization Considerations
See a summary of Classic Tables personalization considerations in the Oracle Applications Framework Personalization Guide.
to 0 as well as part of the setRangeSize operation if the new range size is different from the current range size. ii. When you set the range size to a size that is potentially smaller than the current size (usually when you restore the original range size and start), then reverse the order -- that is, set the range size first and then the range start (since you may want to set the range start to a value greater than 0). These rules may sound a little odd and confusing to you, because BC4J performs some implicit fill up logic, but these rules are based on some heuristics and experiments. In general you should be careful when you use the setRangeSize and setRangeStart methods on a table view object. 4. The table rendering logic makes the following three assumptions to render a table without any extra logic that would degrade performance (to avoid unnecessarily re-setting and adjusting the range size multiple times): i. If you want the table to render properly, you should make sure the table view object range start is the default value 0 before the table bean is created and rendered for the first time. If your code performs row navigation through methods like the view object next or last methods before the table bean is rendered, these methods move the range start to a value greater than 0. (The view object methods first or previous moves up the range.) Please perform the following in this case:
Option 1:
int fetchedRowCount = vo.getFetchedRowCount(); if (fetchedRowCount > 0) { // Save the range start and size. int savedRangeStart = vo.getRangeStart(); int savedRangeSize = vo.getRangeSize(); // When you set the range size to a size that // is potentially larger than the current size,you should // set the range start first to 0 and then set the range size. vo.setRangeStart(0); vo.setRangeSize(fetchedRowCount); } Try: { for (int i = 0; i < fetchedRowCount; i++) { //Or you can use getAllRowsInRange() outside the for loop. Row row = vo.getRowAtRangeIndex(i); ... // Perform row operation. } } Finally: { // Restore the original range - do in finally clause, // in case action on row throws an exception. // When you set the range size to a size that is // potentially smaller than the current size // (usually when you restore the original range size and start), // then reverse the order // -- that is, set the range size first and then the range start. vo.setRangeSize(savedRangeSize); vo.setRangeStart(savedRangeStart); }
Option 2:
Alternatively, use a secondary iterator if you do not want to deal with messing up the default row set 538
range or row currency: RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter"); int fetchedRowCount = vo.getFetchedRowCount(); if (fetchedRowCount > 0) { deleteIter.setRangeStart(0); deleteIter.setRangeSize(fetchedRowCount); for (int i = 0; i < fetchedRowCount; i++) { Row row = deleteIter.getRowAtRangeIndex(i); ... } } finally { if (deleteIter != null) deleteIter.closeRowSetIterator(); } Note: You can also use the following convenience methods if you want to find rows matching some criteria: OAViewObject.getFilteredRows and OAViewObject.getFilteredRowsInRange. ii. Exception to assumption 1: If you redirect to current page with retainAM=Y in the URL, range start can be greater than 0 if the user is already in some range other than the first range. To preserve the current table range upon redirect, you should place the following check on the executeQuery call: if (!vo.isPreparedForExecution()) vo.executeQuery(); This is because executeQuery resets the range start to 0, which may not be what you want when you redirect with retainAM=Y. iii. If you programmatically set the number of rows displayed for the table, it takes effect only if the table view object range start is initially 0.
Known Issues
See a summary of key table issues with suggested workarounds if available
Related Information
BLAF UI Guideline(s) Tables [OTN version] Javadoc File(s) oracle.apps.fnd.framework.webui.beans.table.OATableBean oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean oracle.apps.fnd.framework.webui.beans.OAWebBean oracle.apps.fnd.framework.webui.beans.OAWebBeanDataAttribute oracle.apps.fnd.framework.webui.OAWebBeanConstants oracle.apps.fnd.framework.webui.beans.OAWebBeanTable oracle.apps.fnd.framework.webui.beans.table.OAAddTableRowBean oracle.apps.fnd.framework.webui.beans.table.OATotalRowBean oracle.apps.fnd.framework.webui.OAInnerDataObjectEnumerator 539
oracle.cabo.ui.beans.table.AddTableRowBean oracle.cabo.ui.beans.table.TableBean oracle.cabo.ui.beans.table.TableStyle Lesson(s) Framework Toolbox Tutorial Lesson 3: Exercise Sample Code FAQs Tables and Advanced Tables Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
540
Tabs / Navigation
Overview
In an OA Framework application, the menu of available pages is presented to the user in a tab-based model as illustrated in the following example from the OA Framework ToolBox Tutorial Application. Figure 1: OA Framework ToolBox Tutorial tabs
Within this basic model, individual applications are free to choose from a range of valid design options based on their complexity and expected usage patterns (see Oracle Browser Look and Feel (BLAF) UI Guideline: Tabs/Navigation [ OTN Version ] for a complete description of your design options).
Contents
Menu Concepts Declarative Implementation Menu Examples Runtime Control
Prerequisite Reading
Anatomy of an OA Framework Page Implementing the View
Menu Concepts
Menu Components
Depending on the design, menus are made up of the following components: Compone Illustration Description nt Global Provides access to tasks and content Menu that are application to the entire application. See Buttons (Global) for information on adding global buttons to your application. Represents the highest level of content Tab division within an application (also known as "Level 1" menus). Horizonta Filters the content associated with a l given tab (as known as "Level 2" menus) Navigatio For example, we included horizontal n navigation beneath the "Lessons 4 - 7" tab to provide access to each of these lessons. 541
Side Navigatio n
Filters content or actions (also known as "Level 3" menus). The side navigation can be used below a horizontal navigation element, below a tab without a horizontal navigation element, or on its own without any tabs as a simple list of actions/content. Side navigation menus can also include submenus (Levels, 4, 5, 6 +) that let you organize content into a hierarchy. See the illustration's "Enter Information" link and its "Company Information" and "Buyer Information" children.
Sub Tab
A tab-like control for switching content or action views in the page's content area. sub tabs can be used with a horizontal navigation element, with a tab and horizontal navigation elements, or with a side navigation. A bulleted list of tasks or properties displayed in the page's content area. The task/property menu is very scalable, and can be used in combination with any of the other menu elements.
Tip: If you want to know how to implement a "Quick Search" region beneath the menu as shown below, this special pageLayout property is described in the Search document. You do not define this as part of the menu itself. Figure 2: "Quick Search" region shown beneath a horizontal navigation menu entry.
542
Menu Context
When a user navigates to a specific page within an application for the first time (assuming the user has function security access), the OA Framework instantiates a oracle.apps.fnd.functionSecurity.NavigationContext object to keep track of the root level application menu and the current selected function so the menu can be rendered correctly. The NavigationContext object persists for the life of the session until a user selects a new menu option, or you reset it manually by either calling methods on the NavigationContext object at runtime, or by setting URL parameters. Note: Any function accessed from the Oracle E-Business Home Page (previously known as the Personal Home Page or simply PHP), a portlet, or from a test JSP must include the following URL parameters specifying the "Home Page" (root application) menu, and the page function to highlight in the menu. If you fail to do this, your page will render, but your menus will not. OASF=<SelectedFunctionName> - this tells the Framework to select this function in the given "Home Page" menu context. OAHP=<HomePageMenuName> - this is used ONLY with the OASF parameter, and it is used to establish the current menu context. It should point to a "Home Page" menu. For example, the following URL (split into lines for ease of reading) from the OA Framework ToolBox Tutorial test_fwktutorial.jsp illustrates how to use these parameters: <a href="<%=URLMgr.processOutgoingURL("OA.jsp?OAFunc=FWK_TOOLBOX_HELLO &OAHP=FWK_TOOLBOX_TUTORIAL_APP&OASF=FWK_TOOLBOX_HELLO &transactionid=" + transactionid, macKey)%>">Hello, World!</a><br> See Setting the Menu Context in the Runtime Control section below for information on manipulating these and other menu context values.
Applications Security
See the Page Security document for information about securing access to the pages in your application menu.
Declarative Implementation
Once you have a menu design, you should plan your implementation. The planning step is important, because you need to build your menus from the leaf nodes to the root menu entry, so you need to know how your menu is to be constructed before you start building it. As described in Implementing the View, OA Framework application menus are actually comprised of Oracle Applications 11i functions and menus. First, we look at how to create functions and menus in general terms, then we focus on how to implement specific menu types. Tip: Menus are cached in the middle tier. If you change a menu for an application that you're running within JDeveloper, remember to terminate the OC4J server (Run > Terminate) and re-run your .jsp page to see your menu changes. If you change a menu for a deployed application (as opposed to one that you're running within JDeveloper), remember to bounce the web application server's listener and JVM to see your menu changes.
Creating Functions
Regardless of what kind of menu you need to construct, each and every OA Framework page on the menu must have a corresponding function. Note that a single page can be called by many functions (each potentially passing different parameters through the URL), which means it can be used in many different menus. Generally, it's easiest to create all of your functions before you start building your menus. To create a function: 1. Start Oracle Applications 11i in your development environment and log in as SYSADMIN/SYSADMIN (or specify the corresponding username/password for your environment). For Oracle Applications 543
developers, use the JInitiator applications link published at the E-Business Development Services website for whatever environment you're using. 2. Select either the "System Administrator" or "Application Developer" responsibility. 3. Select Application > Functions from the main menu (the Functions form might also be in the "Top 10 List"). 4. To add a new function, simply start entering values in one of the empty Function rows. To add more rows (if you need them), select File > New from the main menu. Set values for the following properties (you will need to navigate through the form's content tabs to do this). Note that you can accept all the other default values. Function -- this is the unique developer key for the function, and as such it must be a unique value. You can name this whatever you wish, as long as you follow any naming conventions used by your product team (a typical example of this name is: WF_MONITOR_STATUS_DIAGRAM, which is the product short code followed by a descriptive name for the associated page). Note that this is the value that we will use when defining URLs for page access. User Function Name -- this is the unique, user-friendly version of the function name that displays when administering menus (for example, Workflow Monitor Status Diagram). Description - provides a short description of the associated page. Type -- for OA Framework pages, this should be set to JSP. Once this value is selected from the field's list of values, it will display as "SSWA JSP Function." HTML Call -- provides the mapping to the associated page. At runtime, whenever this function is invoked, the OA Framework knows to display the page identified in this property. The value that you specify should comply with the syntax OA.jsp?page=/oracle/apps/<appShortName>/<yourPackages>/webui/<PageName>/ as illustrated in the following examples: OA.jsp?page=/oracle/apps/dem/hello/webui/HelloWorldPG and OA.jsp?page=/oracle/apps/fnd/framework/toolbox/tutorial/webui/SupplierPG. Note that you can include static URL parameters in your function's HTML Call, or you can include tokens for runtime value substitution: OA.jsp?page=/oracle/apps/fnd/framework/toolbox/tutorial/webui/SupplierPG ¶m=staticValue¶m2={@tokenValue} If you include tokens, you must explicitly register them with the OA Framework by calling the oracle.apps.fnd.framework.webui.OAPageContext's setFunctionParameterDataObject(oracle.cabo.ui.data.DataObject tokens) method in the processRequest() method of a controller associated with the target page. The OA Framework obtains the token value from your DataObject at runtime by calling DataObject.selectValue(context, TokenKey), and then replaces the token with the value in your menu URL. See the OAPageContext.setFunctionParameterDataObject() Javadoc for additional information including a code sample. 5. To save your work, select File > Save from the main menu. Figure 3: OA Framework ToolBox Tutorial functions displayed i the Oracle Applications 11i Form Functions form.
544
To query an existing function: 1. Place your cursor in the field in which you want to enter query criteria and select View > Query By Example > Enter from the main menu. 2. Enter your search criteria (for example, entering FWK_TBX% in the Function field will find all Framework ToolBox Tutorial Application functions) 3. Select View > Query By Example > Run from the menu execute the query. 4. To cancel a query without executing it (so you can get out of query mode), select View > Query By Example > Cancel from the menu.
Creating Menus
To create a menu: 1. If you're already logged in, select the Navigator to choose the "Menus" form from the Application > Menus menu (or, it might also be in the "Top 10" list). 2. If you're not logged in, repeat steps 1 and 2 from the function creation instructions above and then find the "Menus" form as described in the previous step. 3. To create a new menu, simply start entering values in the blank fields. If you've viewing a menu and want to enter a new one, select File > New from the menu. Set values for the following properties. Note that you can accept all the other default values. Menu - this is the unique developer key for the menu. A typical example of this name is: WF_ADMINISTRATOR_APPLICATION (the product short code followed by a descriptive name for the menu). User Menu Name - this is the unique, user-friendly version of the menu name that displays when administering menus (for example, Workflow Administrator Application). Description - provides a short description of the menu. Menu Type - describes the menu's purpose as it relates to the OA Framework (we'll look at the valid options in detail below). 4. For each menu that you create, you must add one or more menu entries as shown below for the ToolBox Tutorial Application's "Lessons 4 - 7" tab menu definitions. Each menu entry includes the 545
following properties: Sequence - indicates how the menu entries should be positioned on the menu relative to their peers. Menu entries are rendered from left to right in sequence, or from top to bottom (depending on the kind of menu being rendered). Prompt - this is the value that displays in the menu. For example, when we added the Lesson 5 function to the Lessons 4 - 7 tab menu in the ToolBox Tutorial Application, we entered "Lesson 5" as the function's prompt. Submenu or Function - the user name of the submenu or function that you want to include at this point in the menu. Description - a brief description of the menu entry. Grant Flag - the security rule that you want to associate with your function. Uncheck the grant flag. You will find more information on security in Chapter 4: Page Security. 5. To save your work, select File > Save from the menu. Figure 4: OA Framework ToolBox Tutorial "HTML Tab" menu showing associated functions with an without prompts.
To query existing menus: 1. Place your cursor in the field in which you want to enter query criteria and select View > Query By Example > Enter from the menu. 2. Enter your search criteria (for example, entering FWK_% in the Menu Name field will find all Framework ToolBox Tutorial Application menus) 3. Select View > Query By Example > Run from the menu to execute the query. 4. To cancel a query without executing it (so you can get out of query mode), select View > Query By Example > Cancel from the menu.
Now that you know how to create functions and menus, this section describes how to implement specific menu types. The Menu Examples section that follows shows how to combine these individual menu types into standard configurations. Root OA Framework Application Menu All OA Framework applications require a root menu of type "Home Page." You should add all top-level menu components (like global buttons and tabs) directly to your "Home Page" menu as illustrated for the OA Framework ToolBox Tutorial application's "Home Page" menu below. Note: You must create a "Home Page" menu for your application regardless of whether or not it includes an actual "Home" page. Even if your application doesn't include any tabs or other menu components, you still must create this menu. Figure 5: OA Framework ToolBox Tutorial "Home Page" menu.
Global Menu See Buttons (Global) for instructions on adding standard global buttons like "Help" and "Preferences" and product-specific global buttons to your application. Tabs To include tabs in your application: 1. Create an Oracle Applications menu type of "HTML Tab" for each tab that you wish to display (the UI Guidelines state that you must have at least two tabs in an application if you have any; if you find yourself wanting to create a single tab, you should investigate a different menu design). 2. Add functions and submenus as appropriate: If your tab displays a single page when selected (without any horizontal navigation or side navigation below it), you can simply add the corresponding function directly to the tab menu. In this case, you should not specify a Prompt value. 547
If your tab has horizontal or side navigation components, see the topics on creating these menu components below. 3. Add the "HTML Tab" menu as a submenu beneath your "Home Page" menu. Remember to specify a Prompt value; this is used as the tab's label text (see the prompts for the OA Framework ToolBox Tutorial lesson submenus above). Note: If you add securing functions to your menu, remember to leave the Prompt field blank so they don't render as menu choices. Also, if you add multiple functions to an "HTML Tab" menu, the OA Framework always assumes the first one in sequence is associated with the menu entry. For example, if you define an "HTML Tab" menu and add the "Page A" function in sequence first and the "Page B" function in sequence second, the OA Framework will display the "Page A" function when you select the tab. Horizontal Navigation There are two ways to include horizontal navigation menu components in your application: you can simply add functions with a prompt beneath an "HTML Tab" menu, or you can create an "HTML Sub Tab" menu and add that to your "HTML Menu." Note: Even though this menu type is called "HTML Sub Tab," it has nothing to do with the "Sub Tab" menu component as described in Menu Concepts above. The following assumes that horizontal navigation components always render in relation to a tab; per the UI guidelines, they are not valid top-level menus. If you want to add horizontal navigation components beneath a tab -- and none of the horizontal navigation components have any side navigation beneath them -- simply add the corresponding page functions directly to your "HTML Tab" menu while remembering to specify a Prompt value for the horizontal navigation label text. For example, Figure 4 above the OA Framework ToolBox Tutorial menu definition for the "Lessons 4- 7" tab, which includes four horizontal navigation components (Lesson 4, Lesson 5, Lesson 6 and Lesson 7) Note the addition of securing functions without any prompts. Alternatively, if you want to include horizontal navigation components with side navigation menus: 1. For each horizontal navigation component to include side navigation, create an Oracle Applications menu of type "HTML Sub Tab." Tip: You can combine "HTML Sub Tab," and plain functions as peers beneath a single "HTML Tab" menu. Each one with a prompt renders as a horizontal navigation menu entry. 2. Create and add a menu of type "HTML SideBar" to the "HTML Sub Tab" menu. Do not specify a Prompt value (see the Side Navigation section below for additional information about this). 3. Add the "HTML Sub Tab" submenu to your "HTML Tab" menu. Remember to specify a Prompt value to display as the horizontal navigation label text. Note: If you add functions with prompts to your "HTML Sub Tab" menu -- instead of an "HTML Sidebar" menu -- the OA Framework will render them as side navigation links without any decoration (they render as plain links without bullets). You should avoid this approach, however, because it doesn't fully comply with the UI Guidelines (which expect that the links have bullets). It's also more robust to clearly define the menu hierarchy without skipping levels (we'll discuss this further in the Menu Examples section below). Side Navigation As described in the Horizontal Navigation section above, if you want to add a side navigation menu to your page, you should always create an "HTML Sidebar" menu for this purpose. If your side navigation includes a flat list of links, simply add a function for each like (with a prompt) to your "HTML Sidebar" menu. If your side navigation includes additional menu levels (4 ... N), create an "HTML SideList" menu for each level that you want to include and add functions and/or other "HTML SideList" menus as appropriate. Note: Do not try to attach multiple "HTML Sidebar" menus to an "HTML Sub Tab" menu; the OA Framework (and the UI Guidelines) allow only one side navigation menu per horizontal menu entry. Furthermore, never add an "HTML Sidebar" menu directly to an "HTML Tab" or 'Home Page" menu. All of that said, you can also create a side navigation programmatically to hold content that is unrelated to the menu (as of 11.5.10, you cannot create a side navigation declaratively). For example, the ToolBox Tutorial HomePage Lab illustrates how to create the following side navigation: 548
In this example , we created the "Search" and "Some Link" regions declaratively, and then simply instantiated and added them to the side navigation programmatically. We then specified that our side navigation component should be displayed in the page's "start" layout area (a page includes three layout areas: start, end, and everything in the middle. OASideNavBean sideNav = (OASideNavBean)createWebBean(pageContext, SIDE_NAV_BEAN, null, "hpSideNav"); // We're using a header because we don't want any indentation before // the start of the fields. Because we're using a simple header, we // also need to add vertical spacing between the beans per the guidelines. OAHeaderBean search = (OAHeaderBean)createWebBean(pageContext, "/oracle/apps/fnd/framework/toolbox/tutorial/webui/HomeSearchRN", null, // ignore item for regions true); // using JRAD OAHeaderBean quickLinks = (OAHeaderBean)createWebBean(pageContext, "/oracle/apps/fnd/framework/toolbox/tutorial/webui/HomeLinksRN", null, // ignore item for regions true); // using JRAD sideNav.addIndexedChild(search); sideNav.addIndexedChild(quickLinks); String quickLinksText = pageContext.getMessage("AK", "FWK_TBX_T_QUICK_LINKS", null); String searchText = pageContext.getMessage("AK", "FWK_TBX_T_SEARCH", null); // Note that you don't have to do anything to get the correct CSS style // for the header text/line. This is handled for you automatically // by virtue of rendering a header bean on a dark background. The only 549
// thing you do have to change is the header text size, which can't be // changes with a CSS class. Instead, use the setSize() method that all // header beans have (the default layouts are header beans). search.setSize(2); // 2 is the smallest header size search.setText(pageContext, searchText); quickLinks.setSize(2); // 2 is the smallest header size quickLinks.setText(pageContext, quickLinksText); // Note that you must call prepareForRendering() before setting your // side nav bean or it won't render. OAPageLayoutBean pageLayoutBean = pageContext.getPageLayoutBean(); pageLayoutBean.prepareForRendering(pageContext); pageLayoutBean.setStart(sideNav); Sub Tab Unlike the menu components that we've discussed until this point, the Sub Tab is not implemented using Oracle Applications menus. Instead, the Sub Tab is simply a special container region in your page's contents. See the Sub Tab Navigation document for additional information about implementing this component. Task / Property Menu Like the Sub Tab, a Task / Property menu is standard page content that is not implemented using Oracle Applications menus. See the Bulleted List document for information that will help you implement this in-page menu. Responsibility Menu As described in Implementing the View, a responsibility is a group of (presumably) role-related tasks. A user is granted access to one or more responsibilities, and this association determines the tasks that he can perform. To enable access to your new "Home Page" menu: 1. Create a new menu of type "Standard," or open a preexisting menu of this type. 2. Add your "Home Page" submenu to the "Standard" menu, but do not specify a Prompt value. Note that you can associate multiple "Home Page" menus with a single responsibility menu. 3. Decide which page or pages you want to expose in the Oracle E-Business Home Page (for example, "Application X" might have 5 different tabs, but you only want to display a link to the "Application X Home" page in the PHP menu). Add these functions to your "Standard" menu. 4. Create a new responsibility as shown in Figure 7 below, and associate your selected "Standard" menu with it (each responsibility references one and only one menu). 5. Ensure that your user has access to the responsibility you created/opened in the previous step. After you complete these steps, your responsibility root menu should contain your "Home Page" menus (with no prompts), and the functions (with prompts) you want a user to be able to select from in the Navigator. Warning: It is essential that all the functions accessed from the E-Business Home Page include the OAHP and OASF parameters as described in the Menu Context section above. This enables the OA Framework to identify the "Home Page" menu and current function to select. Without these values, the menu will not render correctly. Figure 7: OA Framework ToolBox Tutorial responsibility definition
550
Summary: Rendering Rules This section summarizes the key rules the OA Framework uses when rendering menus: Whenever the OA Framework shows a page, it always highlights the menu path to that page so you know visually where you are within the menu hierarchy (assuming the menu context has been established correctly). It begins by rendering the selected function, and then traverses the selection path, rendering each node on the path and all of its siblings. Note that the OA Framework assumes that all siblings (menus at the same level) are of the same menu type as the selected node.. For example, if you have a mix of tab and side navigation menus at the same level, and one of the tab menus is on the selection path, the OA Framework renders all of these siblings as tabs. Tabs and subtabs inherit the URL of the first accessible child leaf function within its menu hierarchy . If you have the following menu: Tab X > Horizonal A > (Function1, Function2, Function3), the OA Framework automatically renders Function1 when you select Tab X or Horizontal A. The OA Framework renders menus only if they include one or more accessible functions. If for example, your application's menu definition includes five tabs, but only four of them include accessible functions, the fifth will not render. Pages Without Menus If you want to create a page with no "chrome" (no tabs, global buttons and so forth -- typically required when 551
you display content in a secondary browser window), you should define the page without a pageLayout region. In this case, simply create the page starting with a stackLayout, a header with a messageComponentLayout, or whatever other layout you need for your content. If the page has form elements, you must remember to add a form to your page. For example, a typical layout might look like: stackLayout // top region for the page |-- form | -- everything else Without a pageLayout region, the OA Framework won't try to display any menu components, so you don't need to programmatically hide them.
Menu Examples
OA Framework application menus are comprised of the following levels: 1. Tab 2. Horizontal Navigation 3. Side Navigation 4. Indented Side Navigation (as many levels as needed). Now that you know how to create each of these menu types, you need to understand how to use them in relation to one another. The single most important rule that you should follow is this: even if your menu doesn't display a menu entry at a given level, you should not "skip" it in the structure. So, as you'll see in the individual examples below, even if an application includes only a side navigation (without any visible tabs or horizontal menu entries), the tab and horizontal menu entry must still exist in the menu structure.
No Tabs
As illustrated in Figure 8 below, this menu includes a single function that renders without any tabs. Although difficult to see in the conceptual diagram, note that the function's prompt displays in the blue bar below the branding. Figure 8: Conceptual drawing of a page with no tabs or other menu components
To achieve this effect in your application: 1. Create a function for your page. 2. Create a menu of type "Home Page." 3. Create a menu of type "HTML Tab" and add it to your "Home Page" menu without a prompt (so the tab doesn't display). Note you should not add functions directly to your "Home Page" menu. Remember the rule that you should not skip menu levels, even if they are not displayed. 4. Add your function to the "HTML Tab" menu. Remember to specify a Prompt value. 5. Add your "Home Page" menu to your responsibility menu. 552
6. Make sure your user has access to this responsibility before you try to test the menu.
3. Create a menu of type "HTML Sub Tab" for the horizontal navigation menu entry. Add it to the "HTML Tab" menu that should include the side navigation men. Specify a Prompt value. 4. Create menu of type "HTML Sidebar" and add it to the "HTML Sub Tab" menu without a prompt. 5. Add your page functions to the "HTML Sidebar" menu. Specify a Prompt value to display for each corresponding link. 6. Create a menu of type "Home Page." 7. Add the "HTML Tab" menus to the "Home Page" menu. Specify a Prompt value to display for each corresponding tab. 8. Add your "Home Page" menu to your responsibility menu. 9. Make sure your user has access to this responsibility before you try to test the menu.
Runtime Control
554
Setting the Menu Context In OA Framework applications, users can often navigate freely between related applications. For example, while working in a "Projects" module, a user might want to place a purchase order or initiate a buyer's auction - two tasks that live within a "Procurement" module. When the user navigates from Projects to Procurement, the corresponding application menus should change to reflect the context switch. To implement this -- and other related behaviors -- simply specify the following URL parameters: OAMC=R removes the current menu context. You would use this when navigating to a page that should not display a menu, and there is no reason to preserve the menu context (for example, an access error page). OAMC=K keeps the current menu context. This is the default behavior if the OAMC is not present on the URL. OAMC=N keeps the current menu context, but without displaying a menu (so if the user selects a button in the page where you don't want the menu to be displayed, the original menu context is still intact). You would use this when navigating to a dialog page in certain situations. OASF=<FunctionName> Select the given function in the current menu context. If it does not exist move up the menu hierarchy to find a best match for a "Home Page" menu and this function as the selected function. OAHP=<HomePageName> Use only with OASF to change the menu context to the new "Home Page" and selected function. By setting both OAHP & OASF you can provide your starting point MenuContext, which is something you would commonly do if the user navigates from one application to another. You can also make achieve the same behavior programmatically by setting appropriate values in one of the oracle.apps.fnd.framework.webui.OAPageContext setForward*() methods, or by calling one of the OAPageContext resetMenuContext() methods.
Personalization Considerations
None
Known Issues
None
Related Information
BLAF UI Guidelines Tabs/Navigation [ OTN Version ] Developer's Guide Buttons (Global) Bulleted List Javadoc OA Framework ToolBox Tutorial / Sample Library Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
555
Tree
Overview
As described in the Oracle Browser Look-and-Feel (BLAF) UI Guideline: Tree [OTN version] specification, the Tree control allows users to quickly browse through complex sets of hierarchical objects and displays the relationship between the sets of objects in a hierarchy. You generally implement a Tree for the purpose of allowing users to select objects from a hierarchy or to display the Master/Detail information for a hierarchy of objects.
Contents
Tree Description Defining Business Components Defining a Tree Component Declarative Implementation Runtime Control Defining a 3-Frame JSP Page for Use with the Tree Component Declarative Implementation Runtime Control Personalization Considerations Known Issues Related Information
Tree Description
The Tree control shares many similarities with the HGrid feature, which displays objects in a hierarchy, but in a tabular format. A Tree is generally used when you want to put emphasis on the hierarchy and the relationship between different sets of objects in a hierarchy. A HGrid is more appropriate when you want to display the hierarchy, but also give more detailed information at each node of the hierarchy. Consider using a Tree control instead of a HGrid if you want your users to either: Select an object from the hierarchy, and then continue with a task that does not require display of the hierarchy. Display hierarchical Master/Detail content, and select an object in the hierarchy to display object details on the same page (on the right). A Tree consists of a set of nodes structured in a parent-child hierarchy. Each node consists of three display attributes: text, image, and a URL (rendered as a link). The top level of the Tree is called the set of root nodes. Each node in a Tree can contain the following object: Parent Object - a container that also has object details. It may contain other parent objects, child objects, or just containers only. It appears as link text and has an associated hide/show icon that allows you to expand or collapse the tree at that node. Container Only - a container (only) that does not have object details. It may contain parent objects, child objects, or other containers (only). It appears as plain text, and has an associated hide/show icon that allows you to expand or collapse the tree at that node. Child Object - an object that is not a container, but has object details. It may not contain anything. It appears as link text, but does not have an associated hide/show icon. A node containing a child object is also referred to as a leaf node. Following is an example of a Tree control containing objects within folder containers that do not have object details. Figure 1: A Tree component containing objects within folder containers that do not have object details.
556
view object attached to the Tree. The first step in defining a Tree is to define the business object hierarchy that map to your business requirements. To illustrate the above, you can build a simple Tree example to display supervisor-employee hierarchy information. (Note that some of the data model is greatly simplified for this example.) The data for each employee comes from the PER_ALL_PEOPLE_F view. Each employee is uniquely identified by the PERSON_ID column in this view. The PER_ALL_ASSIGNMENTS_F view describes the supervisor-employee relationship through the SUPERVISOR_ID and PERSON_ID columns in this view. Step 1: Set up a view object definition for the PER_ALL_PEOPLE_F view, selecting the data that you want to display in the Tree. You can download oracle.apps.fnd.framework.persontree.server.PerAllPeopleFVO as an example. You can also download the corresponding VOImpl class. Note that the initQuery method in the VOImpl adds an additional where clause to the view object to fetch the root node. Step 2: Define the view link used to retrieve subsequent levels of the Tree. In this example, define a view link that links the PerAllPeopleFVO to itself. a. In JDeveloper, select the package to which you want to add the view link. Right click and choose the "Create View Link ..." option to bring up the "View Link Wizard". b. In the View Link Wizard, Step 1 of 6: Name, enter a name for the view link (PerAllPeopleFVL in this example). c. In Step 2 of 6: View Objects, choose the source and destination view objects. In this example, PerAllPeopleFVO is used as both the source and destination. d. In Step 3 of 6: Source Attributes, select the source attributes. These typically are the primary key attributes (or a subset thereof) of the source view object. You may also want to select other columns that are needed to build the where clause used to fetch the detail row set. The values of these attributes from the master view object are used to determine the detail row set. For this example, use the PERSON_ID column as discussed earlier. e. In Step 4 of 6: Destination Attributes, select the destination attributes (as in the previous step). f. In Step 5 of 6: View Link SQL, build the where condition used to get the detail row set. The default where clause simply contains a one-to-one mapping of the source and destination attributes. The bind variables are bound with values of the source attributes in the master row. In this example, use the PER_ALL_ASSIGNMENTS_F view to determine all the persons supervised by the person in the master row. In other words, construct a where clause as follows: person_id in (select person_id from per_all_assignments_f where supervisor_id = :1) g. In Step 6 of 6: View Link Properties, ensure that the Generate Accessor in View Object checkbox is checked for both the Source and Destination view objects. The accessor name is generated automatically but you can change it if desired. h. You can download the complete definition for PerAllPeopleFVL. You can similarly setup additional view links if the master-detail relationships at each level of the Tree are different. Step 3: Add the view objects and view links you created to the application module used for the page. Note that adding the view link to the application module using the Application Module Wizard can be tricky. First add the view objects to the application module. Then to add a view link, select the view link in the left column and select the source view object in the right column. This enables the ">" shuttle control and you can move the view link over to the right.
the BLAF guidelines for display usage [OTN version]. Instructions to implement this usage are described in the Defining a 3-Frame JSP Page section. Note To implement the BLAF guideline for a no-frame page that displays a tree structure in the Side Navigation area and the details of the selected object in the page content area to the right, you should refer to Chapter 4: Tabs/Navigation.
Declarative Implementation
To create a Tree component for the purpose of allowing a user to view sets of records and their relation to one another, you define a region that contains a region item of style tree. This Tree Level region item maps to the root of the Tree Bean. The Tree Level region has two nested region items: a Tree Definition and a Tree Child. The Tree Definition region item describes the node of the tree and the Tree Child region item points to a Tree Level nested region. This allows OA Framework to build complex hierarchies in a declarative way. The definition of a Tree bean is created by specifying the following metadata in OA Extension: Step 1: Define a top level region and set the Region Style property to tree. You may specify an optional controller and application module for the tree region, by setting the Controller Class and AM Definition properties, respectively. You can nest the Tree region within a container region such as Page Layout, Header, Stack Layout, or messageComponentLayout. Step 2: The Tree region defines the root level in the tree hierarchy. The Tree region can have two types of named children (members): nodeDefinition - The nodeDefinition item automatically appears when you set the Region Style to tree. It defines the appearance of the node in the hierarchy. For the nodeDefinition item, specify: a value for the View Instance property to associate the node with a view instance. a value for the View Attribute property, to render the view attribute name as the text of the node. a value for the Icon URI property if you want to render an image next to the text in the node. a value for the Destination URI property to render the node as a hyperlink. childNode - In the Structure pane, select members under the Tree region and display the context menu. Under New, select childNode. The childNode item holds the view link, which defines the parentchild relationship between tree levels. To achieve a loop in your tree, such as a Manager to Employee recursive relationship, set the Ancestor Node property on the childNode item to indicate the region to which you want to loop back. The Ancestor Node property can be set to another tree region, to the same tree region (for a recursive relationship), or to no tree region (null, indicating that the node is a leaf level in the hierarchy tree). The ancestor node should be set as a fully-qualified path name such as /oracle/apps/<applshortname>/<module>/<pagename>.<ancestor region name> where the ancestor region is whatever region (node) you are looping back to. Attention: For a recursive relationship, as indicated above, you set the ancestor node to the same tree region. However, the "same tree region" refers to the parent of the base recursing node and not the recursing node itself. See the Sample Library for an implementation of a tree region with a recursive relationship, as shown in the figure below.
559
If you need to achieve multiple levels of nodes in your tree, such that the levels do not loop back to an ancestor, you can do so by selecting the last childNode item in the Structure pane, and from the context menu, choose New > Members to nest another node level until you achieve the multi-level tree structure you need. Note that if you do not require your tree to loop back to some parent node, you do not need to set the Ancestor Node property on the childNode items.
Set the View Link Accessor property on each childNode item to the view link accessor name that should be used to retrieve the child node at that level. 560
Note: Prior to OA Framework 11.5.10D, the view link instance used to retrieve the child nodes at a particular level was set via the child node's View Link Instance property. This property is now deprecated and is present only for backwards compatibility. You should only use the View Link Accessor property on the child node to specify the view link instance.
Runtime Control
The last step in defining a Tree is to setup a controller. Refer to the sample controller class PersonTreePageCO to continue with the person tree example discussed in the Defining Business Components section. processRequest method As is the case with other components in OA Framework, use the processRequest method for any custom layout code. Initialize the view object for the root node in this method. Note You must execute the query on the root view object. In the earlier original implementation of the Tree, the Tree used to automatically execute the query for the root view object. To ensure backward compatibility, this behavior is still present in OA Framework 11.5.57, however, moving forward, you should consider this behavior deprecated. processFormRequest method You can use the processFormRequest method to process form events from the page containing the Tree. From a Tree, you should access data only via the business components. Please look at the PersonTreePageCO for code that walks the business component tree. Refer to the oracle.apps.fnd.framework.webui.OATreeQueriedRowEnumerator Javadoc for additional information.
Defining a 3-Frame JSP Page for Use with the Tree Component
To use a tree component to display hierarchical master/detail content in a 3 frame page as per the BLAF guidelines [OTN version], you must call OAFrame.jsp, which renders three HTML frames (herein referred as Top, Start and Center) within a frameset. Figure 2: Three Frame Example of a Master/Detail Tree
The BLAF guidelines currently certifies the 3-frame page template for the following use only, in other words, this is the ONLY frame usage allowed in BLAF applications: The Top frame renders the branding image, global icons and/or menu structure. No application content should be displayed in this frame. The Start frame renders the summary information in a hierarchical view (in the form of tree). This frame should not contain the page header or footer. 561
The Center frame renders the content with just the page footer and no header. Selecting a link in the Start frame (a tree node) refreshes the content in the 'Center' frame. By default, OA Framework currently uses 20% of the size for the width of the Start frame and the remaining for the Center frame. It also defaults the height of the top frame to 175 pixels. You have the option of overriding these default dimensions when you invoke OAFrame.jsp to render the frameset.
Declarative Implementation
Step 1: Create the source(content) for the Top frame. Since the top frame can only render header information such as a branding image, global icons and/or a menu structure, refer to the following topics in Chapter 4 for additional information: Branding, Buttons(Global), and Tabs/Navigation. Step 2: Create a new page in OA Extension to render the header information specified in Step 1. Be sure to define a pageLayout region in this page. Step 3: Create the source for the Start frame. The Start frame renders the summary information using a Tree web bean. This frame does not contain a page header or footer. In the Structure page, select the page you created in Step 2, and choose New > Region from the context menu. Set the Region Style for this new region to a defaultStackLayout. Although this region is deprecated, it is needed to ensure proper layout and to render the FORM HTML tag, which is needed for the tree to work properly. Under the default layout region, choose New > Region from the context menu. Set the Region Style for this new region to tree. Define the members for the tree region. For each tree members' nodeDefinition, enter a URI value for the Destination URI property and append to the URI, the value OAPLRS=PLNH. This parameter ensures that the page header information does not render in the Center frame. For example: OA.jsp?page=/oracle/apps/fnd/framework/toolbox/tutorial/webui/SupplierDetail sPG&supplierName={@Name}&supplierOnHold={@OnHoldFlag}&supplierId={@Supplie rId}&OAPLRS=PLNH For each tree members' nodeDefinition, enter OACFr as the value for the Target Frame property. This sets the Center frame as the frame to refresh when a user selects a node in the rendered tree hierarchy. Step 4: Create the source for the Center frame. The Center frame renders the page content of the selected tree node, with the page footer. Define a page in OA Extension with the content required. Be sure to define a pageLayout region in this page so that the page footer can be rendered. Note that the same page can be used for both the Top and Center frame. Step 5: Create separate form functions for each frame's source. A function is a token that is registered under a unique name for the purpose of assigning it to, or excluding it from, a responsibility. The names of your functions are later passed on the URL using the OAFUNC parameter. Attention: For the form functions that you define for the Top and Center frames' source, the HTML Call that you specify in the Web HTML region of the Oracle Applications Form Functions screen must include the OAHP and OASF parameters to ensure proper menu rendering. See the Menus Concept section in Chapter 4: Tabs/Navigation information about these parameters. Step 6: Invoke OAFrame.jsp to render the frameset. OAFrame.JSP expects all three function names as a single parameter string delimited by a colon: OAFrame.jsp?OAFunc=<OATFRAME>:<OASFRAME>:<OACFRAME> where: OATFRAME can be replaced with the name of your function used to render the Top frame. OASFRAME can be replaced with the name of your function used to render the Start frame. OACFRAME can be replaced with the name of your function used to render the Center frame. You may also add the OAFRDIM parameter to the OAFrame.jsp to override the default dimensions of the frames: 562
OAFrame.jsp?OAFunc=<OATFRAME>:<OASFRAME>:<OACFRAME>&OAFRDIM=<width:height> where: OAFRDIM is the name of the parameter used to override the default Start and Top frame dimensions. The width and height values are delimited with a semicolon (:). width - a value in pixels or percentage that determines the width of the Start frame. Specify the letter 'p' at the end of the value to denote a percentage value. height - a value in pixels or percentage that determines the height of the Top frame. Specify the letter 'p' at the end of the value to denote a percentage value.
Example 1
Specify the width of the Start frame as 50 pixels and the height of the Top frame as 15 pixels: OAFrame.jsp?OAFunc=<OATFRAME>:<OASFRAME>:<OACFRAME>&OAFRDIM=50:15
Example 2
Specify the width of the Start frame as 50% of the size and the height of the Top frame as 15% of the size: OAFrame.jsp?OAFunc=<OATFRAME>:<OASFRAME>:<OACFRAME>&OAFRDIM=50p:15p
Runtime Control
The Target Frame property can be programmatically set. Here is a code example of how to set the targetFrame attribute from the controller of the tree: ... // supplierNodeDefRN is the member node of the Tree region. OAWebBean node = webBean.findChildRecursive("supplierNodeDefRN"); if (node != null) {node.setAttributeValue(TARGET_FRAME_ATTR, OAWebBeanConstants.CENTERFRAME_NAME); } ... Note OAWebBeanConstants.CENTERFRAME_NAME is a public constant that you can use. Below are other public constants: TOPFRAME_NAME STARTFRAME_NAME OA_PAGELAYOUT_RENDER_STYLE - Parameter name to specify the page layout render style. Possible values are PAGELAYOUT_HEADER_ONLY and PAGELAYOUT_NO_HEADER. You can use this when setting the Destination URI attribute programmatically. PAGELAYOUT_HEADER_ONLY PAGELAYOUT_NO_HEADER Menu Tab Content Display If a user selects a menu tab in the Top frame, you must programmatically get a handle on the menu link, as well as programmatically control how that new page content from the selected tab displays. You can display the page content in one of two ways: In the Center frame, such that the Start frame still displays the tree structure. In the Top frame, such that the content is displayed in the entire window and the Start and Center frames are both eliminated.
Displaying Content in the Center Frame
To display the new menu content in the Center frame, you need to remove the header shown in the Center frame by passing the parameter OA_PAGELAYOUT_RENDER_STYLE in controller code for the Top frame (for the example shown in the Sample Library, the Top frame controller is TreeDetailsCO): OAPageLayoutBean pageLayout = pageContext.getPageLayoutBean(); pageLayout.prepareForRendering(pageContext); 563
UINode tabBar = pageLayout.getTabs(); int childCount = 0; if( tabBar != null ) { childCount = tabBar.getIndexedChildCount( pageContext.getRenderingContext()); } for( int i=0; i<childCount; i++) { LinkBean child = (LinkBean)tabBar.getIndexedChild( pageContext.getRenderingContext(), i); if( child != null ) { child.setTargetFrame(CENTERFRAME_NAME); } // // // // Need to add the OA_PAGELAYOUT_RENDER_STYLE with the value PAGELAYOUT_NO_HEADER to remove the header rendering. This parameter is exposed as a public constant in OAWebBeanConstants.
To display the new menu content in the Top frame, so that the content takes over the entire browser window, you need to add the following to your tree controller code: OAPageLayoutBean pageLayout = pageContext.getPageLayoutBean(); pageLayout.prepareForRendering(pageContext); UINode tabBar = pageLayout.getTabs(); int childCount = 0; if( tabBar != null ) { childCount = tabBar.getIndexedChildCount( pageContext.getRenderingContext()); } for( int i=0; i<childCount; i++) { LinkBean child = (LinkBean)tabBar.getIndexedChild( pageContext.getRenderingContext(), i); if( child != null ) { // Header needs to be displayed here. child.setTargetFrame("_top"); 564
} }
Personalization Considerations
See a summary of Tree personalization considerations in the Oracle Applications Framework Personalization Guide.
Known Issues
See a summary of key tree issues with suggested workarounds if available
Related Information
BLAF UI Guideline(s) Tree [[OTN version] Javadoc File(s) oracle.cabo.ui.beans.nav.TreeBean oracle.apps.fnd.framework.webui.beans.nav.OATreeBean oracle.apps.fnd.framework.webui.OATreeQueriedRowEnumerator oracle.apps.fnd.framework.webui.beans.nav.OADefaultTreeBean oracle.apps.fnd.framework.webui.OAWebBeanConstants oracle.apps.fnd.framework.webui.beans.table.OAHGridBean Lesson(s) ToolBox Tutorial / Sample Library To view the Tree (in 3-Frame JSP) example implemented in the Sample Library project of the Toolbox workspace, run the toolbox.jws -> SampleLibrary.jpr -> SampleBrowserPG.xml file in OA Extension. Select the Tree (in 3-Frame JSP) link in the SampleBrowserPG page that displays in your browser to view the implementation. The following package files in the Sample Library display the declarative and runtime implementation of this Tree (in 3-Frame JSP) example: oracle.apps.fnd.framework.toolbox.samplelib.webui.SampleBrowserPG.xml oracle.apps.fnd.framework.toolbox.samplelib.webui.TreeTopFrmPG.xml oracle.apps.fnd.framework.toolbox.samplelib.webui.TreeStartFrmPG.xml oracle.apps.fnd.framework.toolbox.samplelib.webui.TreeCenterFrmPG.xml oracle.apps.fnd.framework.toolbox.samplelib.webui.TreeDetailsCO.java oracle.apps.fnd.framework.toolbox.samplelib.webui.TreeStartFrameCO.java Sample Code PerAllPeopleFVOImpl PersonTreePageCO PerAllPeopleFVL PerAllPeopleFVO Copyright 2000 - 2004, Oracle Corporation. All rights reserved.
565
566
567
Prerequisite Reading
Implementing the Model
Related Information
Chapter 6: Advanced Model Development Topics Chapter 8: Applications Java Coding Standards Chapter 8: OA Framework File / Package / Directory Structure Standards Chapter 8: OA Framework Model Coding Standards
Create
To create an entity object, you must call createRow and then insertRow on the corresponding view object as illustrated below. // In the application module; this example from the OA Framework // ToolBox Tutorial will instantiate a SupplierEOImpl. public void create() 568
{ OAViewObject vo = getSuppliersVO(); vo.insertRow(vo.createRow()); // Always call this after you perform a row insert. See the Entity Object // New / Initial section below for additional information. vo.setNewRowState(Row.STATUS_INITIALIZED); } The view object createRow() method calls the create() method on the underlying entity object. You should add any defaulting/initialization code to the create() method on the entity object as shown for the ToolBox Tutorial oracle.apps.fnd.framework.toolbox.tutorial.server.SupplierEOImpl class (do not put any initialization logic in the entity object's constructor; it should always be added after the super.create(attributeList) method call in the create() method). Tip: If your defaults can be determined at design time, and are appropriate for a specific UI, you could also set default values by setting the Initial Value item property in the OA Extension. These values can be personalized by customers; they don't have to subclass your entity object and override the create() method to set the defaults. See the Defaulting topic in Implementing the View for additional information. /** * In the SupplierEOImpl class; initialize a new supplier. */ Public void create(AttributeList attributeList) { super.create(attributeList); OADBTransaction transaction = getOADBTransaction(); // Supplier id is obtained from the table's sequence Number supplierId = transaction.getSequenceValue("FWK_TBX_SUPPLIERS_S"); setSupplierId(supplierId); // Start date should be set to sysdate setStartDate(transaction.getCurrentDBDate()); } // end create() Tip: When you set values in your entity object, always call set<AttributeName>(val) instead of setAttribute("<AttributeName>", val) as performance improves when the lookup step is bypassed. If you want to skip any programmatic attribute validation (but still want to perform declarative validations defined for the corresponding attribute), you may call setAttributeInternal() directly. See Entity Object and View Object Attribute Setters for additional information.