You should not use PopupId directly, create binding for your popup in your newBean Class and use this binding and method getClientId();
for instance, change the newBean and add the following inside of the top of the class
private RichPopup myPopup=new RichPopup();
public RichPopup getMyPopup(){ return this.myPopup; }
public void setMyPopup(RichPopup myPopup) { this.myPopup = myPopup; }
Then change the code inside openPopup function so that:
erkService.addScript(FacesContext.getCurrentInstance(),
"var hints = {autodismissNever:true}; " +
"AdfPage.PAGE.findComponent('" + popupId +
"').show(hints);");
System.out.println("POPUP INNNNN");
get replaced by
myPopup.show(hints);
System.out.println("POPUP INNNNN");
Don't forget to bind your popup inside the jsff like the following:
<af:popup childCreation="deferred" autoCancel="disabled" id="p1" contentDelivery="lazyUncached" bindings="#{pageFlowScope.newBean.myPopup}">