ADF Code Corner. 035. How-to pass values from a parent page to a popup dialog. Abstract: twitter.com/adfcodecorner

Similar documents
ADF Code Corner. 92. Caching ADF Web Service results for in-memory filtering. Abstract: twitter.com/adfcodecorner

ADF Code Corner. 66. How-to color-highlight the bar in a graph that represents the current row in the collection. Abstract: twitter.

ADF Code Corner Building a search form that displays the results in a task flow. Abstract: twitter.com/adfcodecorner

ADF Code Corner. 81. How-to create master-detail behavior using af:paneltabbed and DVT graph components. Abstract: twitter.

ADF Code Corner. 86. Reading boilerplate images and icons from a JAR. Abstract: twitter.com/adfcodecorner

Developing Rich Web Applications with Oracle ADF and Oracle WebCenter Portal

ADF Code Corner Drag-and-drop reordering of table rows. Abstract: twitter.com/adfcodecorner

ADF Code Corner. 77. Handling the af:dialog Ok and CANCEL buttons. Abstract: twitter.com/adfcodecorner

Tutorial on Building a web Application with Jdeveloper using EJB, JPA and Java Server Faces By Phaninder Surapaneni

Oracle JDeveloper 10g for Forms & PL/SQL

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

Building an Agile PLM Web Application with JDeveloper and Agile 93 Web Services

Developing Web and Mobile Dashboards with Oracle ADF

ADF Code Corner ADF Faces RC - How-to use the Client and Server Listener Component. Abstract: twitter.com/adfcodecorner

<Insert Picture Here> Betting Big on JavaServer Faces: Components, Tools, and Tricks

Oracle Application Development Framework Overview

Hands-On: Introduction to Object-Oriented Programming in LabVIEW

The Oracle Fusion Development Platform

Building and Using Web Services With JDeveloper 11g

<Insert Picture Here> Web 2.0 Data Visualization with JSF. Juan Camilo Ruiz Senior Product Manager Oracle Development Tools

Chapter 14: Links. Types of Links. 1 Chapter 14: Links

Tutorial: Building a Web Application with Struts

<Insert Picture Here> Oracle Application Express 4.0

This presentation is for informational purposes only and may not be incorporated into a contract or agreement.

Microsoft Excel Tutorial

Oracle Fusion Middleware

Talend Open Studio for MDM. Getting Started Guide 6.0.0

Elixir Schedule Designer User Manual

ADF Code Corner How-to drag-and-drop data from an af:table to af:tree. Abstract: twitter.com/adfcodecorner

Tutorial: Mobile Business Object Development. SAP Mobile Platform 2.3 SP02

Oracle Technology Network Virtual Developer Day. Developing RIA Web Applications with Oracle ADF

ABAP Debugging Tips and Tricks

Data Tool Platform SQL Development Tools

Tutorial: Mobile Business Object Development. SAP Mobile Platform 2.3

Adobe Acrobat 9 Pro Accessibility Guide: Creating Accessible Forms

ICP Data Validation and Aggregation Module Training document. HHC Data Validation and Aggregation Module Training Document

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Pulling a Random Sample from a MAXQDA Dataset

ORACLE BUSINESS INTELLIGENCE WORKSHOP

How To Create A Graph On An African Performance Monitor (Dvt)

Access 2007 Creating Forms Table of Contents


How To Make Templates More Powerful In Ec.Org

IRTH One Call Service Area Registration (SAR) Program:

Understanding Business Process Management

Applications. Oracle WebCenter 11 g Handbook: Build Rich, Customizable Enterprise 2.0. Oracle Press ORACLE. Philipp Weckerle.

Application Developer Guide

MyOra 3.5. User Guide. SQL Tool for Oracle. Kris Murthy

When a business user interacts with an integrated workbook, there are various elements involved in the picture. Each of these elements has its own

Microsoft Access Basics

Tutorial: Mobile Business Object Development. Sybase Unwired Platform 2.2 SP02

Top 10 Oracle SQL Developer Tips and Tricks

Oracle Business Intelligence ADF Custom Visualizations and Integration. An Oracle White Paper November 2012

How To Use Excel 2010 On Windows 7 (Windows 7) On A Pc Or Mac) With A Microsoft Powerbook (Windows Xp) On Your Computer Or Macintosh (Windows) On Windows Xp (Windows 2007) On Microsoft Excel 2010

Smooks Dev Tools Reference Guide. Version: GA

Hypercosm. Studio.

Quest Web Parts for SharePoint

Intellect Platform - The Workflow Engine Basic HelpDesk Troubleticket System - A102

Instructions for Checking System Compatibility

Enterprise Service Bus

Horizon Debt Collect. User s and Administrator s Guide

PM160 CLAIMS MANUAL ACCESSING THE PM160 CLAIM FORM

Talend for Data Integration guide

Tutorial Build a simple IBM Rational Publishing Engine (RPE) template for IBM Rational DOORS

