2010年4月26日星期一

ADF_085:Task Flow使用指南之四:获取Task Flow返回值(1)

开发环境:JDevloper 11.1.2.2.0+ Oracle Database 10g Express Edition 10.2.0.1。

本实验在《Task Flow使用指南之三:以Dialog方式显示Task Flow》基础之上,获取Task Flow返回值。

1. 选中TaskFlow Call Activity,设置Return参数


2. 双击TaskFlow Call Activity,打开TaskFlow定义,在空白点击一下,设置Return参数



3. 修改departmentList页面中调用TaskFlow的按钮代码,增加returnListener
(1)页面代码

<af:commandButton text="To Employees" id="cb1" action="toEmployees" useWindow="true"
windowEmbedStyle="inlineDocument" windowWidth="600" windowHeight="320"
returnListener="#{myBackingBean.employeesTaskFlow2ReturnListener}">
<af:setPropertyListener from="#{bindings.DepartmentId}" to="#{pageFlowScope.deptId}" type="action"/>
</af:commandButton>

(2)Managed Bean代码

public void employeesTaskFlow2ReturnListener(ReturnEvent returnEvent) {
System.out.println("$$$$$$$$$$$$$$$$$ return Value: " + returnEvent.getReturnValue());
Map params = returnEvent.getReturnParameters();
//System.out.println("$$$$$$$$$$$$$$$$$ return Value: empId " + params.get("empId"));
for (Map.Entry entry : params.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
System.out.println("$$$$$$$$$$$$$$$$$ return Values: " + key.toString() + " : " + value.toString());
}
}


4. 修改employeeList页面中返回按钮的代码,增加setPropertyListener

<af:commandButton text="to Return" id="cb1" action="toReturn">
<af:setPropertyListener from="#{bindings.EmployeeId.inputValue}" to="#{pageFlowScope.empId}" type="action"/>
</af:commandButton>


5. 运行

Console日志中会输出:
$$$$$$$$$$$$$$$$$ return Value: null
$$$$$$$$$$$$$$$$$ return Values: empId : 136

Project 下载:ADF_TaskFlow_PageToTaskFlow(InlinePopupReturnValue).7z

没有评论: