Sunday, October 9, 2011

Tuesday, August 16, 2011

Execute a default command button on clicking 'Enter' anywhere in the af:form in Oracle ADF?

This can be achieved by configuring the defaultCommand property of the af:form tag in the jsff page fragment or jspx page document in Oracle ADF.

We have to configure defaultCommand with the id attribute of the command button inside the form whose action should be invoked by default when the enter key is pressed with focus inside the form. If defaultCommand is not specified, no action is invoked when the enter key is pressed with focus inside the form.

For example:

<af:form id="f1" defaultCommand="pt1:cb4">

Thursday, May 12, 2011

Get the Application Module instance in backing bean from Data Control in Oracle ADF?

Sometimes we might need the view object instance or the application module instance in the manged bean in the view controller project. The following code snippet is a sample to do the same

import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCDataControl;
import oracle.jbo.ApplicationModule;

public static ApplicationModule getAMOfDataControl(String name){
    BindingContext bindingContext = BindingContext.getCurrent();
    ApplicationModule appModule = null;
    if (bindingContext != null) {
        DCDataControl dc = bindingContext.findDataControl(name);
        if (dc != null) {
            appModule = (ApplicationModule)dc.getDataProvider();
        }
    }
    return appModule;
}

Once we get the application module, we can get the required View Object instance.