Opening a new modal window when OK is clicked on currently open modal window

2010-06-03 Thread Chris Colman
Is it possible to replace the currently open Modal window with a
different modal window from within the OK click handler of the currently
open modal window?


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Opening a new modal window when OK is clicked on currently open modal window

2010-06-03 Thread Istvan Jozsa
Yes, by opening the second window *when* the first is closed.
Try something like this:

abstract class Modal1 extends ModalWindow {
   public Modal1(id) {
  // ...
  setWindowClosedCallback(new ModalWindow.CloseButtonCallback() {
 @Override
 public void onClose(AjaxRequestTarget target) {
Modal1.this.onClose(target);
 }
  });
   }
   protected abstract void onClose(AjaxRequestTarget target);
   public Modal1 showMe(target) {
  // ...
  super.show();
  return this;
   }
}

// somewhere in the page:
ModalWindow modal1, modal2;
// ...
add(modal1 = new Modal1(w1) {
   @Override
   void onClose(AjaxRequestTarget target) {
 modal2.show(target);
   }
});
add(modal2 = new Modal2(w2));
// ...
modal1.showMe(target);

The more flexible solution is by
setting the close callback *when* the window is shown:

modal1.showMe(target).setWindowClosedCallback(new
ModalWindow.CloseButtonCallback() {
   @Override
   public void onClose(AjaxRequestTarget target) {
   modal2.show(target);
   }
});


On Thu, Jun 3, 2010 at 3:48 PM, Chris Colman
chr...@stepaheadsoftware.comwrote:

 Is it possible to replace the currently open Modal window with a
 different modal window from within the OK click handler of the currently
 open modal window?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org