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);
}
}
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) });
}
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");
}
}
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);
}
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);
}
Aggregations