Adf : when execute refresh programmatically not running properly
I create a database view with a select of 2 tables. I create an adf search with table view on this database view.when i click on an edit button i display in a form one row of one of the the table used in the select of the view database passing the key value of this row as parameter.All this is in a bounded task flow.When click on cancel(rollback) or save(commit) i close the form and return back to search with table view(All this are jsff page).The bounded taskflow was drragged and dropped on a main jfs page.Click save on the form (when updated) do close it to open the search table page.When the search table page is loaded i add java code to refresh the page (based on the database view).The first time the page did not get refresh.When i click on the edit button to go to the form again and click save again(without any update) to return back to table view this time the page show up the update.Can you help in for this delay,why the update is not done at first time. See the code below.Just one more thing i add a field to display data when the page is loaded.
test.jsff:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:outputText value="#{pageFlowScope.InitializationText}" id="ot1"/>.
</jsp:root>
testPageDef.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="11.1.2.60.17" id="testPagedef"
Package="adf.testcode.view.pageDefs"
ControllerClass="adf.testcode.view.beans.ReInit">
<parameters/>
<executables>
<variableIterator id="variables"/>
</executables>
<bindings/>
</pageDefinition>
ReInit.java:
package adf.testcode.view.beans;
import oracle.adf.model.BindingContext;
import oracle.adf.model.RegionBinding;
import oracle.adf.model.RegionContext;
import oracle.adf.model.RegionController;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.binding.BindingContainer;
import oracle.jbo.Key;
public class SampleViewBean implements RegionController {
public SampleViewBean() {
super();
}
@Override
public boolean refreshRegion(RegionContext regionContext) {
int refreshFlag = regionContext.getRefreshFlag();
if (refreshFlag == RegionBinding.PREPARE_MODEL) {
// Invoke Initialization method
System.out.println(":::: Initialization Method Invoked");
this.initializeMethod();
}
regionContext.getRegionBinding().refresh(refreshFlag);
return false;
}
@Override
public boolean validateRegion(RegionContext regionContext) {
regionContext.getRegionBinding().validate();
return false;
}
@Override
public boolean isRegionViewable(RegionContext regionContext) {
return false;
}
@Override
public String getName() {
return null;
}
public void initializeMethod() {
//======================//
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.getPageFlowScope().put("InitializationText",
"Initialization Text set during on load of page fragement ");
System.out.println("Program now start.");
//====================//
BindingContext cctx=BindingContext.getCurrent();
BindingContainer binding = cctx.getCurrentBindingsEntry();
DCIteratorBinding bciter = (DCIteratorBinding)binding.get("v_test_VO1Iterator");
Key currentRowkey=bciter.getCurrentRow().getKey();
System.out.println("Program now end1."+ currentRowkey);
bciter.executeQuery();
bciter.setCurrentRowWithKey(currentRowkey.toStringFormat(true));
System.out.println("Program now end2."+ currentRowkey);
}
}