This blog will cover Oracle ADF, Weblogic, Oracle Application Server, Oracle Collaboration Suite etc....
Tuesday, February 23, 2016
UI Component Reference & PartialTarget
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
UIComponent component = JSFUtils.findComponentInRoot("pgl3");
adfFacesContext.addPartialTarget(component);
UI Refresh based on data in model
You will have to execute iterator
public String cb2_action() {
// Add event code here...
//AdfFacesContext adffacesctx = AdfFacesContext.getCurrentInstance();
//adffacesctx.addPartialTarget(JSFUtils.findComponentInRoot("t1"));
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
bindings.refreshControl();
DCIteratorBinding iterBind= (DCIteratorBinding)bindings.get("TemplateIterator");
iterBind.executeQuery();
iterBind.refresh(DCIteratorBinding.RANGESIZE_UNLIMITED);
return null;
}
Component Reference
One way to get component reference is use JSFUtils
UIComponent component = JSFUtils.findComponentInRoot("contextPopup");
Another way is below
We should not have any Rich component in backing bean because of serialization and memory issues
Sample of popup binding changed to component reference
private ComponentReference conflictReadOnlyPopup;
The getter and setter looks like
public void setConflictReadOnlyPopup(RichPopup conflictReadOnlyPopup) {
this.conflictReadOnlyPopup = ComponentReference.newUIComponentReference(conflictReadOnlyPopup);
}
public RichPopup getConflictReadOnlyPopup() {
RichPopup retVal = null;
if(conflictReadOnlyPopup != null)
retVal = (RichPopup) conflictReadOnlyPopup.getComponent();
return retVal;
}
Now to access any popup property you will have to usig the get method eg.
getConflictReadOnlyPopup().hide();
Af:Iterator Issue
The components inside af:iterator was not getting refreshed on ppr.
The reason was the page parent tag was . It started working after I removed the af:group tag
Tree Binding Programmatically
JUCtrlHierNodeBinding and the class is import oracle.jbo.uicli.binding.JUCtrlHierNodeBinding;
And for list binding it is JUCtrlListBinding
import oracle.jbo.uicli.binding.JUCtrlListBinding;
JUCtrlHierNodeBinding wrappedRow = (JUCtrlHierNodeBinding) tbl.getRowData();
Taskflow return listener
In called taskflow you can have backing bean which does some operation and say it puts some value in pageflowscope in the child taskflow using below code
HashMap map = new HashMap();
map.put("userId", userRow.getAttribute("ApplUserId"));
map.put("userName", fullName);
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("userDetail", map);
Define a simple return activity in child taskflow, nothing special here
Now in parent taskflow’s jspx/jsff page button/event which calls child taskflow add a returnlistener
The method code looks like
public void onTaskFlowReturn(ReturnEvent returnEvent) {
bhcLogger.entering("UserRoleMaintain.class", "onTaskFlowReturn");
HashMap userDetail = (HashMap)returnEvent.getReturnParameters().get("userDetail");
}
Where in the child’s taskflow attributes are captured in returnEvent object.
The region component with id: r1 has detected a page fragment with multiple root components
create only one PageGroupLayout at root level , and keep what ever the components inside that.
Surround the components in pgl they should not be at root level.
Subscribe to:
Posts (Atom)