Skip to main content

Posts

Showing posts from 2011

ADF 11g : Query Component with ‘dynamic’ view criteria

In my current project use a lot of re usable taskflows. In one particular situation I needed exactly the same taskflow to be re-used with one tiny small difference: The displayed query component needed to have different fields compared to page in the base taskflow. Now there are lots of possible solutions (two query components and a switcher, or two query components using the rendered property). I choose a different solution using ternary operator and EL in the page definition. Use case I need to display a different query component when the taskflow is started in a specific mode. For instance I can startup the taskflow a being a HR manager, or I can startup the taskflow as being an employee. In the first case I need to be able to search on items like salary and commission and hiredate. In the second case I need to be able to search on firstname. lastname and more stuff like that, and I can only see employees in my own department. Setup: Lets start with the creation of default business

ADF 11g Quicky 3 : Adding Error, Info and Warning messages

How can we add a message programatically ? Last week I got this question for the second time in a months time. I decided to write a short blogpost on how this works. Adding messages is very easy, you just need to know how it works. You can add a message to your faces context by creating a new FacesMessage. Set the severity (ERROR, WARNING, INFO or FATAL ), set the message text, and if nessecary a message detail. The fragment below shows the code for an ERROR message. 1: public void setMessagesErr(ActionEvent actionEvent) { 2: String msg = "This is a message"; 3: AdfFacesContext adfFacesContext = null; 4: adfFacesContext = AdfFacesContext.getCurrentInstance(); 5: FacesContext ctx = FacesContext.getCurrentInstance(); 6: FacesMessage fm = 7: new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, ""); 8: ctx.addMessage(null, fm); 9: } I created a simple page with a couple of buttons to show the result of setting the message. When the but

Announcement – Free ADF Webinar for ODTUG

This Tuesday I will present a webinar for ODTUG. In this webinar I will talk about how to provide management information from within your ADF application. Topics : ADF DVT's, Google Maps, MS Excel, and Reporting Solutions. Tuesday, September 20, 2011, 3:00 PM - 4:00 PM EST Reaching out from ADF: Management Information using ADF-DVT, Google Maps, MS Excel, and Oracle Reports. Luc Bors, AMIS Services Usually applications serve purposes such as data entry and process support. Another purpose is to provide management information.In your ADF 11g application you can use Oracle ADF Data Visualization Tools (ADF-DVT) but there are also other options that are not necessarily part of the ADF Framework. This session gives an overview of your possibilities and will answer the following questions: How to integrate ADF-DVT graphs in your application and how to make them interactive for your business users? How to use ADF-DVT maps in your application and how to interact with Google maps?

ADF 11g : Using the ActiveRowKey property

In ADF 11g Release 2, the ADF Table component has a property called 'ActiveRowKey'. According to documentation, this represents the row that is currently active on the client. In click-to-edit mode, the active row will be made editable and is brought into view (if not already visible). Upon initial display, the click-to-edit component defaults the active row to the first visible row. In this post I will show you how to use the activeRowKey programmatic. Use Case. Imagine the following use case: I have a 'click-to-edit' table and I added a 'filter' field with a button in the surrounding panel collection. User enters (in this case) a last name and pushes the button. The table scrolls to the first row that matches the criteria, and the row is active to edit. Implementation. I create an ADF table based on ADF business components for the Employees table. It's a clickToEdit table with singleSelection. After creating it I bind it to a bean. I'

ADF 11g : Show PDF in a Popup

In one of my previous posts I showed how to use ADF popup components to display external content such as webpages like wikipedia in an inline frame. Based on this post a colleague of mine tried to display a PDF document. That didn't work. In this post I explain how you can use a servlet to open a PDF document in the inline frame. I will not explain how to invoke popups. If you need to know how to do that, refer to the post mentioned earlier. How to create the servlet ? The solution for showing a PDF in a popup is to use a servlet. It's possible to have a servlet deliver PDF content to the browser by specifying the content type of the servlet response to be the 'application/pdf' MIME type via 'response.setContentType("application/pdf")'. In JDeveloper you can create a HTTP servlet very easy via the new gallery. I decided to call the servlet ShowPdfServlet which actually is a pretty descriptive name for this servlet. For the servlet mapping I accept th

ADF 11g : Printing Directly From Your Application

Last week I was asked this question : "Can we print directly from within our ADF Application, without invoking the printer dialog ?" I wasn't sure but after some investigation the answer was clear. Yes you can ! Here is how... I decided to create a print start up form where I can select printers and print the document. Most of the functionality needed is provided by the Java Print Service API. Selecting available printers I start with a way to show all printers available to the session. For that I simply use the PrinterServiceLookup. PrintService[] printers = PrintServiceLookup.lookupPrintServices(null, null); The result I can now use to create an Array of SelectItems in order to make the list available in the application. 1: public SelectItem[] getAllPrinters() { 2: if (allPrinters == null) { 3: PrintService[] printers = 4: PrintServiceLookup.lookupPrintServices(null, null); 5: allPrinters = new SelectItem[printers.length]; 6: for (int i = 0; i &l

ODTUG Kscope 11: My story on ADF in the Fusion MiddleWare Track

