/** * Validates the layout and returns a collection of errors. * * @since 7.1 * @param ui * The UI to validate * @return A collection of errors. An empty collection if there are no * errors. */ public static List<InvalidLayout> validateLayouts(UI ui) { List<InvalidLayout> invalidRelativeSizes = ComponentSizeValidator .validateComponentRelativeSizes(ui.getContent(), new ArrayList<>(), null); // Also check any existing subwindows if (ui.getWindows() != null) { for (Window subWindow : ui.getWindows()) { invalidRelativeSizes = ComponentSizeValidator .validateComponentRelativeSizes(subWindow.getContent(), invalidRelativeSizes, null); } } return invalidRelativeSizes; }
/** * If there are currently several windows visible, calling this method makes * this window topmost. * <p> * This method can only be called if this window connected a UI. Else an * illegal state exception is thrown. Also if there are modal windows and * this window is not modal, and illegal state exception is thrown. * <p> */ public void bringToFront() { UI uI = getUI(); if (uI == null) { throw new IllegalStateException( "Window must be attached to parent before calling bringToFront method."); } int maxBringToFront = -1; for (Window w : uI.getWindows()) { if (!isModal() && w.isModal()) { throw new IllegalStateException( "The UI contains modal windows, non-modal window cannot be brought to front."); } if (w.bringToFront != null) { maxBringToFront = Math.max(maxBringToFront, w.bringToFront.intValue()); } } bringToFront = Integer.valueOf(maxBringToFront + 1); markAsDirty(); }
private boolean isWindowNotAlreadyAttached() { return !UI.getCurrent().getWindows().contains(this); }
private boolean isWindowNotAlreadyAttached() { return !UI.getCurrent().getWindows().contains(this); }
protected boolean hasModalWindow() { UI ui = getComponent().getUI(); return ui.getWindows().stream() .anyMatch(com.vaadin.ui.Window::isModal); }
/** * Open the dialog Window using given <code>ui</code>. Any Window which <code>equals</code> to <code>window</code> * is removed from UI before adding the new Window. * @param ui UI to which to attach the dialog window */ protected void openDialogWindow(UI ui) { if (ui == null) { throw new IllegalStateException("No UI available to open Dialog Window"); } List<Window> toRemove = new LinkedList<>(); for (Window wnd : ui.getWindows()) { if (this.equals(wnd)) { toRemove.add(wnd); } } for (Window wnd : toRemove) { ui.removeWindow(wnd); } ui.addWindow(this); }
/** * Open a Window using given <code>ui</code>. Any Window which <code>equals</code> to <code>window</code> is removed * from UI before adding the new Window. * @param window Window to open */ private static void openWindow(UI ui, Window window) { List<Window> toRemove = new LinkedList<>(); for (Window wnd : ui.getWindows()) { if (window.equals(wnd)) { toRemove.add(wnd); } } for (Window wnd : toRemove) { ui.removeWindow(wnd); } ui.addWindow(window); }
/** * Open the dialog Window using given <code>ui</code>. Any Window which <code>equals</code> to <code>window</code> * is removed from UI before adding the new Window. * @param ui UI to which to attach the dialog window */ protected void openDialogWindow(UI ui) { if (ui == null) { throw new IllegalStateException("No UI available to open Dialog Window"); } List<Window> toRemove = new LinkedList<>(); for (Window wnd : ui.getWindows()) { if (this.equals(wnd)) { toRemove.add(wnd); } } for (Window wnd : toRemove) { ui.removeWindow(wnd); } ui.addWindow(this); }
private void onWindowExit() { if (!getUI().getWindows().isEmpty()) {