Display a iframe (HTML widget in oaf page) in oaf page using CO Extension
Business case: display a iframe (HTML widget in oaf page) at the bottom of oaf page
(using this you can display any HTML content/ PDF/JSP page inside the HTML widget)
- Turn on the personalization by setting the appropriate profile value from system administrator
- Navigate to page -> Personalize page as below
- Click on the personalize pencil icon for item which has CO associated with it
4) Here you can see controller
class name is ProjectProfileCO
Now we need to
create a custom class file and extend this class in our custom class file so
that we can append our custom logic to the seeded OAF page.
5) Create a class file with any
name as below and copy this class file in server on the location as given
in package. Make sure the location is named correctly , copy the file in
$JAVA_TOP under specific folder structure.
Note: You
can also use JDeveloper to create java file , this can help if you want to
access any methods associated with standard java code, in order to do this you
must import the required java class files in JDeveloper from oracle server e.g. You may need to import classes located at
oracle.apps.fnd.framework.*
Below is the controller class file code , based on requirement you can either display it in PFR/PR to render on action or while page is rendered.
package
opentext.oracle.apps.xxxecm4o_bp.costingsheet.webui;
import
java.awt.Window;
import
oracle.apps.fnd.framework.OAApplicationModule;
import
oracle.apps.fnd.framework.OAFwkConstants;
import
oracle.apps.fnd.framework.OARow;
import
oracle.apps.fnd.framework.OAViewObject;
import
oracle.apps.fnd.framework.webui.OADataBoundValueFireActionURL;
import
oracle.apps.fnd.framework.webui.OAPageContext;
import
oracle.apps.fnd.framework.webui.OAUrl;
import
oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import
oracle.apps.fnd.framework.webui.beans.OASwitcherBean;
import
oracle.apps.fnd.framework.webui.beans.OAWebBean;
import
oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
import
mict.oracle.apps.xxcs.project.profile.webui.ProjectProfileCO;
import
oracle.apps.fnd.framework.webui.beans.OAHTMLWebBean;
import
oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean;
import
oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean;
import
oracle.cabo.ui.action.FireAction;
import
oracle.cabo.ui.action.FirePartialAction;
import
oracle.cabo.ui.collection.Parameter;
public class
XxxecmProjectsCO54 extends ProjectProfileCO {
public
static String xx_val;
public void processRequest(OAPageContext
pageContext, OAWebBean webBean) {
super.processRequest(pageContext, webBean);
try {
// in case you need to display header to the i-frame use below //
// OAHeaderBean Bean = (OAHeaderBean)
createWebBean(pageContext, HEADER_BEAN);
// Bean.setLabel("Project Business
Worksapce");
// OAPageLayoutBean page = (OAPageLayoutBean)
pageContext.getPageLayoutBean();
// page.addIndexedChild(Bean);
try {
OAApplicationModule am =
pageContext.getApplicationModule(webBean);
pageContext.writeDiagnostics(this,
"xxecm getting project_id value from
opentext.oracle.apps.xxxecm4o_bp.costingsheet.webui.XxxecmProjectsCO51.class",
OAFwkConstants.EXCEPTION);
if
(pageContext.getSessionValueDirect("TRX_PROJECT_ID") != null) {
pageContext.writeDiagnostics(this,
"xxecm inside if condition", OAFwkConstants.EXCEPTION);
xx_val =
pageContext.getSessionValueDirect("TRX_PROJECT_ID").toString();
}
if
(pageContext.isLoggingEnabled(OAFwkConstants.EXCEPTION)) {
pageContext.writeDiagnostics(this,
"[TestCO]processRequest():- xxecm project ID value is "+xx_val,
OAFwkConstants.EXCEPTION);
}
} catch (Exception e) {
pageContext.writeDiagnostics(this,
"Exception ocurred in getting am xxx:" + e,
OAFwkConstants.STATEMENT);
}
String xx_msg_type;
xx_msg_type = "Projects";
//
pageContext.putSessionValue("211", xx_val);
String final_url;
final_url =
"OA.jsp?page=/opentext/oracle/apps/xxxecm4o/bws/webui/workspacePG&xxotBOId="
+ xx_val +
"&xxotBOType=Projects&addBreadCrumb=Y&retainAM=Y";
OAHTMLWebBean showWorksapce =
(OAHTMLWebBean) createWebBean(pageContext, HTML_WEB_BEAN, null,
"IFRAME");
showWorksapce.setHTMLAttributeValue("src", final_url);
//pdfBlob
// p_output
showWorksapce.setHTMLAttributeValue("width",
"100%");
showWorksapce.setHTMLAttributeValue("height",
"65%");
pageContext.getPageLayoutBean().addIndexedChild(showWorksapce);
} catch (Exception e) {
pageContext.writeDiagnostics(this,
"Exception ocurred in class swapnil:" + e,
OAFwkConstants.STATEMENT);
}
}
/**
* 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);
}
}
6) Copy the class file
to server and compile using javac
command and create the .class file
Then
navigate to personalization page and enter the custom class file name along
with full path in $JAVA_TOP ( don’t enter the path from root folder) .
As you can see the below page is integrated in OAF inside the iframe
No comments:
Post a Comment