OAF―深入View之Action and Navigation Buttons

OAF学习笔记-深入ViewAction and Navigation Buttons

 

Action/Navigation Buttons的作用:

  1. 在本页面内执行动作.
  2. 导航到另一个页面.
  3. 执行动作并导航到另一个页面.

Action/Navigation Buttons的位置:

  1. 单一Text field, Poplist.
  2. 多个Item组成的组
  3. 表格
  4. 整个页面

 

Action Buttons

当点击按钮时执行Page Post动作

 

Create a button(动态生成按钮)

import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;

import oracle.apps.fnd.framework.webui.OAWebBeanConstants;

OASubmitButtonBean aa = (OASubmitButtonBean)pageContext.getWebBeanFactory().createWebBean(pageContext,OAWebBeanConstants. BUTTON_SUBMIT_BEAN); //实例化

 aa.setID("Go"); //定义ID

 aa.setUINodeName("xxSubmitButton"); //定义UINodename

 aa.setEvent("Go"); //定义事件名称

 aa.setText("Go"); //定义Prompt

 webBean.addIndexedChild(aa); //在页面上显示

注解:此为动态生成item的通用例程,其中的setUINodeName可省略,OAF会自动分配,最后一句是指定按钮在哪个Region中生成,这里是整个页面,如果有具体的Region的话,应用下面的方法生成:

 

假设需要在一个TableLayoutRegion中生成一个按钮:

 

import oracle.apps.fnd.framework.webui.beans.layout.OATableLayoutBean;

OATableLayoutBean cont =(OATableLayoutBean)webBean.findIndexedChildRecursive("RepeatRN"); //实例化Region

OASubmitButtonBean aa = (OASubmitButtonBean)pageContext.getWebBeanFactory().createWebBean(pageContext,OAWebBeanConstants.BUTTON_SUBMIT_BEAN); //实例化按钮

 aa.setID("Go");

 aa.setUINodeName("xxSubmitButton");

 aa.setEvent("Go");

 aa.setText("abcd");

 cont.addIndexedChild(aa); //注意,用上面实例化的webbean对象的方法在页面上显示按钮

 

Control visual property (动态设置属性)

在运行时刻,只有一个属性可能需要更改,即为按钮的Prompt.可调用setText来实现(首先实例化按钮)

 

Control Behavior. and Data(行为和数据控制)

可用性:setDisabled(Boolean) 设置按钮不可用

校验:setUnvalidated(Boolean)按钮点击后不触发onSubmit validationClient

           setServerUnvalidated(Boolean) 按钮点击后不触发onSubmit validationServer

 

Handle Button Press Events (获取按钮事件)

两种方式:

利用Page Post动作来获取

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

{

 ... // Check to see if a submit button named "Go" has been pressed.

 if (pageContext.getParameter("Go") != null)

 {

 

 ...

 

利用FireAction来获取

首先定义按钮的FireActionEvent名称,然后再processFormRequest中获取该事件

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

 {

   super.processFormRequest(pageContext, webBean);

   if (pageContext.getParameter(EVENT_PARAM).equals("Go"))

   {

     pageContext.getApplicationModule(webBean).invokeMethod("updatedata");

     

   }

 }

你可能感兴趣的:(职场,view,休闲,oaf)