// If the modal window is on then show it:
// - The AJAX response varies depending whether the modal window is rendered for the first time or it's a response inside the modal window.
// - If the request is being executed within a panel the pass such panel to the response.
if (modalOn) {
Panel panel = getCurrentPanel(request);
if (modalSwitchedOn) setResponse(new ShowBeanAjaxResponse(modalDialog, panel));
else setResponse(new ShowBeanAjaxResponse(modalDialog.getCurrentComponent(), panel));
}
return true;
}