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

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

ADF Code Corner How-to pass values from a parent page to a popup dialog. 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 Drag-and-drop reordering of table rows. Abstract: twitter.com/adfcodecorner

Developing Web and Mobile Dashboards with Oracle ADF

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

Developing Rich Web Applications with Oracle ADF and Oracle WebCenter Portal

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

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

Building and Using Web Services With JDeveloper 11g

ORACLE BUSINESS INTELLIGENCE WORKSHOP

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

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

Database Forms and Reports Tutorial

MicroStrategy Desktop

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

Copyright EPiServer AB

WebSphere Business Monitor V6.2 Business space dashboards

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

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

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

Application. 1.1 About This Tutorial Tutorial Requirements Provided Files

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

The Reporting Console

Workspaces Creating and Opening Pages Creating Ticker Lists Looking up Ticker Symbols Ticker Sync Groups Market Summary Snap Quote Key Statistics

Infoview XIR3. User Guide. 1 of 20

Process Document Campus Community: Create Communication Template. Document Generation Date 7/8/2009 Last Changed by Status

Publishing, Consuming, Deploying and Testing Web Services

Scribe Online Integration Services (IS) Tutorial

Oracle SOA Suite 11g Oracle SOA Suite 11g HL7 Inbound Example

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

WebSphere Business Monitor V7.0 Business space dashboards

Web Intelligence User Guide

Create a Database Driven Application

Mitigation Planning Portal MPP Reporting System

DbSchema Tutorial with Introduction in SQL Databases

OTN Developer Day: Oracle Big Data. Hands On Lab Manual. Introduction to Oracle NoSQL Database

Microsoft Office Access 2007 Basics

Ofgem Carbon Savings Community Obligation (CSCO) Eligibility System

IBM BPM V8.5 Standard Consistent Document Managment

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

Talend Open Studio for MDM. Getting Started Guide 6.0.0

WebSphere Business Monitor V6.2 KPI history and prediction lab

ORACLE BUSINESS INTELLIGENCE WORKSHOP

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

Business Process Management IBM Business Process Manager V7.5

Visualization with Excel Tools and Microsoft Azure

How to build Dashboard - Step by Step tutorial/recipe

Using Network Manager to Collect and Graph Data from Network Devices

TIBCO Spotfire Business Author Essentials Quick Reference Guide. Table of contents:

Global Preview v.6.0 for Microsoft Dynamics CRM On-premise 2013 and 2015

Solar-Generation Data Visualization Software Festa Operation Manual

WHAT S NEW IN OBIEE

Developing SQL and PL/SQL with JDeveloper

Integrating SalesForce with SharePoint 2007 via the Business Data Catalog

MetroBoston DataCommon Training

Dayforce HCM Manager Timesheet Guide

Business Objects Version 5 : Introduction

Query JD Edwards EnterpriseOne Customer Credit using Oracle BPEL Process Manager

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

CourseBuilder Extension ADOBE elearning SUITE 6

Microsoft PowerPoint 2008

Creating a Network Graph with Gephi

CentralMass DataCommon

EBOX Digital Content Management System (CMS) User Guide For Site Owners & Administrators

Introduction to Visio 2003 By Kristin Davis Information Technology Lab School of Information The University of Texas at Austin Summer 2005

owncloud Configuration and Usage Guide

5.7. Quick Guide to Fusion Pro Schedule

CalPlanning. Smart View Essbase Ad Hoc Analysis

Viewing and Troubleshooting Perfmon Logs

How To Use Microsoft Gpa On Microsoft Powerbook (Windows) On A Microsoft P2.1 (Windows 2.2) On An Uniden Computer (Windows 1.5) On Micro

Oracle Fusion Middleware

Build Your First Web-based Report Using the SAS 9.2 Business Intelligence Clients

Blackboard Version Grade Center Contents

Creating a Patch Management Dashboard with IT Analytics Hands-On Lab

Data Visualization. Prepared by Francisco Olivera, Ph.D., Srikanth Koka Department of Civil Engineering Texas A&M University February 2004

SolarEdge Monitoring Portal. User Guide 1.1. Table of Contents

Foglight. Dashboard Support Guide

Creating and Using Links and Bookmarks in PDF Documents

Database Linker Tutorial

DataPA OpenAnalytics End User Training

Table of Contents. Table of Contents

Getting Started Guide: Transaction Download for QuickBooks 2014 Windows

SharePoint AD Information Sync Installation Instruction

Introduction... 1 Welcome Screen... 2 Map View Generating a map Map View Basic Map Features... 4

SAS BI Dashboard 4.3. User's Guide. SAS Documentation

Data Warehouse Troubleshooting Tips

How to Login Username Password:

