title: Primefaces Dialog not reopening when ajax close event listener included
body: <p>I would like to programmatically control when a dialog is showed and hidden. It's works except when the dialog is closed using 'X' and and ajax close event listener is added.
  For example in the code below close dialog using 'X' and show/reopen many times using the button if I comment out the ajax line.</p>
  
  <p>BTW: I have seen the javascript option which is tricked using oncomplete method call.</p>
  
  <pre><code>&lt;h:form&gt;
  Status: &lt;h:outputText id="status" value="#{helloBean.visible}" /&gt;
  &lt;p /&gt;
  
  &lt;p:dialog id="myDialog" header="Header Text" widgetVar="dlg" visible="#{helloBean.visible}"&gt;
  &lt;p:ajax event="close" listener="#{helloBean.hide}" update="myDialog" /&gt;
  
  &lt;h1&gt;Dialog content ....&lt;/h1&gt;
  
    &lt;p:commandButton value="Hide" actionListener="#{helloBean.hide}" update="myDialog status" /&gt;
  &lt;/p:dialog&gt;
  
  &lt;p:commandButton value="Show" actionListener="#{helloBean.show}" update="myDialog status" /&gt;            
  &lt;/h:form&gt;
  
  
  @ManagedBean
  @ViewScoped
  public class HelloBean implements Serializable {
  
  private static final long serialVersionUID = 1L;
  private boolean visible;
  
  public boolean isVisible() {
    return visible;
  }
  
  public void setVisible(boolean visible) {
    this.visible = visible;
  }
  
  public void show() {
    setVisible(true);
    System.err.println("show(): " + visible);
  }
  public void hide() {
    setVisible(false);
    System.err.println("hide(): " + visible);
  }
  }
  </code></pre>
  
  <p>Primefaces 3.5, 
  JSF 2.0.7, 
  Tomcat 7</p>