/** * Sets whether window closure is permitted using a simple Boolean value. This is a shortcut for * calling {@link #setOnCanClose} with a functional interface that returns a fixed Boolean * value. * * @param canClose If true, the tab may be closed. */ public void setOnCanClose(boolean canClose) { setOnCanClose(() -> canClose); }
@Override public void afterInitialized(BaseComponent comp) { this.root = (Window) comp; root.setAttribute("controller", this); control = (DialogControl<?>) root.getAttribute("control"); root.setTitle(control.getTitle()); icon.addClass(control.getIconClass()); message.addClass(control.getTextClass()); message.setLabel(control.getMessage()); root.addClass(control.getPanelClass()); chkRemember.setVisible(root.hasAttribute("remember")); root.setOnCanClose(() -> { control.callback(response); return true; }); if (control.getFormat() == ChoiceFormat.BUTTONS) { processButtonResponses(); } else { processListResponses(); } }
window.setOnCanClose(() -> { if (favoritesChanged) { PropertyUtil.saveValues(DesignConstants.DESIGN_FAVORITES_PROPERTY, null, false, favorites);