LexisNexis TotalPatent. Training Manual

Custom Reporting System User Guide

Creating Basic Custom Monitoring Dashboards Antonio Mangiacotti, Stefania Oliverio & Randy Allen

Live Maps. for System Center Operations Manager 2007 R2 v Installation Guide

Installing Basic PAYE Tools onto a networked computer

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

User Guide. Analytics Desktop Document Number:

Transcription:

ADF Code Corner 66. How-to color-highlight the bar in a graph that represents in the collection Abstract: An ADF Faces Data Visualization Tools (DVT) graphs can be configured to change in the underlying collection when a user click into it. This allows developers to implement master-detail behavior between a graph as the master and a form or a table as the detail. However, there is no visual indication for the chart item, for example a bar in a bar chart, the user clicked on. Also, navigating the underlying collection and partially refreshing the graph does not highlight the bar representing. This article explains how to highlight in a bar chart for users to have a visual feedback. twitter.com/adfcodecorner Author: Frank Nimphius, Oracle Corporation twitter.com/fnimphiu DD-MON-2010

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 In this sample, a user click on a bar in a graph sets in the underlying ADF iterator. A form that is based on the same iterator is setup to show detail information about the selected bar item. In addition, a navigation bar on top of the form may be used to scroll within the employee data, which then refreshes the graph, again showing the current employee bar highlighted. 2

About the ADF Business Component Model The ADF Business Component model is based on the Employees table of the Oracle HR schema. The View Object query is restricted to return employees in department 60. Note The ADF business service is not important for how this sample works and only serves for the purpose of providing sample data for the graph. Building the Graph To build the DVT graph in Oracle JDeveloper, drag the collection from the Data Controls palette into the page and choose Graph from the context menu. In the Component Gallery, choose the bar graph type. 3

For the Employees table, drag the Salary attribute into the graph field and the LastName attribute into the x-axis field. This displays the employee salary over the last names. To ensure master-detail correlation to happen when users click on a bar, check the Set current row for master-detail checkbox (1), which ensures to be set in the ADF binding layer iterator. In the example setting is not used for displaying master-detail data, but to show additional information about the selected row. 4

Press the Swap Bars with X-Axis button (2) to turn the last name entries into their own series, which is key for the color highlighting explained in this article. The major change is between setting and not setting this option is that the last names are displayed in the graph's legend than beneath its bar. To switch the graph color for the bar users click on, the ClickListener needs to be overridden. By default the ClickListener property points to the processclick action of the DVT binding in the PageDef file. As shown below, reference a managed bean method that has the click handler method defined. clickhandler(clickevent clickevent) The click handler method performs the same functionality as the processclick action and provides you a great example for how to generically program against the ADF binding layer from a DVT graph instance. To access the graph instance, in the Property inspector, browse to the graph's Binding property and press the Edit link in the context menu opened by the arrow down icon to the right. 5

