/** * Shows an OK/cancel dialog. The delegate will provide contents and behavior for the OK button * (and if needed, for the cancel one as well) * * @param target * @param delegate */ public void showOkCancel(AjaxRequestTarget target, final DialogDelegate delegate) { // wire up the contents userPanel = delegate.getContents("userPanel"); window.setContent(new ContentsPage(userPanel)); // make sure close == cancel behavior wise window.setCloseButtonCallback( new ModalWindow.CloseButtonCallback() { public boolean onCloseButtonClicked(AjaxRequestTarget target) { return delegate.onCancel(target); } }); window.setWindowClosedCallback( new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { delegate.onClose(target); } }); // show the window this.delegate = delegate; window.show(target); }
public Page createPage() { userPanel = delegate.getContents("userPanel"); return new ContentsPage(userPanel); } });