Oracle Applications Technologies
Wednesday, August 4, 2010
Change color of particular field in table on particulate condition
Change color of particular field in table on particulate condition
Business requirement:
This is the particulate requirement which sometimes clients ask about this, mark the field in result table with different color if search condition match requirement or according to background process status change color of a field .
I did the following things to achieve above requirement
I just added below custom code to the Custom.xss file. You can find out this file in where you installed your J-developer .Path will look like this D:\JdeveloperR12\jdevhome\jdev\myhtml\OA_HTML\cabo\styles make sure file name’s first letter should be in capital .
_________________________________________________________
" !-- Please start your customizations here -->
'<'style selector=".Red"'>'
'<'property name="background-color"'>'#000000'<'/property'>'
'<'/style'>'
'<'style selector=".Yellow'>'
'<'property name="color"'>'#FFFF00'<'/property'>'
'<'/style'>'
_____________________________________________________________
In your VO query which brings result in table after search use decode as shown in below query
SELECT DECODE (lines.line_number
,1, 'Red'
) color
, lines.line_number
FROM apps.oe_order_lines_all lines
If line number is 1 it will mark background color as red
Next step is to bound the data value in controller
In processRequest write below code
public void processRequest(OAPageContext pageContext, OAWebBean webBean) {
super.processRequest(pageContext, webBean);
OAMessageStyledTextBean comCode1 =
(OAMessageStyledTextBean)webBean.findChildRecursive("LineNumber");
OADataBoundValueViewObject css12 =
new OADataBoundValueViewObject(comCode1, "Color");
comCode1.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR,
css12);
}
Saturday, July 3, 2010
Flex field on OAF Page
Set default values to flex field in OAF programmatically
Business requirement
When you navigate to create new vacancy page from i-recruitment you will see below screen. When user select value from BCN pick list then other values should get defaulted like vacancy type, Organization, job title of flex field segments.
To achieve above requirement I used below code in custom controller which will attach fire action to the pick list and in processFormRequest it will assign values to the another segments of flex field
package xxclt.oracle.apps.irc.vacancy.webui;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.OAWebBeanUtils;
import oracle.apps.fnd.framework.webui.beans.OADescriptiveFlexBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageCheckBoxBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovChoiceBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import oracle.apps.irc.vacancy.webui.VacNewDetsPageCO;
import oracle.cabo.ui.action.FireAction;
import oracle.jbo.ViewObject;
public class XXVacNewDetsPageCO extends VacNewDetsPageCO {
public XXVacNewDetsPageCO() {
}
public void processRequest(OAPageContext pageContext, OAWebBean webBean) {
super.processRequest(pageContext, webBean);
OADescriptiveFlexBean dffBean =
(OADescriptiveFlexBean)webBean.findIndexedChildRecursive("FndFlexField");
dffBean.processFlex(pageContext);
OAMessageChoiceBean segment1 =
(OAMessageChoiceBean)dffBean.findChildRecursive("FndFlexField0");
segment1.setRequired("yes");
segment1.setFireActionForSubmit ("selectBCN",null, null,true, true);
}
public void processFormRequest(OAPageContext pageContext,
OAWebBean webBean) {
super.processFormRequest(pageContext, webBean);
if ("selectBCN".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM))) {
// The Position poplist PPR change event has fired.
OAApplicationModule am = pageContext.getRootApplicationModule();
String vStatus;
OADescriptiveFlexBean dffBean =
(OADescriptiveFlexBean)webBean.findIndexedChildRecursive("FndFlexField");
dffBean.processFlex(pageContext);
OAMessageChoiceBean bcnSegment =
(OAMessageChoiceBean)dffBean.findChildRecursive("FndFlexField0");
String vBCNValue = bcnSegment.getSelectionValue(pageContext) ;
pageContext.writeDiagnostics("XXCLIENT",vBCNValue,1);
String vacancyInfoQuery =
"SELECT bcn, grade, job_title, vacancy_type, ORGANIZATION FROM xxclt_mbd_bcn_info_v";
//Specify the Where Clause for the same
vacancyInfoQuery = vacancyInfoQuery + " WHERE bcn = :1 ";
//First see if this VO is already attached to view object
ViewObject vacancyInfoVO = am.findViewObject("XXVvacancyInfoVO");
if (vacancyInfoVO == null)
vacancyInfoVO =
am.createViewObjectFromQueryStmt("XXVvacancyInfoVO",
vacancyInfoQuery);
//By now we are sure that the view object exists
vacancyInfoVO.setWhereClauseParams(null);
//Set the where clause
vacancyInfoVO.setWhereClauseParam(0, vBCNValue);
vacancyInfoVO.executeQuery();
oracle.jbo.Row row = vacancyInfoVO.first();
//get the value of description column from View Object record returned
String vGrade = "";
String vJobTitle = "";
String vVacancyType = "";
String vOrganization = "";
if (row != null) {
vGrade = row.getAttribute(1).toString();
vJobTitle = row.getAttribute(2).toString();
vVacancyType = row.getAttribute(3).toString();
vOrganization = row.getAttribute(4).toString();
}
OAMessageLovInputBean vGradeBean =
(OAMessageLovInputBean)webBean.findChildRecursive("FndGrade");
OAMessageLovInputBean vJobTitleBean =
(OAMessageLovInputBean)webBean.findChildRecursive("FndJobTitle");
OAMessageChoiceBean vVacancyTypeBean =
(OAMessageChoiceBean)dffBean.findChildRecursive("FndFlexField1");
OAMessageLovInputBean vOrgBean =
(OAMessageLovInputBean)webBean.findChildRecursive("FndOrganization");
vVacancyTypeBean.setSelectedValue(vVacancyType);
vGradeBean.setText( vGrade);
vJobTitleBean.setText(vJobTitle);
vOrgBean.setText(vOrganization);
// vOrgBean.set
OAMessageCheckBoxBean vEmpChkBox;
OAMessageCheckBoxBean vCntrChkBox;
vEmpChkBox =
(OAMessageCheckBoxBean)webBean.findChildRecursive("FndEmployee");
vCntrChkBox =
(OAMessageCheckBoxBean)webBean.findChildRecursive("FndContractor");
if (vVacancyType.equals("PMR") ) {
vEmpChkBox.setChecked(true);
vCntrChkBox.setChecked(false);
}else if(vVacancyType.equals("TMR") ) {
vCntrChkBox.setChecked(true);
vEmpChkBox.setChecked(false);
}
//Remove the view object, as this is no longer required
vacancyInfoVO.remove();
}
}
}
Business requirement
When you navigate to create new vacancy page from i-recruitment you will see below screen. When user select value from BCN pick list then other values should get defaulted like vacancy type, Organization, job title of flex field segments.
To achieve above requirement I used below code in custom controller which will attach fire action to the pick list and in processFormRequest it will assign values to the another segments of flex field
package xxclt.oracle.apps.irc.vacancy.webui;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.OAWebBeanUtils;
import oracle.apps.fnd.framework.webui.beans.OADescriptiveFlexBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageCheckBoxBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovChoiceBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import oracle.apps.irc.vacancy.webui.VacNewDetsPageCO;
import oracle.cabo.ui.action.FireAction;
import oracle.jbo.ViewObject;
public class XXVacNewDetsPageCO extends VacNewDetsPageCO {
public XXVacNewDetsPageCO() {
}
public void processRequest(OAPageContext pageContext, OAWebBean webBean) {
super.processRequest(pageContext, webBean);
OADescriptiveFlexBean dffBean =
(OADescriptiveFlexBean)webBean.findIndexedChildRecursive("FndFlexField");
dffBean.processFlex(pageContext);
OAMessageChoiceBean segment1 =
(OAMessageChoiceBean)dffBean.findChildRecursive("FndFlexField0");
segment1.setRequired("yes");
segment1.setFireActionForSubmit ("selectBCN",null, null,true, true);
}
public void processFormRequest(OAPageContext pageContext,
OAWebBean webBean) {
super.processFormRequest(pageContext, webBean);
if ("selectBCN".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM))) {
// The Position poplist PPR change event has fired.
OAApplicationModule am = pageContext.getRootApplicationModule();
String vStatus;
OADescriptiveFlexBean dffBean =
(OADescriptiveFlexBean)webBean.findIndexedChildRecursive("FndFlexField");
dffBean.processFlex(pageContext);
OAMessageChoiceBean bcnSegment =
(OAMessageChoiceBean)dffBean.findChildRecursive("FndFlexField0");
String vBCNValue = bcnSegment.getSelectionValue(pageContext) ;
pageContext.writeDiagnostics("XXCLIENT",vBCNValue,1);
String vacancyInfoQuery =
"SELECT bcn, grade, job_title, vacancy_type, ORGANIZATION FROM xxclt_mbd_bcn_info_v";
//Specify the Where Clause for the same
vacancyInfoQuery = vacancyInfoQuery + " WHERE bcn = :1 ";
//First see if this VO is already attached to view object
ViewObject vacancyInfoVO = am.findViewObject("XXVvacancyInfoVO");
if (vacancyInfoVO == null)
vacancyInfoVO =
am.createViewObjectFromQueryStmt("XXVvacancyInfoVO",
vacancyInfoQuery);
//By now we are sure that the view object exists
vacancyInfoVO.setWhereClauseParams(null);
//Set the where clause
vacancyInfoVO.setWhereClauseParam(0, vBCNValue);
vacancyInfoVO.executeQuery();
oracle.jbo.Row row = vacancyInfoVO.first();
//get the value of description column from View Object record returned
String vGrade = "";
String vJobTitle = "";
String vVacancyType = "";
String vOrganization = "";
if (row != null) {
vGrade = row.getAttribute(1).toString();
vJobTitle = row.getAttribute(2).toString();
vVacancyType = row.getAttribute(3).toString();
vOrganization = row.getAttribute(4).toString();
}
OAMessageLovInputBean vGradeBean =
(OAMessageLovInputBean)webBean.findChildRecursive("FndGrade");
OAMessageLovInputBean vJobTitleBean =
(OAMessageLovInputBean)webBean.findChildRecursive("FndJobTitle");
OAMessageChoiceBean vVacancyTypeBean =
(OAMessageChoiceBean)dffBean.findChildRecursive("FndFlexField1");
OAMessageLovInputBean vOrgBean =
(OAMessageLovInputBean)webBean.findChildRecursive("FndOrganization");
vVacancyTypeBean.setSelectedValue(vVacancyType);
vGradeBean.setText( vGrade);
vJobTitleBean.setText(vJobTitle);
vOrgBean.setText(vOrganization);
// vOrgBean.set
OAMessageCheckBoxBean vEmpChkBox;
OAMessageCheckBoxBean vCntrChkBox;
vEmpChkBox =
(OAMessageCheckBoxBean)webBean.findChildRecursive("FndEmployee");
vCntrChkBox =
(OAMessageCheckBoxBean)webBean.findChildRecursive("FndContractor");
if (vVacancyType.equals("PMR") ) {
vEmpChkBox.setChecked(true);
vCntrChkBox.setChecked(false);
}else if(vVacancyType.equals("TMR") ) {
vCntrChkBox.setChecked(true);
vEmpChkBox.setChecked(false);
}
//Remove the view object, as this is no longer required
vacancyInfoVO.remove();
}
}
}
Subscribe to:
Posts (Atom)