Search in sources :

Example 21 with WebWindowManager

use of com.haulmont.cuba.web.WebWindowManager in project cuba by cuba-platform.

the class DefaultExceptionHandler method showNotification.

protected void showNotification(App app, Throwable exception) {
    Throwable rootCause = ExceptionUtils.getRootCause(exception);
    if (rootCause == null) {
        rootCause = exception;
    }
    WebWindowManager windowManager = app.getWindowManager();
    if (windowManager != null) {
        windowManager.showNotification(messages.getMainMessage("exceptionDialog.caption", app.getLocale()), rootCause.getClass().getSimpleName() + (rootCause.getMessage() != null ? "\n" + rootCause.getMessage() : ""), Frame.NotificationType.ERROR);
    }
}
Also used : WebWindowManager(com.haulmont.cuba.web.WebWindowManager)

Example 22 with WebWindowManager

use of com.haulmont.cuba.web.WebWindowManager in project cuba by cuba-platform.

the class ExceptionDialog method logoutPrompt.

protected void logoutPrompt() {
    App app = AppUI.getCurrent().getApp();
    final WebWindowManager wm = app.getWindowManager();
    wm.showOptionDialog(messages.getMainMessage("exceptionDialog.logoutCaption"), messages.getMainMessage("exceptionDialog.logoutMessage"), Frame.MessageType.WARNING, new Action[] { new AbstractAction(messages.getMainMessage("closeApplication")) {

        @Override
        public void actionPerform(com.haulmont.cuba.gui.components.Component component) {
            forceLogout();
        }

        @Override
        public String getIcon() {
            return "icons/ok.png";
        }
    }, new DialogAction(Type.CANCEL, Status.PRIMARY) });
}
Also used : App(com.haulmont.cuba.web.App) com.haulmont.cuba.gui.components(com.haulmont.cuba.gui.components) WebWindowManager(com.haulmont.cuba.web.WebWindowManager)

Example 23 with WebWindowManager

use of com.haulmont.cuba.web.WebWindowManager in project cuba by cuba-platform.

the class ExceptionDialog method forceLogout.

protected void forceLogout() {
    App app = AppUI.getCurrent().getApp();
    final WebWindowManager wm = app.getWindowManager();
    try {
        Connection connection = wm.getApp().getConnection();
        if (connection.isConnected()) {
            connection.logout();
        }
    } catch (Exception e) {
        log.warn("Exception on forced logout", e);
    } finally {
        // always restart UI
        String url = ControllerUtils.getLocationWithoutParams() + "?restartApp";
        Page.getCurrent().open(url, "_self");
    }
}
Also used : App(com.haulmont.cuba.web.App) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) Connection(com.haulmont.cuba.web.Connection) GuiDevelopmentException(com.haulmont.cuba.gui.GuiDevelopmentException)

Example 24 with WebWindowManager

use of com.haulmont.cuba.web.WebWindowManager in project cuba by cuba-platform.

the class WebFrame method openLookup.

@Override
public Window.Lookup openLookup(Class<? extends Entity> entityClass, Window.Lookup.Handler handler, WindowManager.OpenType openType, Map<String, Object> params) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo lookupScreen = windowConfig.getLookupScreen(entityClass);
    WebWindowManager wm = App.getInstance().getWindowManager();
    return wm.openLookup(lookupScreen, handler, openType, params);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 25 with WebWindowManager

use of com.haulmont.cuba.web.WebWindowManager in project cuba by cuba-platform.

the class WebFrame method openFrame.

@Override
public Frame openFrame(Component parent, String windowAlias, Map<String, Object> params) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
    WebWindowManager wm = App.getInstance().getWindowManager();
    Frame wrappedFrame = ((Frame.Wrapper) wrapper).getWrappedFrame();
    return wm.openFrame(wrappedFrame, parent, windowInfo, params);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Aggregations

WebWindowManager (com.haulmont.cuba.web.WebWindowManager)31 WindowInfo (com.haulmont.cuba.gui.config.WindowInfo)16 WindowConfig (com.haulmont.cuba.gui.config.WindowConfig)15 App (com.haulmont.cuba.web.App)3 Connection (com.haulmont.cuba.web.Connection)2 Configuration (com.haulmont.cuba.core.global.Configuration)1 FileStorageException (com.haulmont.cuba.core.global.FileStorageException)1 Messages (com.haulmont.cuba.core.global.Messages)1 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)1 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)1 Window (com.haulmont.cuba.gui.components.Window)1 GenericExceptionHandler (com.haulmont.cuba.gui.exception.GenericExceptionHandler)1 ThemeConstants (com.haulmont.cuba.gui.theme.ThemeConstants)1 FileUploadingAPI (com.haulmont.cuba.gui.upload.FileUploadingAPI)1 User (com.haulmont.cuba.security.entity.User)1 WebConfig (com.haulmont.cuba.web.WebConfig)1 VersionedThemeResource (com.haulmont.cuba.web.toolkit.VersionedThemeResource)1 CubaMultiUpload (com.haulmont.cuba.web.toolkit.ui.CubaMultiUpload)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1