So here's the thing. I have a popup that has a button, the button itself has a fileDownloadActionListener, this one is responsible for downloading an excel file. So what I need basically is to hide the popup right after I generate the file.
Here's my .jspx file (Just the popup)
    <af:popup childCreation="deferred" autoCancel="enabled"
              id="myPopUp"
              contentDelivery="lazyUncached"
              binding="#{viewScope.mbMyBean.myPopUp}"
              partialTriggers="b17">
        <af:dialog id="d16" type="cancel"
                   title="Do you wish to download a file?"
                   inlineStyle="width:400px;">
            <af:panelGroupLayout id="pgl32"
                                 inlineStyle="max-width: 200px;">
            <af:outputText value="You're about to download a file. Ready?" id="ot45"
                               />
            </af:panelGroupLayout>
            <f:facet name="buttonBar">
                <af:button text="GO" id="b17"
                    <af:fileDownloadActionListener contentType="excelHTML"
                                                   filename="#{viewScope.mbMyBean.FileName}"
                                                   method="#{viewScope.mbMyBean.GenerateEmptyExcel}"
                                                   />
                </af:button>
            </f:facet>
        </af:dialog>
    </af:popup>
And here's the java method:
public void GenerateEmptyExcel(FacesContext facesContext, OutputStream outputStream) {
    try {
        HSSFWorkbook wb1 = generateEmptyExcelFile();
        wb1.write(outputStream);
        outputStream.flush();
        outputStream.close();
        this.myPopUp.hide();
        AdfFacesContext.getCurrentInstance().addPartialTarget(this.myPopUp);
        System.gc();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
PROBLEM
The popup won't hide.
NOTES
- The popup is properly binded within the bean
- I do not own this code and I'm doing a maintainance.
- I do not know why the programmer used System.gc() since I consider it as a bad practice. Here's a good reason
 
     
     
    