How to tell when data has reached the client.
NRage2Nov 21 2012 — edited Nov 22 2012Build JDEVADF_11.1.2.3.0_GENERIC_120914.0223.6276.1
I'm having some trouble timing activities between the server and a client in my ADF application. The problem begins with the need to use an embedded Silverlight application within my ADF client to edit a specialized document. This part is working well. The problem arises with the timing of data to be sent to the client and the displaying of the Silverlight component.
I've placed the Silverlight component in an iframe, which I make visible when needed and hiden when not. I send the document down to the client via a hidden bound InputText field, which is then read and passed to Silverlight.
Now here's the real problem:
If I update the hidden InputText like this:
...
PushDoc2Client(doc); // updates bound InputText "rdoc"
RunAtClient("ShowSilverlight();"); // javascript to show iframe
...
public void PushDoc2Client(Long docid)
{
DCIteratorBinding dc = (DCIteratorBinding)evaluateEL("#{bindings.DocsView1Iterator}");
ViewObject vo = dc.getViewObject();
vo.applyViewCriteria(vo.getViewCriteriaManager().getViewCriteria("GetDoc"));
vo.ensureVariableManager().setVariableValue("docid", docid);
vo.executeQuery();
}
protected void RunAtClient(String script)
{
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks = null;
erks =org.apache.myfaces.trinidad.util.Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
erks.addScript(fctx, script);
}
I then create a race condition. Since RenderKitService.addScript sends to the client immediately and is not queued behind the binding update, the iframe/Silverlight component is shown before it has the new document data at the client. Because of this the application cannot present the correct document.
The question: Is there a way to identify when the data bound UI object has actually received its data? This way I can show the document ONLY after the client has been updated? (serialize the process)
If anyone can help out or has a better approach, the help would be greatly appreciated.
Thanks,
NRage
Edited by: NRage2 on Nov 21, 2012 11:18 PM