use of com.haulmont.cuba.gui.components.DialogAction in project cuba by cuba-platform.
the class SessionLogBrowser method enableLogging.
public void enableLogging() {
if (globalConfig.getUserSessionLogEnabled()) {
showOptionDialog(getMessage("dialogs.Confirmation"), getMessage("confirmDisable"), MessageType.CONFIRMATION, new Action[] { new DialogAction(DialogAction.Type.YES, true).withHandler(actionPerformedEvent -> {
globalConfig.setUserSessionLogEnabled(false);
enableBtn.setCaption(getMessage("enableLogging"));
}), new DialogAction(DialogAction.Type.NO) });
} else {
globalConfig.setUserSessionLogEnabled(true);
enableBtn.setCaption(getMessage("disableLogging"));
}
}
use of com.haulmont.cuba.gui.components.DialogAction in project cuba by cuba-platform.
the class UserSwitchLinkHandlerProcessor method substituteUserAndOpenWindow.
protected void substituteUserAndOpenWindow(ExternalLinkContext linkContext, UUID userId) {
App app = linkContext.getApp();
UserSession userSession = app.getConnection().getSession();
assert userSession != null;
final User substitutedUser = loadUser(userId, userSession.getUser());
if (substitutedUser != null) {
app.getWindowManager().showOptionDialog(messages.getMainMessage("toSubstitutedUser.title"), getDialogMessage(substitutedUser), Frame.MessageType.CONFIRMATION_HTML, new Action[] { new ChangeSubstUserAction(substitutedUser) {
@Override
public void doAfterChangeUser() {
super.doAfterChangeUser();
screenHandler.handle(linkContext);
}
@Override
public void doRevert() {
super.doRevert();
JavaScript js = Page.getCurrent().getJavaScript();
js.execute("window.close();");
}
@Override
public String getCaption() {
return messages.getMainMessage("action.switch");
}
}, new DoNotChangeSubstUserAction() {
@Override
public void actionPerform(Component component) {
super.actionPerform(component);
JavaScript js = Page.getCurrent().getJavaScript();
js.execute("window.close();");
}
@Override
public String getCaption() {
return messages.getMainMessage("action.cancel");
}
} });
} else {
User user = loadUser(userId);
app.getWindowManager().showOptionDialog(messages.getMainMessage("warning.title"), getWarningMessage(user), Frame.MessageType.WARNING_HTML, new Action[] { new DialogAction(DialogAction.Type.OK).withHandler(event -> {
JavaScript js = Page.getCurrent().getJavaScript();
js.execute("window.close();");
}) });
}
}
Aggregations