Task Flow Design Fundamentals

<Insert Picture Here> Building a Complex Web Application Using ADF and Siebel

MICROSOFT OFFICE ACCESS NEW FEATURES

ORACLE ADF MOBILE DATA SHEET

Unified Communicator Advanced Training Handout

Designing portal site structure and page layout using IBM Rational Application Developer V7 Part of a series on portal and portlet development

PeopleTools 8.51 PeopleBook: PeopleSoft Application Designer Lifecycle Management Guide

Oracle Application Express Workshop

Reporting and Analysis Guide

The Smart Forms Web Part allows you to quickly add new forms to SharePoint pages, here s how:

DbVisualizer 9.2 Users Guide. DbVisualizer 9.2 Users Guide

TIBCO Silver Fabric Continuity User s Guide

Using OwnCloud. OwnCloud is a very easy to use file storage and sharing system that you can access anywhere you have an internet connection.

Introduction to LibreOffice Base (LOB)-2. Relationships. Robin Beaumont Date: Saturday, 07 April

USER GUIDE. Unit 2: Synergy. Chapter 2: Using Schoolwires Synergy

Starting User Guide 11/29/2011

Troubleshooting Guide. 2.2 Click the Tools menu on Windows Explorer 2.3 Click Folder Options. This will open a dialog box:

From Mass s to Personalized Award Letters: Using 3C Engine and CommGen to Correspond with Students. Session #30245 March 18, 2012

DataPA OpenAnalytics End User Training

Business Insight Report Authoring Getting Started Guide

An introduction to creating JSF applications in Rational Application Developer Version 8.0

Nintex Workflow for Project Server 2010 Help

USER GUIDE MANTRA WEB EXTRACTOR.

Generating Open For Business Reports with the BIRT RCP Designer

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE By using the RETE Algorithm Benefits of RETE Algorithm...

Teradata SQL Assistant Version 13.0 (.Net) Enhancements and Differences. Mike Dempsey

Sage CRM Connector Tool White Paper

Cleaning your Windows 7, Windows XP and Macintosh OSX Computers

Debugging Java Applications

Intellect Platform - Tables and Templates Basic Document Management System - A101

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

WebPlus X7. Quick Start Guide. Simple steps for designing your site and getting it online.

Advanced Excel 10/20/2011 1

Transcription:

ADF Code Corner 035. How-to pass values from a parent page to a popup dialog Abstract: The af:popup component is used as the base component for launching dialogs and note windows. To pass information from the parent page to the popup, the easiest option is to display values of the selected, the current row. In this blog article, we explain how to pass values of a non-current row to a popup dialog so it can be used for display or in java, using a launch listener. twitter.com/adfcodecorner Author: Frank Nimphius, Oracle Corporation twitter.com/fnimphiu 02-NOV-2009

Oracle ADF Code Corner is a loose blog-style series of how-to documents that provide solutions to real world coding problems. Disclaimer: All samples are provided as is with no guarantee for future upgrades or error correction. No support can be given through Oracle customer support. Please post questions or report problems related to the samples in this series on the OTN forum for Oracle JDeveloper: http://forums.oracle.com/forums/forum.jspa?forumid=83 Introduction To display values of the current table row in a popup dialog, or read current row data values in Java, developers use a simple but effective binding trick: To access the values of a selected row, you create attribute bindings for all attributes of interest of the iterator that the tree binding, which populates the tree at runtime, is based on. Because tables synchronize the selected table row with the binding, the attribute bindings always provide access to the row values using #{bindings.<attribute name>.inputvalue}. This little trick comes with no additional cost and also has the advantage that you can use the Expression Language builder in Oracle JDeveloper to bind UI components to the values. The disadvantage of this approach is that a row must be current - selected - for the popup to display the correct values or Java to be able to read these values in. Use cases, like multi row selection or displaying detail information fro a row, require a special handling if the information should be for non-current rows as well. In the example explained in this article, we use a table that displays a note window when the mouse hovers over a text label in the last column. The implementation code can be easily changed by you to launch the dialog from an image or one of the existing cell information. In the image below, hidden columns of an af:table component are displayed in a note window when moving the mouse over the "More" text string in the Details column. As mentioned before, the implementation code also allows you to modify it such that the the popup is displayed when moving the mouse over an image or one of the displayed columns. Note in the image below that the first table row is the selected row, whereas the information displayed in the popup is from a non-current row. 2

To implement this solution, you need to do as follows Create a popup that loads its content lazily but uncached Define the popup launch context to be the context of the launcher component Create client attributes to the launcher component that contain the information you want to pass to the dialog Use setpropertylisteners to store this information in an object in memory when the popup launches Read the information from the memory object Building the table The table component is created by dragging a view object Collection from the DataControls palette to the JSF page. Choose all columns that you want to display as table columns, or that you want to show information about in the popup. This creates a tree binding with the selected attribute values. Use the Structure window to delete the column definitions you don't want to display in the page. For this, expand the af:table in the Structure window and select the columns to remove. Then hit delete, to remove the column page sources, preserving the ADF binding definition for these attribute. In the Structure window, add a new af:column to the table and add an af:outputtext component, an image, a link or whatever component you like to render the Detail cell. In this article we use an af:outputtext component. 3

