在ADF中使用InlinePopup

 

概述 
    在JDeveloper 11g 11.1.1.2.0版本发布后,添加了许多新的特性。在Oracle ADF中出现了Inline Popup的功能,这样就可以实现在一个Popup中嵌入task-flow。 
实现 
1、基于HR Schema中的Departments与Locations表创建Entity Object(Departments,Locations),View Object(DepartmentsView,LocationsView),创建AM并添加DepartmentsView与LocationsView的实例到该AM的Data Model中。 
2、创建新页面,名为main.jspx 
3、创建Bounded-Task-Flow With Page Fragments,名为departments-taskflow,添加jsff页面到该Task Flow中,命名为Department.jsff,添加Task Flow Call到该Page Flow,命名为locations-taskflow作为Departments.jsff中弹出的Popup,最后再添加Control Flow Rule,由Departments.jsff指向locations-tasfflow,命名为goPopup

 

4、如图修改locations-taskflow的属性

5、双击Department.jsff,通过向导创建其对应的jsff页面,从Data Controls面板中拖动对应的DepartmentsView的实例到该页面,进行适当布局。完成后新增Command Button到页面,稍后将使用该Button触发Popup弹出的action,如图设置该Command Button的属性,设置该按钮触发inline popup事件,并设置返回值到LocationId变量

6、设置新增的CommandButton的Text为“Choose LocationId”,设置Action为goPopup,并合理调整弹出窗口的大小等属性

7、双击locations-taskflow,使用向导创建该task-flow,选择bounded-task-flow,不使用fragments,如图设计该task flow

 

8、由于前面制定了返回值,现需为locations-taskflow添加Return Parameter

9、在页面的绑定中添加LocationId,以便后面从此住取值

10、为Locations页面进行布局,将LocationsView以Table的形式进行展现,拖动OK与Cancel按钮到页面,分别设置两个按钮的Action为goReturn

11、在OK按钮中添加setPropertyListener,如图设置其Property值的Mapping关系

12、在Choose LocationId按钮的属性中添加ReturnListener,名为confirmChoice(),其代码如下(取得返回值LocationId到页面的对应绑定):

public void confirmChoice(ReturnEvent returnEvent) { BindingContext bindingContext = BindingContext.getCurrent(); BindingContainer bindings = bindingContext.getCurrentBindingsEntry(); ControlBinding control = bindings.getControlBinding("LocationId"); AttributeBinding locationId = (AttributeBinding)control; locationId.setInputValue(returnEvent.getReturnValue()); } 

13、添加页面的LocationId Inputtext的partialTrigger为该按钮,在触发按钮Action的同时刷新该值

14、将departments-taskflow以region的形式嵌入到main.jspx页面中

15、保存应用,运行该应用

1)点击Departments页面中的按钮,弹出inlinepopup

2)选择记录,点击OK返回结果

本文转自Oracle Seeker:http://oracleseeker.com/2009/12/30/adf_dialog_inlinepopup_11g/

 

 

你可能感兴趣的:(oracle,object,command,dialog,action,button)