1) To show popup on page load: To show popup on page load simply assign clientlistener operation to document element. Chose type as 'load' and create a javascript method as follows:
function ShowPopupOnPageLoad()
{
var popup= AdfPage.PAGE.findComponentByAbsoluteId('p1');
popup.show();
}
2) Call JavaScript from Java: We can use our backing bean to call java script as follows:
StringBuilder script=new StringBuilder();
script.append("var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');");
script.append("if(popup != null) {");
script.append("popup.show();");
script.append("}");
3) Show Popup When Application is Busy: To show a popup when application is busy and prevent input from user in that time we can use following java script functions. In this, a callback method is called when application start getting busy. preventUserInput shows a glass pane to prevent user from interacting with UI. It gets removed automatically when application busy state changes. Also change the content Delivery option of the popup to Immediate.
function ListenEvent(evt)
{
var popup= AdfPage.PAGE.findComponentByAbsoluteId('p2');
if(popup != null)
{
AdfPage.PAGE.addBusyStateListener(popup,handleBusyState);
evt.preventUserInput();
}
}
function handleBusyState(evt)
{
var popup= AdfPage.PAGE.findComponentByAbsoluteId('p2');
if(popup != null)
{
if(evt.isBusy())
popup.show();
}
else
{
popup.hide();
AdfPage.PAGE.removeBusyStateListener(popup,handleBusyState);
}
}
function ShowPopupOnPageLoad()
{
var popup= AdfPage.PAGE.findComponentByAbsoluteId('p1');
popup.show();
}
2) Call JavaScript from Java: We can use our backing bean to call java script as follows:
StringBuilder script=new StringBuilder();
script.append("var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');");
script.append("if(popup != null) {");
script.append("popup.show();");
script.append("}");
FacesContext fctx=FacesContext.getCurrentInstance();
ExtendedRenderKitService erks= Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
erks.addScript(fctx, script);
3) Show Popup When Application is Busy: To show a popup when application is busy and prevent input from user in that time we can use following java script functions. In this, a callback method is called when application start getting busy. preventUserInput shows a glass pane to prevent user from interacting with UI. It gets removed automatically when application busy state changes. Also change the content Delivery option of the popup to Immediate.
function ListenEvent(evt)
{
var popup= AdfPage.PAGE.findComponentByAbsoluteId('p2');
if(popup != null)
{
AdfPage.PAGE.addBusyStateListener(popup,handleBusyState);
evt.preventUserInput();
}
}
function handleBusyState(evt)
{
var popup= AdfPage.PAGE.findComponentByAbsoluteId('p2');
if(popup != null)
{
if(evt.isBusy())
popup.show();
}
else
{
popup.hide();
AdfPage.PAGE.removeBusyStateListener(popup,handleBusyState);
}
}