Creating the popup dialog The popup dialog is built by dragging the Popup component from the ADF Faces component palette onto the JSF page and adding a Note Window component as its child. Importantly, the ContentDelivery property of the af:popup component is set to lazilyuncached to ensure the popup content is renewed when the popup opens. You need to define a value for the LauncherVar property and set the EventContext to "launcher". This way it is possible to access attributes, including custom clientattributes, from the launching component within the context of the opened popup dialog. Accessing the launcher component attributes allows us to pass the row data information from the Detail cell to the popup. <af:popup id="p1" launchervar="source" contentdelivery="lazyuncached" eventcontext="launcher"> <af:notewindow id="nw1"> <af:panelformlayout id="pfl1"> <af:panellabelandmessage label="phonenumber" id="plam1"> <af:outputtext value="#{viewscope.phone}" id="ot5"/> <af:panellabelandmessage label="hiredate" id="plam2"> <af:outputtext value="#{viewscope.hiredate}" id="outputtext1"/> <af:panellabelandmessage label="jobid" id="plam3"> <af:outputtext value="#{viewscope.jobid}" id="outputtext2"/> <af:panellabelandmessage label="salary" id="plam4"> <af:outputtext value="#{viewscope.salary}" id="outputtext3"/> <af:panellabelandmessage label="departmentid" id="plam5"> <af:outputtext value="#{viewscope.departmentid}" id="outputtext4"/> </af:panelformlayout> </af:notewindow> <af:setpropertylistener from="#{source.attributes.phone}" to="#{viewscope.phone}" type="popupfetch"/> <af:setpropertylistener from="#{source.attributes.hiredate}" to="#{viewscope.hiredate}" type="popupfetch"/> <af:setpropertylistener from="#{source.attributes.jobid}" to="#{viewscope.jobid}" type="popupfetch"/> <af:setpropertylistener from="#{source.attributes.salary}" to="#{viewscope.salary}" type="popupfetch"/> <af:setpropertylistener from="#{source.attributes.departmentid}" to="#{viewscope.departmentid}" type="popupfetch"/> </af:popup> In the page source above, which defines the popup dialog, a af:panellabelmessage component is used to create the read only form that is displayed in the popup dialog. The af:setpropertylistener at the end of the dialog definition is used to read attribute values that are defined on the the launcher component (an output text component in this example). The values are written to the viewscope, which ensures they are cleaned up when the user navigates away from the current JSF page. The viewscope attributes are accessed - or referenced - from the outputtext components that display the values in the notewindow. 4

Launching the Popup To launch the pop, we use an af:showpopupbehavior component on the af:outputtext component that renders the "Details" column cell. <af:column id="c2" headertext="details"> <af:outputtext value="more" id="ot1" clientcomponent="true"> <af:clientattribute name="phone" value="#{row.phonenumber}"/> <af:clientattribute name="hiredate" value="#{row.hiredate}"/> <af:clientattribute name="jobid" value="#{row.jobid}"/> <af:clientattribute name="salary" value="#{row.salary}"/> <af:clientattribute name="departmentid" value="#{row.departmentid}"/> <af:showpopupbehavior popupid="::p1" triggertype="mousehover" align="endafter" alignid="ot1"/> </af:outputtext> </af:column> The af:clientattribute tags are used to add the row attribute values that should be displayed in the af:popup to the af:outputtext component. Note that the "row" variable belongs to the table and is only available when the table renders. This is why we need to store the row value information as a custom attribute with the launcher component. The af:showpopupbehavior component then launches the popup relative to the outputtext component when the mouse hovers over the text field. Note that you could also use mouseover as the trigger to launch the popup. The difference between mouseover and mousehover is a slight delay that is enforced using mousehover. This way we avoid popups to be launched only because a nervous application user moves the mouse too quickly over the launcher component. Download the sample The sample workspace is built with Oracle JDeveloper 11g R1 and connects to a local database with the HR schema installed and enabled. You need to change this connection so it matches your database con next details. Run the JSPX page and move the mouse over the "More" string in the Details column: Download the sample from ADF Code Corner: http://www.oracle.com/technetwork/developertools/adf/learnmore/index-101235.html RELATED DOCOMENTATION af.popup tag documentation - http://download.oracle.com/docs/cd/e12839_01/apirefs.1111/e12419/tagdoc/af_popup.html Af:showPopupBehavior tag documentation -- http://download.oracle.com/docs/cd/e12839_01/apirefs.1111/e12419/tagdoc/af_showpopupbe havior.html 5