use of com.haulmont.cuba.web.toolkit.ui.CubaLabel in project cuba by cuba-platform.
the class NoUserSessionHandler method showNoUserSessionDialog.
protected void showNoUserSessionDialog(App app) {
Messages messages = AppBeans.get(Messages.NAME);
Window dialog = new NoUserSessionExceptionDialog();
dialog.setStyleName("c-nousersession-dialog");
dialog.setCaption(messages.getMainMessage("dialogs.Information", locale));
dialog.setClosable(false);
dialog.setResizable(false);
dialog.setModal(true);
AppUI ui = app.getAppUI();
if (ui.isTestMode()) {
dialog.setCubaId("optionDialog");
dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
}
Label messageLab = new CubaLabel();
messageLab.setWidthUndefined();
messageLab.setValue(messages.getMainMessage("noUserSession.message", locale));
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setWidthUndefined();
layout.setStyleName("c-nousersession-dialog-layout");
layout.setSpacing(true);
dialog.setContent(layout);
Button reloginBtn = new Button();
if (ui.isTestMode()) {
reloginBtn.setCubaId("reloginBtn");
reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
}
reloginBtn.addStyleName(WebButton.ICON_STYLE);
reloginBtn.addStyleName("c-primary-action");
reloginBtn.addClickListener(event -> relogin());
reloginBtn.setCaption(messages.getMainMessage(Type.OK.getMsgKey()));
String iconName = AppBeans.get(Icons.class).get(Type.OK.getIconKey());
reloginBtn.setIcon(AppBeans.get(IconResolver.class).getIconResource(iconName));
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
setClickShortcut(reloginBtn, clientConfig.getCommitShortcut());
reloginBtn.focus();
layout.addComponent(messageLab);
layout.addComponent(reloginBtn);
layout.setComponentAlignment(reloginBtn, Alignment.BOTTOM_RIGHT);
ui.addWindow(dialog);
dialog.center();
}
Aggregations