OA Framework – Few code snippets

Ø      Code for Disabling Global Buttons  (in process request)

   OAPageLayoutBean page = (OAPageLayoutBean)pageContext.getPageLayoutBean();        page.prepareForRendering(pageContext);        
OAGlobalButtonBarBean buttons = (OAGlobalButtonBarBean)page.getGlobalButtons();
       
buttons.setRendered(false);
 

Ø      Code for Setting Initial Focus on a field (in process request)

 import oracle.apps.fnd.framework.webui.beans.OABodyBean;

OABodyBean oabean = (OABodyBean)pageContext.getRootWebBean();

oabean.setInitialFocusId(“ProjectType1”);
 

Ø      Code for Handling enter key press after entering a value in the text box.

 (in process request)

OAMessageLovInputBean messagelovinputbean = (OAMessageLovInputBean)webBean.findIndexedChildRecursive(“SelectVersion“);
// SelectVersion is the id of the lov item in the page   if(messagelovinputbeanPerson != null)        {
        Hashtable params = new Hashtable();       
params.put(“
Go“, “true”);   
 
//Go is the name of the button, whose action should happen after enter key press

messagelovinputbeanPerson.setAttributeValue(OAWebBeanConstants.ON_KEY_PRESS_ATTR,new OABoundValueEnterOnKeyPress(pageContext,”DefaultFormName”,params,true,true));     }

Ø      Code for releasing lock on a database transaction (in AMImpl)

 OADBTransaction oadbTransaction = getOADBTransaction(); 
oadbTransaction.setLockingMode(oadbTransaction.LOCK_NONE);
 

Ø      Code for wrapping text in read-only text area (in Process Request)

textBean.setWrap(SOFT_WRAP); 

Ø      Handling Browser Back Button

(In Process Request)

 if (!pageContext.isBackNavigationFired(false)) {
   TransactionUnitHelper.startTransactionUnit(pageContext, “xxxxxxxxxxTxn”);
 // All your processRequest logic should be inside this IF loop.
  } else {
 
if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, “xxxxxxxxxxxTxn”, true)) {
OADialogPage dialogPage = new OADialogPage(STATE_LOSS_ERROR);
pageContext.redirectToDialogPage(dialogPage);
                                           }
             
}

(In Process Form Request, before redirecting to a different page or before form submission)

TransactionUnitHelper.endTransactionUnit(pageContext, “xxxxxxxxxxxxxxxTxn”);

Advertisements
This entry was posted in OAF. Bookmark the permalink.

3 Responses to OA Framework – Few code snippets

  1. shivdeep singh says:

    nice job buddy

    keep the good work going .

    expecting some more good things like this..

    rgds

    Shivdeep Singh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s