Anil's Blog is Best Viewed on GOOGLE CHROME

Saturday, May 2, 2009

Partial Page Rendering (PPR)

A mechanism for selectively refreshing parts of a page (as opposed to the whole page) in response to user actions. For example, if a user sorts a table, only the table's contents changes; the rest of the page remains the same.

The FND: Disable Partial Page Rendering profile option must be set to No. If this profile value is set to Yes, a Go button renders next to each item you configure to raise a PPR event).

Important :-
Note: UIX currently does not support the ability to hide components whose direct parent region is a cellFormat or a rowLayout. As a workaround, to hide a component such as a button in a cellFormat, add flowLayout to your cellFormat region first, then add the button to the flowLayout

SPEL syntax : ${oa.ViewInstanceName.viewAttributeName>}
Example  ${oa.EmployeePVO1.EmpManagerRender}

You need to set this syntax on the attribute on which you want to enable PPR in the Parameters window. At runtime, this item will render according to the value of the EmpManagerRender attribute in the EmployeePVO1 view object.

To enable PPR on page, you must create an OA Framework standard applications properties view object (PVO) including a transient attribute for tracking the state of the visible property for the Attribute.

The application properties view object should be created in the same package as your module's other UI BC4J components. Note that you should have only one application properties view object per application module (it can include attributes used by different pages that share the same root UI application module).


Warning: This lesson assumes that you have completed the Create Exercise from Tutorial - shipped in Jdev Itself, and builds on that work. If you have not completed this exercise, please do so before proceeding

In this exercise we will implement the Partial Page Rendering.  Depending upon the value in Position Poplist will change the "Render Property" of Manager.

If the Position poplist value is null or PRESIDENT, the Manager field does not display. If it is set to any other value, the Manager field displays and is required.


Steps:

1. Create an "Application Properties" View Object
2. Add the EmployeePVO View Object to the EmployeeAM
3. Configure the Position Item to Fire a PPR Action When Changed
4. Configure the MgrName Item to React to PPR Events
5. Implement PPR Event Handling in Controller and Application Module Impl

Step1:
Create the EmployeePVO View Object

In the oracle.apps.ak.employee.server package, create the EmployeePVO view object.
In the Attributes page, select the New... button and create a transient primary key attribute with the following properties:
         * Name: RowKey
         * Type: Number
         * Updateable: Always
         * Key Attribute (checked)

Select the New... button again and create a transient attribute with the following properties:

        * Name: EmpManagerRender
        * Type: Boolean
        * Updateable: Always

You do not need to generate any Java files for this PVO.

After you create the PVO, reopen and navigate to the Tuning page. Check the Enable Passivation and For All Transient Attributes checkboxes (it's important that the transient attributes in an application properties view object be properly passivated).


Step2:
Add the EmployeePVO view object to the EmployeeAM.[Create the EmployeeAM if not created yet.]

Step3:
Configure the Position Item to Fire a PPR Action when changed. Set the following properties for the Position item in your page:

Property                                                                    Value

Disable Server Side Validation                                    True
Disable Client Side Validation                                     True
Action Type                                                               firePartialAction
Event                                                                    empPositionChange
Submit                                                                       True

Step 4
Configure the MgrName Item to React to PPR Events


Set the value of the Rendered property to the following SPEL ("Simplest Possible Expression Language") syntax indicating that the property value should be obtained from the EmployeePVO1 instance's EmpManagerRender attribute:

${oa.EmployeePVO1.EmpManagerRender}

Step 5
Implement PPR Event Handling

Controller Code

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
      // Always call this first.
      super.processRequest(pageContext, webBean);
      // Iniitalize the ApplicationPropertiesVO for PPR.
      am.invokeMethod("init");
}

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    // Always call this first.
    super.processFormRequest(pageContext, webBean);

if ("empPositionChange".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
    {
      // The Position poplist PPR change event has fired.
      am.invokeMethod("handlePositionChangeEvent");
    }
   }

Application Module Code

public void init()
{
OAViewObject appPropsVO = (OAViewObject)findViewObject("EmployeePVO1");
if (appPropsVO != null)
{
   if (appPropsVO.getFetchedRowCount() == 0)
   {
     appPropsVO.setMaxFetchSize(0);
     appPropsVO.executeQuery();
     appPropsVO.insertRow(appPropsVO.createRow());
// Set the primary key value for this single-rwo VO.
   OARow row = (OARow)appPropsVO.first();
   row.setAttribute("RowKey", new Number(1));
   }
}
 handlePositionChangeEvent();
}

public void handlePositionChangeEvent()
{
// Get the special, single-row application properties and make the first (only) row current.

OAViewObject vo = (OAViewObject)findViewObject("EmployeePVO1");
OARow row = (OARow)vo.first();

// Get the value of the view object attribute with the position code.

OAViewObject empVO = (OAViewObject)findViewObject("EmployeeFullVO1");
OARow empRow = (OARow)empVO.getCurrentRow();

String position = (String)empRow.getAttribute("PositionCode");
  if ((position == null) || ("PRESIDENT".equals(position)))
  {
  row.setAttribute("EmpManagerRender", Boolean.FALSE);
  }
else
   row.setAttribute("EmpManagerRender", Boolean.TRUE);
  }
}
Read Chapter Dynamic User Interface in Dev Guide for more details.....

1 comment:

Note: Only a member of this blog may post a comment.