Wednesday, August 7, 2019

Advance Table Column Format in OAF

Advance Table Column Format in OAF
Advance Table Column Format in OAF

Include this code in your controller:

Formatter formatter = new OADecimalValidater("#,##0.0000", "#,##0.0000");
OAAdvancedTableBean AdvTable1 =(OAAdvancedTableBean)webBean.findChildRecursive("AdvTable1");
OAColumnBean column3 = (OAColumnBean)AdvTable1.findIndexedChildRecursive("column3");
column3.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);

or you can also try with this code:

OAAdvancedTableBean tableBean = (OAAdvancedTableBean)webBean.findChildRecursive("AdvTable1");
if(tableBean != null){
OATableFooterBean footerBean = (OATableFooterBean) tableBean.getFooter();
System.out.println("footerBean : "+footerBean);
if (footerBean!= null){
OATotalRowBean totalRowBean = (OATotalRowBean)footerBean.findIndexedChild("totalRow1");
System.out.println("Formattotal : "+totalRowBean);
if (totalRowBean != null){
Formatter formatter = new OADecimalValidater("#,##0.00;(#,##0.00)","#,##0.00;(#,##0.00)");
totalRowBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);
}
}
}

Friday, July 19, 2019

Wednesday, January 23, 2019

Right Align a Column in a Table in OAF Page

Right Align a Column in a Table in OAF Page
Use following code in (processRequest):

 OATableBean tbl = (OATableBean)webBean.findChildRecursive("xxVO1");
         tbl.prepareForRendering(pageContext);
         DataObjectList dataformat = tbl.getColumnFormats();
         DictionaryData data = (DictionaryData)dataformat.getItem(pageContext.findChildIndex(tbl, "TableColumn"));
         data.put(UIConstants.CELL_NO_WRAP_FORMAT_KEY, Boolean.TRUE);

Thursday, January 10, 2019

Making the Table rows Read Only in OAF Page

Making the Table rows Read Only in OAF Page
I have seen a lot of discussion on Oracle forums, where the user want to populate the data in read only mode but only specific rows.

Step -1: Create a transient attribute in the View Object attached to the Table of type Boolean.

Step -2: Create a SPEL.

Step -3: Attach this SPEL to the Read Only Property for the entire columns.

Step -4: Set the property at runtime for this Transient Attribute as TRUE or FALSE.


Write the below code in AM. This method is used to set the Read-only property to TRUE for each rows in the table.


------------- AM Code -----------------

    public void SetReadOnlyTrue() {

    OAViewObject var_vo = (OAViewObject)getXxVO1();

    if (var_vo!= null) {

    var_vo.executeQuery();

    int rowCountValue = var_vo.getRowCount();

    Row[] allRows = var_vo.getFilteredRows("XxAttribute","True");  /* Attribute in VO which specifies that the row is read only. */

    for ( int x= 0; x < allRows.length; x++ ){

    XxVORowImpl rowi = (XxVORowImpl)allRows[x];

    if(rowi!=null){

    rowi.setAttribute("TransientAttribute", Boolean.TRUE); }

    }

    }

    }

Call this method in controller (processRequest or processFormRequest).

Thursday, December 27, 2018

How to check value(if it is null or not) in processFormRequest

How to check value(if it is null or not) in processFormRequest
if (pageContext.getParameter("ApplyBtn") != null){

         OAViewObject voh = (OAViewObject)am.findViewObject("XxVO1");
         try {
             voh.getCurrentRow().getAttribute("XxColumnName").toString();
         } catch (NullPointerException e) {
             throw new OAException("XxColumnName Name is Required", OAException.ERROR);
         }
}

Friday, November 30, 2018

Popup Regions in R12.1.2 for Jdeveloper 10g OAF

Our objective is when a user hover its mouse over Employee name field a popup window will open that shows the details of that employee.


Step 1

For this we will create a query view of Employee name it as EmployeePopupVO for our popup region. After this create an external region with AM definition inside webui package as shown below name it as EmpSummaryPopupRN.



Step 2

Now in our EmployeeSearchPG page we will create a new flowLayout region and drag our EmpName messageStyleText field into it.



Step 3

Now under this flowLayout region EmpNameLayout we will create a region of style popup and set Region property to above external region (EmpSummaryPopupRN, created in Step1) name it as EmpSummaryPopup.






Now for the popup region to come up as soon as a user hover over EmpName field we need to set some properties of this field like


ID : Empname
Popup ID : EmpSummaryPopup
Popup Render Event : onHover
Popup Enable : True



After completing this run your page and hover over EmpName field you will see a new popup window coming on to your page as shown in starting of this article.