ADF Faces RC: How-to pass additional arguments to a JavaScript function using the af:clientAttribute element
By frank.nimphius | July 22, 2008
In JDeveloper 11, JavaScript events like onClick, onFocus etc. are handled through the ADF Faces RC client framework using the af:clientListener component. The signature of the af:clientListener is defined such that the developer provides the name of a method to call and the JavaScript event to trigger this method call. The clientListener signature however doesn’t foresee a mechanism for the developer to pass additional arguments - like a rowKey - to the JavaScript method. Here client attributes come to the rescue.
Topics: ADF Faces RC | No Comments »
How-to build a reusable Glasspane in ADF Faces RC
By frank.nimphius | July 15, 2008
Ever met a patient application user? If not, don’t worry, they just don’t exist. Users work with an application to get their job done in the shortest time possible. So clicking a button and then sit and wait for a response to show is not their kind. If an application is busy with a background process - e.g. querying the database for a complex query - then after a certain amount of waiting time, users tend to use their mouse to click somewhere in the application, just to show that they are still waiting or to force the application to come back to him. User activity like this can lead to many unwanted effects: double form submission or queued events that the user didn’t want. The only way out of this is to “disable” the user interaction for the time the background process takes. While the ADF Faces RC command button exposes a blocking property that - when set to true - prevents users from double submitting an action, it doesn’t prevent him from clicking anywhere else in the application. Users want entertainment while they wait, so ideally while blocking them from working in the application, they see something animated. A Glasspane is a transparent overlay that prevents users from interacting with a screen during the time of background processing. In ADF Faces RC there is no native Glasspane component available, like for example in Swing, but with a few on-board functionality and components, this component can be built as a declarative custom component. This how-to document explains the principles of building a reusable Glasspane component in ADF Faces RC.
Topics: Uncategorized, ADF Faces RC | No Comments »
ADF Faces RC: How-to Conditionally Prevent Dialogs from Closing
By frank.nimphius | July 1, 2008
ADF Faces Rich Client provides in browser popup dialogs and panels. Compared to the still existing and still good to use ADF Faces dialog framework, the popups are lightweight dialogs that have their content defined within the parent page. At runtime these popups render as DHTML dialogs on the parent page. The available categories of popups include inline selectors, dialogs, note windows and menus. A dialog component, added as the first child of af:popup, may contain buttons like ok, cancel, yes and no. Each of the buttons allow the developer to respond to the user selection in a managed bean method before the dialog is closed. And this is where this how-to comes in. How can closing a dialog made conditional ?
Frank
Topics: ADF Faces RC | No Comments »
How to Access Attributes of a Declarative Component from a Managed Bean
By frank.nimphius | June 26, 2008
In an earlier how-to document I explained how to build and work with declarative components in ADF such that it displays data passed from the containing page. As you would have guessed to this time already, there are more usecases to cover for declarative components. The usecase in this article describes how to access an attribute within a declarative component from a managed bean that is part of it. For example, to write a generic component that allows the containing page to pass in e.g. a download URL to process, the attribute of the declarative component doesn’t need to be bound to a UI component. This however means that developers need to find a way to access the hidden attribute programmatically - and of course there is.
Topics: ADF Faces RC | No Comments »
How-to find and set control hints on POJO entities in bean Data Controls
By frank.nimphius | June 25, 2008
A very useful feature that ADF brings to Java EE application development is the ability to specify control hints for enitities in a central place for all UI component to use. A common usecase for this are labels that appear as prompts on a web page, e.g. in a ADF Faces form layout. Users of ADF Business Components know this feature for as long as ADF Business Components is around, but users of EJB, JPA and POJO may not have tried this feature yet.
This how-to document explains how to find an entity for a given UI component and how to set its control property. Its a reverse development as usually you should define labels as soon as you created the data control. However, you will see how this can be done as well.
Topics: ADF | No Comments »
ADF Faces: How-to use the table sort listener property to override sorts
By frank.nimphius | June 11, 2008
Only a small code snippet to share, but for sure this might become handy if you need it. In ADF Faces 10.1.3 the table has a sort listener that allows you as the developer to intercept the user sort initiated by a click on the table header. You can use the sort listener to override the user sort criteria or to append to it. The following code snippet represents a managed bean with a sort listener method that changes the user sort criteria from DepartmentName to DepartmentId whenever the user tries to sort by DepartmentName.
I know, the example is not implementing a ground breaking usecase; but its the code that counts as it gets you started implementing your ow usecase
-
import java.util.ArrayList;
-
import java.util.List;
-
-
import oracle.adf.view.faces.component.core.data.CoreTable;
-
import oracle.adf.view.faces.event.SortEvent;
-
import oracle.adf.view.faces.model.SortCriterion;
-
-
-
public class Sortbean {
-
public Sortbean() {
-
}
-
-
public void onSort(SortEvent sortEvent) {
-
-
List sortList = sortEvent.getSortCriteria();
-
SortCriterion sc = (SortCriterion) sortList.get(0);
-
-
//override sort by DepartmentName and make it sort by DepartmentId instead
-
if (((String)sc.getProperty()).equalsIgnoreCase("DepartmentName")){
-
System.out.println("You wanted to sort " +sc.getProperty());
-
-
sortList = new ArrayList();
-
SortCriterion sc2 = new SortCriterion("DepartmentId",true);
-
System.out.println("This is what I want you to sort for "+sc2.getProperty());
-
sortList.add(sc2);
-
-
CoreTable ct = (CoreTable)sortEvent.getComponent();
-
ct.setSortCriteria(sortList);
-
}
-
}
-
}
Frank
Topics: ADF Faces | No Comments »
How-to build hierarchical Select Choices in ADF Faces RC
By frank.nimphius | June 6, 2008
Apparently, in the JavaServer Faces you are able to build hierarchical select choice lists that display the list entries categorized by their parent records. For ADF Faces RC, hierarchical select choices are an enhancement request filed and wont be available in the initial production release of JDeveloper 11. However, with a bit of programming - where the emphasize clearly is on the "bit" word - you can achieve exactly the same behavior. This how-to document explains how you build hierarchical tree lists based on the Oracle Fusion stack, which is ADF Faces RC, ADF for the binding and ADF BC for the persistence layer.
Frank
Topics: ADF Faces RC | No Comments »
ADF Faces RC - How-to use the Client and Server Listener Component
By frank.nimphius | June 4, 2008
One of the most interesting features in Ajax is the ability of an application to send user information to the server without user recognition. A positive use of this feature is the auto suggest feature, which provides the user with a list of possible select values based on the user input into a text field. Another positive use is auto completion of strings, in which case the user enters a shortcut into a text field e.g. "NY" for the system to complete the field with New York. This how-to document shows how this Ajax functionality is achieved in ADF Faces RC using the client and server listener component.
Frank
Topics: ADF Faces RC | No Comments »
ADF Faces: Building tree structures from rekursive queries in ADF BC
By frank.nimphius | June 2, 2008
Another lost example: The workspace linked by this blog entry shows how to build a tree from a rekursive query in a ViewObject. You will notice that the tree model has been build manually and that this functionality isn't provided for declarative use.
Setup Instructions
Make sure you have the HR schema accessible (the workspace uses “hrconn” as a connect configuration). Also, the workspace comes without the jsf-impl.jar and adf-faces-impl.jar to reduce the download size. Both files need to be copied from the JDeveloper jsf-ri and jlib directory to the view project’s public_html/web-inf/lib directory before running the sample
Frank
Topics: ADF Faces | No Comments »
How-to Refresh a Bound Taskflow that is added as a Region to an ADF Faces RC Page and that is displayed in a Popup Dialog
By frank.nimphius | May 29, 2008
Every technology seems to have its superstar; a feature that developers love and use more than any other feature. Though in ADF Faces RC, there seem to be more than one super star feature, the clear winner of Oracle ADF Faces RC pop idol feature contest is a bound taskflow that is added to a page in a region that is displayed in a popup dialog on demand. The most frequent question asked on the JDeveloper help forum on OTN is how to refresh such a bound taskflow - and this indeed doesn't seem to be obvious until you have a look at the developer guide documentation.
Frank
Topics: ADF Faces RC, ADF | No Comments »
« Previous Entries
