Monday, August 31, 2015

ADF Install tag lib


Add following to jsff
xmlns:c="http://java.sun.com/jsp/jstl/core"

But got complaint error:
Tag library referenced Tag library referenced but not installed

Go to
Project --> Select Project Property --> Select JSP Tag libraries 

There you can add library needed.

Thursday, August 27, 2015

ADF Table with context menus

We can add ADF Table context menus so user right clicks on a row, the context menu will be displayed.


add a facet to table
<af:table>
        <f:facet name="contextMenu">
           <af:popup id="cmpop" contentDelivery="lazyUncached">
               <af:menu id="cmm1" text="My Context Menu">
                  <af:commandMenuItem text="Do something"
                          id="cmi1"
                          actionListener="#{backingBeanScope.myBean.myActionListener}"/>
               </af:menu>
          </af:popup>
        </f:facet>
</af:table>
 Table has another property:
          contextMenuSelect="true" so this ensures the right click on a row will make the row selected and context menu shows up.

Note:

  • add <af:showPopupBehavior triggerType="contextMenu" popupId="cmpop"/> if you like for table columns for context menu display
  • add partial triggers so UI refreshes after context menu execution.

Wednesday, August 26, 2015

Refresh adf region without contextual event

The trick is region will refresh whenever its input parameter changes.

  • Go the page with the region which will be refreshed.
  • Go to binding tab and select the region from Executables
    • add an input parameter id=refreshInd value=#{pageFlowScope.dummyParam}
    • set Refresh=ifNeeded
So any point, you want the region to refresh, 

ADFUtils.getPageFlowScope().put("dummyParam", Long.toString(System.currentTimeMillis()));

Another trick is using current mill second as input value - that's guaranteed to have a new value for the input.

Thursday, August 20, 2015

Missing IN or OUT parameter error in ADF binding variable


See blog psot below:

The infamous Missing IN or OUT parameter error

In short:
make sure the bind variables are set to required. Bind variables that are marked as optional are only good to be used in View Criterias.

Wednesday, August 19, 2015

Complie warning for ADF project


There is a warning while building a ADF project in JDeveloper 11.1.1.9.

Warning: Supported source version 'RELEASE_6' from annotation processor 'oracle.dbtools.common.service.ConfigProcessor' less than -source '1.7'

The problem is we are using JDK 1.7 instead of default 1.6.

Go to Project Properties -> Compiler, setting is default


change default Source 1.6, Generated Class Files 1.7 the warning is disappeared.



 

Tuesday, August 18, 2015

ADF Error Handling

Exceptions are thrown in different places or layers of the ADF application. ADF framework allow applications to register general error handlers on different layers. 



Task Flow Error Handling

Create a task flow called base-taskflow-template.xml. 

In base-taskflow-template.xml, 
  • create a bean class TashFlowErrorHandler. In the class, create a method called 
public void handleException() {//add handling logic}
  • add it to base-taskflow-template.xml as request scope.
  • add a method-call named ErrorHandler, marked it as Exception Handler.
All task flows extend base-taskflow-template.xml. So exceptions are handled by the registered handler.



Bean Exception Handling

When the ADF view layer calls a method from a managed bean and this method throws an exception, the default ADFExceptionHandler is called. To override the default behavior,  

Create class BeanExceptionHandler
public class BeanExceptionHandler extends ExceptionHandler

To register the exception handler, create a file called "oracle.adf.view.rich.context.ExceptionHandler"
add text (class full qualified name) in the file:

com.abc.view.util.BeanExceptionHandler

put this file in master application (deployed as ear file) under folder below (create if doesn't exist)

.adf\META-INF\services




Binding Error Handler

Managed bean may call Application Module methods by DataControls. Such calls use the bindings which are handled by the DataBindings.cpx mainly. 

Create a class called 
public class BindingErrorHandler extends DCErrorHandlerImpl

In master application DataBindings.cpx, we define the ErrorHandlerClass="com.abc.view.util.BindingErrorHandler