Search in sources :

Example 1 with StandardCloseAction

use of com.haulmont.cuba.gui.screen.StandardCloseAction in project cuba by cuba-platform.

the class WebDialogWindow method onCloseShortcutTriggered.

protected void onCloseShortcutTriggered(@SuppressWarnings("unused") Object sender, @SuppressWarnings("unused") Object target) {
    if (this.isCloseable()) {
        com.vaadin.ui.Component component = getComponent();
        CubaUI ui = (CubaUI) component.getUI();
        if (!ui.isAccessibleForUser(component)) {
            LoggerFactory.getLogger(WebWindow.class).debug("Ignore shortcut action because Window is inaccessible for user");
            return;
        }
        BeforeCloseEvent event = new BeforeCloseEvent(this, CloseOriginType.SHORTCUT);
        fireBeforeClose(event);
        if (!event.isClosePrevented()) {
            getFrameOwner().close(new StandardCloseAction(Window.CLOSE_ACTION_ID));
        }
    }
}
Also used : StandardCloseAction(com.haulmont.cuba.gui.screen.StandardCloseAction) CubaUI(com.haulmont.cuba.web.widgets.CubaUI) Component(com.vaadin.ui.Component) WebWindow(com.haulmont.cuba.web.gui.WebWindow)

Example 2 with StandardCloseAction

use of com.haulmont.cuba.gui.screen.StandardCloseAction in project cuba by cuba-platform.

the class WebDialogWindow method onCloseButtonClick.

protected void onCloseButtonClick(CubaWindow.PreCloseEvent preCloseEvent) {
    preCloseEvent.setPreventClose(true);
    com.vaadin.ui.Component component = getComponent();
    CubaUI ui = (CubaUI) component.getUI();
    if (!ui.isAccessibleForUser(component)) {
        LoggerFactory.getLogger(WebWindow.class).debug("Ignore close button click because Window is inaccessible for user");
        return;
    }
    BeforeCloseEvent event = new BeforeCloseEvent(this, CloseOriginType.CLOSE_BUTTON);
    fireBeforeClose(event);
    if (!event.isClosePrevented()) {
        // user has clicked on X
        getFrameOwner().close(new StandardCloseAction(Window.CLOSE_ACTION_ID));
    }
}
Also used : StandardCloseAction(com.haulmont.cuba.gui.screen.StandardCloseAction) CubaUI(com.haulmont.cuba.web.widgets.CubaUI) Component(com.vaadin.ui.Component) WebWindow(com.haulmont.cuba.web.gui.WebWindow)

Aggregations

StandardCloseAction (com.haulmont.cuba.gui.screen.StandardCloseAction)2 WebWindow (com.haulmont.cuba.web.gui.WebWindow)2 CubaUI (com.haulmont.cuba.web.widgets.CubaUI)2 Component (com.vaadin.ui.Component)2