/** * Makes this window as a modal dialog. It will automatically center the window (ignoring {@link * #getLeft} and {@link #getTop}). * * <p>Notice: though both setMode("modal") and doModal() both causes the window to become modal, * they are a bit different. doModal causes the event listener to suspend immediately, while * setMode("modal") posts an event ({@link Events#ON_MODAL}). That is, {@link #setMode} won't * suspend the execution immediately, but {@link #doModal} will. {@link #doModal} can be called * only in an event listener, while {@link #setMode} can be called anytime. * * @exception SuspendNotAllowedException if 1) not in an event listener;<br> * 2) the event thread is disabled.<br> * 3) there are too many suspended processing thread than the deployer allows. By default, * there is no limit of # of suspended threads. * @exception InterruptedException thrown if the desktop or the Web application is being * destroyed, or {@link org.zkoss.zk.ui.sys.DesktopCtrl#ceaseSuspendedThread}. To tell the * difference, check the getMessage method of InterruptedException. * @since 3.0.4 */ public void doModal() throws InterruptedException, SuspendNotAllowedException { if (!isEventThreadEnabled(true)) { checkOverlappable(_MODAL_); setNonModalMode(_MODAL_); return; } checkOverlappable(MODAL); if (_mode != MODAL) { if (!Events.inEventListener()) throw new SuspendNotAllowedException("doModal must be called in an event listener"); int oldmode = _mode; boolean oldvisi = isVisible(); setVisible(true); // if MODAL, it must be visible; vice versa try { enterModal(); } catch (SuspendNotAllowedException ex) { handleFailedModal(oldmode, oldvisi); throw ex; } } }
/** * Makes this window as highlited. The visual effect is the similar to the modal window, but, like * overlapped, it doesn't suspend (block) the execution at the server. In other words, it is more * like an overlapped window from the server side's viewpoint. */ public void doHighlighted() { checkOverlappable(HIGHLIGHTED); setNonModalMode(HIGHLIGHTED); }
/** * Makes this window as popup, which is overlapped with other component and auto-hiden when user * clicks outside of the window. */ public void doPopup() { checkOverlappable(POPUP); setNonModalMode(POPUP); }
/** Makes this window as overlapped with other components. */ public void doOverlapped() { checkOverlappable(OVERLAPPED); setNonModalMode(OVERLAPPED); }