Professional Documents
Culture Documents
region.
For this exercise we have created three poplist viz. State, County and City where
State is an Independent poplist while County is dependent on state and City is
dependent on both State and County.
Brief Steps:-
Detailed Description
Step 1: First create Workspace, Project and create an Application Module to interact
with Database.
Step 2: Create three ViewObjects for poplists (state, county and city) as shown below.
♣ PayUsStatesVO
http://oracleanil.blogspot.com/
http://oracleanil.blogspot.com/
♣ PayUsCountiesVO
♣ PayUsCityNamesVO
Step 3: Create a Property View Object to handle PPR event.
♣ RenderCounty
♣ RenderCity
http://oracleanil.blogspot.com/
Add all VOs to DependentPoplistAM
http://oracleanil.blogspot.com/
Step 4: Build the Poplist Page with three poplist under MessageComponentLayout
region as shown below.
http://oracleanil.blogspot.com/
Make sure you set the Picklist View Instance Property not Picklist View Definition.
http://oracleanil.blogspot.com/
http://oracleanil.blogspot.com/
Attach SPEL Syntax to the Rendered property of County and City poplist and
FirePartialAction event with State and County
♣ State
♣ County
http://oracleanil.blogspot.com/
♣ City
http://oracleanil.blogspot.com/
Controller Code
package anil.oracle.apps.pay.webui;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import
oracle.apps.fnd.framework.webui.beans.layout.OAMessageComponentLayoutBea
n;
import
oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;
import oracle.apps.fnd.framework.OAApplicationModule;
import java.io.Serializable;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.jbo.Row;
/**
* Controller for ...
*/
public class DependentPoplistCO extends OAControllerImpl
{
public static final String RCS_ID="$Header$";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
/**
* Layout and page setup logic for a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processRequest(OAPageContext pageContext, OAWebBean
webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
/**
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processFormRequest(OAPageContext pageContext, OAWebBean
webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
}
// This event gets called when user select a County
if("ChangeCounty".equals(pageContext.getParameter(EVENT_PARAM)))
{
OAMessageComponentLayoutBean mclb =
(OAMessageComponentLayoutBean)webBean.findChildRecursive("MainRN");
OAMessageChoiceBean mcb1 =
(OAMessageChoiceBean)mclb.findChildRecursive("State");
String stateCode = (String)mcb1.getValue(pageContext);
OAMessageChoiceBean mcb2 =
(OAMessageChoiceBean)mclb.findChildRecursive("County");
String countyCode = (String)mcb2.getValue(pageContext);
Serializable params[] = {stateCode,countyCode};
am.invokeMethod("ChangeCounty",params);
}
}
}
http://oracleanil.blogspot.com/
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import anil.oracle.apps.pay.poplist.server.PayUsStatesVOImpl;
import anil.oracle.apps.pay.poplist.server.PayUsCountiesVOImpl;
import anil.oracle.apps.pay.poplist.server.PayUsCityNamesVOImpl;
import oracle.jbo.Row;
DependentPoplistPVOImpl vo =
(DependentPoplistPVOImpl)getDependentPoplistPVO1();
if(vo != null)
{
if(!vo.isPreparedForExecution())
{
vo.executeQuery();
}
DependentPoplistPVOImpl vo =
(DependentPoplistPVOImpl)getDependentPoplistPVO1();
if(vo != null)
{
if (stateCode != null && countyCode == null)
{
vo.getCurrentRow().setAttribute("RenderCounty",Boolean.TRUE);
vo.getCurrentRow().setAttribute("RenderCity",Boolean.FALSE);
}
else if(countyCode != null)
{
vo.getCurrentRow().setAttribute("RenderCounty",Boolean.TRUE);
vo.getCurrentRow().setAttribute("RenderCity",Boolean.TRUE);
}
else
{
vo.getCurrentRow().setAttribute("RenderCounty",Boolean.FALSE);
vo.getCurrentRow().setAttribute("RenderCity",Boolean.FALSE);
}
}
}
}
PayUsCityNamesVOImpl Code
PayUsCountiesVOImpl Code
public void initQuery(String stateCode)
{
setWhereClause(null);
setWhereClauseParams(null);
setWhereClauseParam(0,stateCode);
executeQuery();
}
Finally the page will look like as below
Thanks
--Anil
http://oracleanil.blogspot.com/