For this example, where the Employee form can also be navigated using navigation buttons, you need to make sure the graph is refreshed when one of the buttons is pressed. Set the PartialTriggers property to point to the navigation button Ids. To set this property, use the Edit option from the context menu that opens when clicking the down arrow icon on the right. Note: The navigation buttons are created by selecting the collection in the ADF Data Controls panel and dragging it onto the page. From the context menu choose Navigation and choose the navigation button option. Shown below is the generated navigation bar page source. In addition to the actionlistener property, which is automatically set when creating the navigation buttons, the action property is set to reference a managed bean method. The managed bean method is used to ensure the row navigation is highlighted in the graph. Also note that the partialsubmit property is set to true, which automatically happens when the Navigation context option is selected. <af:panelgrouplayout layout="horizontal" id="pgl2"> <af:commandbutton actionlistener="#{bindings.first.execute" text="first" disabled="#{!bindings.first.enabled" partialsubmit="true" id="cb2" action="#{graphhelperbean.onbuttonnavigation"/> </af:panelgrouplayout> The onbuttonnavigation method calls a helper function to highlight the new current row bar in the graph. public String onbuttonnavigation() { highlightselectedseriesbar(); return null; 6

Managed Bean The managed bean doesn't hold state and therefore is configured in request scope. The clickhandler method accesses the ADF binding layer through the graph instance GraphDataModel graphmodel = (GraphDataModel)graph1.getDataModel(); The graph1 variable is an instance of the graph created through the graph component Binding property. It grants access to the ADF binding layer. The clickevent provides the information about the bar (the series) the user clicked on. The bar's row representation is then set as current in the ADF binding layer. import java.awt.color; import java.util.list; import oracle.adf.model.binding.dciteratorbinding; import oracle.adf.model.dvt.binding.transform.cube.cubedatamodel; import oracle.adf.view.faces.bi.component.graph.uigraph; import oracle.adf.view.faces.bi.event.clickevent; import oracle.adf.view.faces.bi.model.graphdatamodel; import oracle.dss.dataview.componenthandle; import oracle.dss.dataview.datacomponenthandle; import oracle.dss.util.columnoutofrangeexception; import oracle.dss.util.dataaccess; import oracle.dss.util.datadirectorexception; import oracle.dss.util.datamap; import oracle.dss.util.rowoutofrangeexception; import oracle.jbo.row; import oracle.jbo.uicli.binding.juctrlhierbinding; import oracle.jbo.uicli.binding.juctrlhiernodebinding; public class GraphHelperBean { private UIGraph graph1 = null; boolean restoreview = false; public GraphHelperBean() { //DVT graph component binding reference defined on the "Binding" //property public void setgraph1(uigraph graph1) { this.graph1 = graph1; public UIGraph getgraph1() { return graph1; //custom click handler method that accesses the binding layer to set //the bar selected by the user as public void clickhandler(clickevent clickevent) { 7

//Substitute for:#{bindings.employeesview1.graphmodel.processclick //get access to the hierarchical binding GraphDataModel graphmodel = (GraphDataModel)graph1.getDataModel(); CubeDataModel cubedatamodel = (CubeDataModel)graphModel.getDataDirector(); //get access to the graph root binding. This information is needed //to the access to the JUCtrlHierbinding that is not exposed on the //graph without using internal classes JUCtrlHierNodeBinding rootnode = cubedatamodel.getcubicbinding().getrootnodebinding(); JUCtrlHierBinding hierbinding = rootnode.gethierbinding(); //resolve the graph component the user clicked on ComponentHandle ch = clickevent.getcomponenthandle(); if (ch!= null) { DataComponentHandle dch = (DataComponentHandle)ch; Object keypath = dch.getvalue(datamap.data_keypath); if (keypath!= null) { //the code line below is comparable to table and tree selections //in where the component keypath is used to identify the data //row in the ADF binding layer JUCtrlHierNodeBinding node = hierbinding.findnodebykeypath((list)keypath); if (node!= null) { node.getrowiterator().setcurrentrow(node.getrow()); //color highlight selected node highlightselectedseriesbar(); public String onbuttonnavigation() { highlightselectedseriesbar(); return null; /** * Highlight in the bar graph. The row highlighting * is determined by comparing in the ADF binding with * the row represented by the individual bars. */ public void highlightselectedseriesbar() { if (graph1!= null) { GraphDataModel graphmodel = 8

(GraphDataModel)graph1.getDataModel(); CubeDataModel cubedatamodel = (CubeDataModel)graphModel.getDataDirector(); //get the ADF iterator binding from the graph model JUCtrlHierNodeBinding rootnode = cubedatamodel.getcubicbinding().getrootnodebinding(); JUCtrlHierBinding hierbinding = rootnode.gethierbinding(); DCIteratorBinding iterator = hierbinding.getdciteratorbinding(); int rowcount = graphmodel.getrowcount(); DataAccess da; try { da = graphmodel.getdatadirector().getdataaccess(); Row currentrow = iterator.getcurrentrow(); //iterate over the row data for (int i = 0; i < rowcount; ++i) { List keypath; try { keypath = (List)da.getValue(i, 0, DataMap.DATA_KEYPATH); JUCtrlHierNodeBinding node = hierbinding.findnodebykeypath(keypath); Row rw = node.getrow(); if(rw.getkey().equals(currentrow.getkey())){ node.getrowiterator().setcurrentrow(node.getrow()); int rwindex = node.getrowiterator().getrangeindexof(node.getrow()); graph1.getseriesset().getseries(rwindex, true).setcolor(color.red); else{ int rwindex = node.getrowiterator().getrangeindexof(node.getrow()); graph1.getseriesset().getseries(rwindex, true).setcolor(color.blue); catch (RowOutOfRangeException e) { e.printstacktrace(); catch (ColumnOutOfRangeException e) { e.printstacktrace(); catch (DataDirectorException e) { e.printstacktrace(); 9

Note: Initially the first bar in the graph is highlighted. If you set a different than the first bar as current during the initial page load, then you need to also call the highlightselectedseriesbar method to change the initial bar color coding. Download The Oracle JDeveloper 11.1.1.3 workspace can be downloaded from ADF Code Corner: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html Configure the database connection to reference the HR schema of a local database in your reach and run the JSPX document in the view layer project. Note that for this sample the query of employee records is restricted to employees in department 60. Using this sample code in your application development project, there is no limitation in the number of graphs to use. RELATED DOCOMENTATION 10