Hi All, I have a lot of work with ModalWindows in my project and want to use objects which created on the base page and are changed in the modal windows. I found that ModalWindow was changed in wicket 1.5 and want to ask about solution. Please see short example: // Base Page public class MyPage extends WebPage { public MyPage() { final ModalWindow window = new ModalWindow("window"); add(new AjaxLink<Void>("link") { @Override public void onClick(AjaxRequestTarget target) { final CustomObject object = new CustomObject(); window.setPageCreator(new ModalWindow.PageCreator() { @Override public Page createPage() { return new MyModalWindow(object, window); } }); window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { @Override public void onClose(AjaxRequestTarget target) { if (object.isValue()) { // This code is never executed {1} in wicket 1.5. But it worked in wicket 1.4 } } }); } }); } }
// Modal Window public class MyModalWindow extends WebPage { public MyModalWindow(final CustomObject object, final ModalWindow window) { add(new AjaxLink<Void>("link") { @Override public void onClick(AjaxRequestTarget target) { object.setValue(true); window.close(target); } }); } } As I understand - the reason of this behavior is serialization of pages. I also know one solution - use PageReference(same with example here - http://www.wicket-library.com/wicket-examples/ajax/modal-window?0). But I want to ask - is there another solution? Use PageReference is not so flexible. For example I have a lot of modal windows which are opened from the panel. In this case I have to search my panel on the page. Moreover I can use one panel from different pages. Other problem - I don't want to use global variables on the Base Page - I want(ant in several cases I should) use local variables. Can anyone give advice - how to simplify usage of modal windows in such cases? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ModalWindow-and-Serialization-tp4484547p4484547.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org