APPROACH-1
public String showPopup() {
showPopup(p1, null); //p1 - Is the popup Id
return null;
}
public static void showPopup(RichPopup popup, UIComponent component) {
FacesContext context = FacesContext.getCurrentInstance();
String alignId = (component==null) ? null : component.getClientId(context);
StringBuilder script = new StringBuilder();
script.append("var popup = AdfPage.PAGE.findComponent('").append("p1").append("'); ")
.append("if (!popup.isPopupVisible()) { ")
.append("var hints = {}; ");
if (alignId!=null) {
script.append("hints[AdfRichPopup.HINT_ALIGN_ID] = '").append(alignId).append("'; ")
.append("hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START; ");
}
script.append("popup.show(hints);}");
ExtendedRenderKitService erks =
Service.getService(context.getRenderKit(), ExtendedRenderKitService.class);
erks.addScript(context, script.toString());
}
**************************************************************
APPROACH-2
af:popup id="p1" binding="#{managedbean.bindp1}"
public void showPopup(){
ExtendedRenderKitService erkService =Service.getService(fctx.getRenderKit(),ExtendedRenderKitService.class);
erkService.addScript(fctx,"AdfPage.PAGE.findComponent('" + bindp1 + "').show();");
}
public void hidePopup(){
ExtendedRenderKitService erkService =Service.getService(fctx.getRenderKit(),ExtendedRenderKitService.class);
erkService.addScript(fctx,"AdfPage.PAGE.findComponent('" + bindp1 + "').show();");
}
**************************************************************
APPROACH-3
public static void showPopup(String popupId) {
RichPopup popup = (RichPopup) JSFUtils.findComponentInRoot(popupId);
popup.show(new RichPopup.PopupHints());
}
ExtendedRenderKitService erkService =Service.getService(fctx.getRenderKit(),ExtendedRenderKitService.class);
erkService.addScript(fctx,"AdfPage.PAGE.findComponent('" + bindp1 + "').show();");
}
public void hidePopup(){
ExtendedRenderKitService erkService =Service.getService(fctx.getRenderKit(),ExtendedRenderKitService.class);
erkService.addScript(fctx,"AdfPage.PAGE.findComponent('" + bindp1 + "').show();");
}
**************************************************************
APPROACH-3
public static void showPopup(String popupId) {
RichPopup popup = (RichPopup) JSFUtils.findComponentInRoot(popupId);
popup.show(new RichPopup.PopupHints());
}