Sunday, May 8, 2011

Oracle ADF 11g Custom Table Pagination

In ADF 10g, table component was working only with pagination support, in ADF 11g table component was improved greatly and now it works with scrollable support. However, time to time we hear customer requests to provide pagination support for ADF 11g table, as it was in ADF 10g. There are different requirements, when table pagination would work much better comparing to scrollable functionality. Ideally, ADF 11g table should support both options - pagination and scrollable functionality. While pagination is not supported, we can implement our own custom table component. This post implements it as a task flow, in my future posts I will publish ADF reusable component based on similar approach.

Download sample application with custom table implementation - CustomLayoutADFIterator.zip.

Custom table is implemented using af:iterator tag. This tag allows to render collection of data, just the same as af:table tag renders. Same as af:table tag, af:iterator can be based on table binding available in page definition. It iterates over data collection and renders data rows - this allows to generate table view:


Value property of af:iterator is binded to collection model from ADF bindings declaration. Number of visible rows at one time (on one page) is set to 10, initial row to render is set from first row 0:


Next or previous page of rows is rendered by changing first row indicator, last page is calculated as well. Good thing, we dont need to store indicator for current page in the memory, we can always calculate it:


af:iterator tag points to ADF bindings table declaration, it gets same collection model as af:table tag:


Here is example of custom table from provided sample application. You can change layout, add more functionality - its all standard ADF components:


It always displays 10 rows (configurable) on the page, provides buttons to navigate between pages and shows current page number. If user is moves to second or third page, navigation buttons for previous page become enabled:


If we navigate to the last page, navigation buttons for next navigation become disabled:


This table provides option to click either on First Name or Last Name and open editable pop-up for current row:


User hits OK button, changes are saved and our custom table current page is refreshed with changed data:


With af:iterator tag, we can't get current row as we are used to do with af:table. This can be resolved by declaring JSF attribute for command link component, and retrieving this attribute inside managed bean method. Attribute value is used to set current row for editable pop-up:


Thursday, May 5, 2011

Running WebCenter/ADF 11g PS3 on Google Chrome

We had quite interesting issue today, when testing new deployment for ADF/WebCenter 11g PS3 system. Application was running perfectly on standalone WebLogic server and was accessible from IE 8 and Firefox 4 without problems. However, when accessing from latest Google Chrome we were getting JavaScript problems and basically application screens were broken. It was quite strange, because ADF 11g applications are running on Google Chrome without any issues. Issue was reproduced only on Google Chrome Windows platform, not on Mac OS.

I don't know the reason why corrupted JavaScript rendering happens for WebCenter/ADF 11g PS3 apps in Google Chrome (Windows), but I faced it today already second time, I had same issue few weeks ago with another application. Important to mention, issue is occurring only with newly deployed applications. I don't think its a problem of WebCenter/ADF 11g PS3, its more likely something with Google Chrome caching on Windows systems.

Anyway, if you will experience any strange behavior for WebCenter/ADF 11g PS3 apps in Google Chrome on Windows, you should clean Google Chrome cache - all will be working fine then:


It's a magic in its best !

Monday, May 2, 2011

Oracle University Celebrity Seminar - ADF/WebCenter Spaces 11g & BPM Suite 11g Integration

I have great news to share - by invitation from Oracle University, I will be teaching ADF/WebCenter Spaces 11g & BPM Suite 11g Integration seminar as part of Oracle University Celebrity program.

This seminar will be organized live and online as well. You can check all the details and register on Oracle University site - ADF/WebCenter Spaces 11g & BPM Suite 11g Integration.

Complete Oracle University Celebrity seminar catalog is available here. This catalog is featuring such well known names as Jonathan Lewis, Pete Finnigan, Arup Nanda, Steven Feuerstein, Mark Rittman, et al.

Looking forward to meet you during these events !

Sunday, May 1, 2011

Initializing ADF Task Flow Parameters Through WebCenter PS3 Menu Model

Last week I was integrating ADF Task Flows into WebCenter PS3 menu model, there is one trick to share related to WebCenter PS3 Composer custom catalog integration and ADF Task Flow parameter initialization.