From June 26th to June 30th the KScope 11 conference was in Long Beach California. Nice setting for a great conference. It was the first time that KScope had a Fusion Middleware Track. For me it was a very busy conference with three presentations, handson workshops, live demonstrations and a Boff session with the EMG. In this post some of my highlights. Friday and Saturday On Friday in the airplane and Saturday in Long Beach I wrote a review for Sten Vesterli's book. The review can be found here on the AMIS Technology Blog. Sunday Symposium The symposium started very early. That is 7.30 including breakfast and registration. Then some great sessions on ADF and SOA and Webcenter. Chris Muir and John King talked about ADF, Sten Vesterli and Hajo Norman about WebCenter, Lonneke Dikmans and Chris Judson talked about SOA and BPM. Finally Madhuri Kolhatkar \was presenting on User Experience Design Patterns. She pointed out a very usefull resource where you can find OBIEE Design Patterns

Book Review : Oracle ADF Enterprise Application Development – Made Simple

On my way to Los Angeles (Long Beach) for KScope 2011 (12 Hours in an airplane) I had plenty of time to do some reading and writing.The book I read was an only very recently (june 2011) published ADF Book. This is not a technical deep dive into ADF, but it focuses on the process of application development. The book is written by Sten Vesterli an Oracle ACE Director and it is absolutely a good read. When reading I found myself in an environment that I recognize from the many ADF projects that I have been involved in. Many of the questions that newbie ADF Developers have are answered in this book. The book describes the development process, starting with an ADF PoC, all the way to testing, packaging and delivering the application to the end users. You also get hints on how to find more info via google. This might actually work better then providing direct URL’s for reference. Here’s a short overview of the content. Chapter 1: The ADF Proof of Concept The proof of concept chapter gives a

ADF 11g Quicky 2 - Set Focus on MouseOver Event

Another Quick solution here. What if I want to set focus on a field without actually having to click it ? This can be done by using a clientListeners and some java script code. 1: <?xml version='1.0' encoding='UTF-8'?> 2: <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" 3: xmlns:f="http://java.sun.com/jsf/core" 4: xmlns:h="http://java.sun.com/jsf/html" 5: xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> 6: <jsp:directive.page contentType="text/html;charset=UTF-8"/> 7: <f:view> 8: <af:document> 9: <af:resource type="javascript"> 10: function makeActive(event){ 11: event.getSource().focus(); 12: } 13: </af:resource> 14: <af:form id="f1"> 15: <af:inputText label="Label 1" id="it1"> 16: <af:clientListener type="mouseOver&qu

ADF 11g Quickies - A new series of posts

As an ADF consultant I get lots and lots of questions on ADF (duh..). I usually answer these using a simple sample and some explanations. These effort are hardly ever documented by me. I decided to use this Blog to write all these tiny things down for future 'ADF generations'. From now on this Blog will host ADF 11g Quickies.

ADF 11g Quicky : Select text from a resourcebundle

One of the questions I got lately is how to select a specific text from a resource bundle and use it in an ADF Application. This is easy and can be done as shown below. All you need is a resourcebundle containing the keys and text values, a selectcomponent to set the actual key and some java code in a valueChangeListener to search the resourcebundle for the key. So first create the resourceBundle file to hold the key/value pairs for the text resources. Next implement the page holding the selectcomponent, and an output component to show the value retrieved from the resourcebundle. 1: <af:panelGroupLayout id="pgl1"> 2: <af:selectOneChoice valueChangeListener="#{pageFlowScope.resourceBundleManager.listEntryChanged}" 3: id="soc1" autoSubmit="true" valuePassThru="true" 4: label="#{viewcontrollerBundle.SEL_RESOURCE_KEY}"> 5: <af:selectItem label="Value 1" val

ADF 11g : UI Designer meets ADF Developer

For years, creating a UI design for ADF Faces pages has been a pain in the ***. I have seen UI designs created in excel, powerpoint, and even photoshop. Designs looking great, however, nine out of ten couldn't be realized using the ADF Component stack. Either because 'non-existing' components were used or because pixel perfect alternatives are not available. Today I found a valuable resource on OTN that can help us circumvent this problem. Oracle published a set of Visio Templates containing all ADF Faces Components. The set has stencils containing visio components that represent ADF components. You can even set some properties that you would typically use when building the ADF Page. This means that we can now have UI Designs that we can work with. The ADF Faces stencils for Microsoft Visio allow you to mock up ADF user interfaces quickly and easy outside of Oracle JDeveloper. The stencils provide representations of the most common used ADF visual components, divided into c

Referal: Adding a Keystroke filter to and ADF Shuttle Component

No new technical entry this month. I've been busy preparing training material for my ADF Masterclass on march 25th. Besides that I wrote my column ADF@WORK (in dutch) and prepared a training on building Web services with JDeveloper. I did however post a technical entry on the AMIS technology blog about "Adding a Keystroke Filter to an ADF Shuttle Component" For more detail on this look here

ADF 11g PS3 : Check Uncommitted Data Behavior

In ADF 11g PS 3 (11.1.1.4) there is a nice little feature that you can use to prevent users to leave a page when there is uncommitted data. It is called "Check Uncommitted Data Behavior" and can be used on all action components. Using it is very easy. You just drop the component from the data control pallet onto your page as a child of a command component. The component is added to the page resulting in the following code. Finally, you have to tell the ADF Document component that it should implement the uncommitted data warning. When you run the page, change data, and push the button you will get a message. This will also work when navigating away from the page, refreshing the page and even when closing the browser. Simple but useful !