title: Wicket setting window close callback not possible everywhere?
body: <p>I have a modal window with form inside it. There are two way user can close the window: either by filling up correctly form and submit change, or clicking an "x" in top right corner.</p>
  
  <p>Now I'm trying to do following thing:</p>
  
  <p>When user sucesfully fills up the form and submit change, on parent page I'm trying to display (with jQuery) some information about success.</p>
  
  <p>When user clicks an "x" I want the modal window to be closed without any additional info. However <strong>setWindowClosedCallback</strong> is not working as I expected. Take a look at my code, first I'm getting reference to modalWindow (I omitted some not interesting parts of the code like adding form inputs etc.):</p>
  
  <pre><code>public EditEmailForm( String id, final ModalWindow modalWindow,final User u )
  {
      super( id );
      modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() 
      {
      private static final long serialVersionUID = 1L;
  
      @Override
      public void onClose(AjaxRequestTarget target) 
      {
              //here some code doing jQuery magic for parent page
      }
  });
      AjaxSubmitLink closeBtn = new AjaxCloseCancelBtn( "close-x", this );
  
      add( new AjaxSubmitLink( "save", this )
      {
          private static final long serialVersionUID = 1L;
  
          @Override
          protected void onSubmit( AjaxRequestTarget target, Form&lt;?&gt; form )
          {
          //here's user info change
          }
  
          @Override
          protected void onError( AjaxRequestTarget target, Form&lt;?&gt; form )
          {
              target.add( feedbackPanel );
          }
      } );
      add( closeBtn );
  }
  
  
  protected class AjaxCloseCancelBtn extends AjaxSubmitLink
  {
      private static final long serialVersionUID = 1L;
  
      public AjaxCloseCancelBtn( String id, Form&lt;?&gt; form )
      {
          super( id, form );
          setDefaultFormProcessing( false );
      }
  
      @Override
      protected void onSubmit( AjaxRequestTarget target, Form&lt;?&gt; form )
      {
          modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() 
          {
              private static final long serialVersionUID = 1L;
  
              @Override
              public void onClose( AjaxRequestTarget arg0 )
              {               
              }
  
          });
          // revert fields values
          form.clearInput();
          // close popup
          modalWindow.close( target );
      }
  
      @Override
      protected void onError( AjaxRequestTarget target, Form&lt;?&gt; form )
      {
      }
  
  }
  </code></pre>
  
  <p>This code works 50% good, as it displays what I want on parent page, but it also does it when I hit an "x" even tho I'm trying to set new window close callback which is empty. Any solution how can I overcome this?</p>