In WebCenter PS3 you can integrate ADF Task Flows mainly in two ways - through WebCenter menu model or through WebCenter Composer custom catalog. Sounds clear, but ADF Task Flow parameters are initialized differently, I guess is a bug in current release. The thing is, parameters are not initialized with WebCenter Composer, as initialized when using WebCenter menu model. However, it still possible to make it work also with WebCenter Composer, I wil describe how.

Let's start from the beginning, our ADF Task Flow contains one mandatory parameter:


This parameter is used to filter employees data:


There is View Criteria defined for this purpose:


Once this ADF Task Flow is included into WebCenter navigation model, we can initialize ADF Task Flow parameter by defining WebCenter URL parameter. Please note, parameter name must be the same as ADF Task Flow parameter name:


This works perfectly, data is loaded and filtered:


Now if we want to use same ADF Task Flow from WebCenter Composer, we need to declare it inside WebCenter resource catalog. Here we have same option, to specify URL parameter:


But its not working on runtime in this case, required ADF Task Flow parameter is not initialized inside WebCenter Composer and region is not rendered:


Is good we can open component properties dialog and set parameter value there on runtime:


We set value to "b", region is rendered with filter and result data:


Region view inside WebCenter composer:


Region is successfully added to the page:


Download sample application - WebCenterTaskFlowParams.zip

Saturday, April 30, 2011

PopUpFetch Option for Property Listener

With previous JDeveloper/ADF 11g releases it was quite complicated to catch popup fetch event, we were overriding popup fetch listener inside managed bean and processing it. Its a good hint, things are simpler now - there is popupFetch property with Set Property Listener component:


This means, you can associate Set Property Listener directly with popup, and listener will be invoked automatically on popup fetching.

To demonstrate this functionality I have implemented simple filter solution, filter box is opened inside popup and is initialized with currently selected department data, by default:


Default value for filtering is set through Set Property Listener associated with popup, it assigns currently selected department name:


When user selects another department, filter value is reset by Set Property Listener during popup fetch event:


Filter operation is performed:


Filtering is performed, because VO contains WHERE clause with Bind Variable:


Filter field is mapped with variable defined inside Page Definition:


Page Definition variable is accessed through Attribute Value:


Download sample application - PopUpFetchListener.zip.

Wednesday, April 27, 2011

Strange Day - ADF Library Profile Dependency Deployment Problem

Time to time it happens, when we are keep saying - 'strange...', while developing something. It happened to me today, let me share what I was facing and how this 'strange' problem was resolved. My use case was - reusable ADF application packaged into ADF library JAR file and reused from main portal application. However, when accessing from main portal application, constantly it was throwing NullPointer exceptions from ADF Data Control. I managed to reproduce this problem with smaller simple application, NullPointer exception is generated when trying to load table component from ADF library:


Reusable ADF application is just standard ADF 11g application, it contains ADF BC and ADF Task Flows:


There is dependency set between ViewController and Model project:


Portal application is also standard ADF 11g application, it imports ADF library and includes reusable ADF region:


But it would take more closer look and browse through imported libraries, we would notice that reusable ADF library doesn't contain actual model project for our reusable ADF task flow:


Okej, so we are very close to solve the problem now, it means for some reason whole model package just was not included into ADF library. Of course, then we would look into deployment profile for ADF library and would see that Library Dependency section is empty. You must ensure deployment profile dependency is not empty, when deploying to ADF library. Its enough to have set only project dependency, when running application without deploying into ADF library JAR:


If you want to avoid one of those 'strange...' situations, make sure you will set deployment profile dependency from Model project:


Rebuild library, it will include model part now as well:


Data is loaded successfully now, through main portal application:


Download working sample application with reusable ADF library imported into main portal application - reusableapps.zip.

Monday, April 25, 2011

Invoking Stored Procedures and Functions with Named Variable Parameters

This example will explain briefly, how to use named variable parameters for PL/SQL calls. As for example, this simple PL/SQL procedure with IN and OUT parameter will be used:


Its better to pass parameters to PL/SQL procedure through named variable parameters, instead of using indexes, your code becomes much readable then. Its not described in ADF developer guide - 37.5 Invoking Stored Procedures and Functions and developers may get confused, how to pass values through named variable parameters. If developer would try to use variable=? syntax:


Runtime error will be generated for such SQL callable statement:


Correct way is to use :variable syntax for SQL callable statement:


PL/SQL procedure is completed successfully: