use of com.haulmont.cuba.web.widgets.CubaLabel in project cuba by cuba-platform.
the class CubaCurrencyField method initCurrencyLabel.
protected void initCurrencyLabel() {
currencyLabel = new CubaLabel();
// enables to set to the table-cell element width by content
currencyLabel.setWidth("1px");
currencyLabel.setHeight("100%");
currencyLabel.addStyleName(CURRENCY_STYLENAME);
}
use of com.haulmont.cuba.web.widgets.CubaLabel in project cuba by cuba-platform.
the class NoUserSessionHandler method showNoUserSessionDialog.
protected void showNoUserSessionDialog(AppUI ui) {
Messages messages = beanLocator.get(Messages.class);
Connection connection = ui.getApp().getConnection();
// noinspection ConstantConditions
Locale locale = connection.getSession().getLocale();
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);
CubaLabel messageLab = new CubaLabel();
messageLab.setWidthUndefined();
messageLab.setValue(messages.getMainMessage("noUserSession.message", locale));
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(false);
layout.setWidthUndefined();
layout.setStyleName("c-nousersession-dialog-layout");
layout.setSpacing(true);
dialog.setContent(layout);
CubaButton reloginBtn = new CubaButton();
reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME);
reloginBtn.addClickListener(event -> relogin());
reloginBtn.setCaption(messages.getMainMessage(Type.OK.getMsgKey()));
String iconName = beanLocator.get(Icons.class).get(Type.OK.getIconKey());
reloginBtn.setIcon(beanLocator.get(IconResolver.class).getIconResource(iconName));
ClientConfig clientConfig = beanLocator.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();
if (ui.isTestMode()) {
dialog.setCubaId("optionDialog");
reloginBtn.setCubaId("reloginBtn");
}
if (ui.isPerformanceTestMode()) {
dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
}
}
use of com.haulmont.cuba.web.widgets.CubaLabel in project cuba by cuba-platform.
the class MismatchedUserSessionHandler method showMismatchedSessionDialog.
protected void showMismatchedSessionDialog(AppUI ui) {
Messages messages = beanLocator.get(Messages.class);
Connection connection = ui.getApp().getConnection();
// noinspection ConstantConditions
Locale locale = connection.getSession().getLocale();
Window dialog = new MismatchedUserSessionExceptionDialog();
dialog.setStyleName("c-sessionchanged-dialog");
dialog.setCaption(messages.getMainMessage("dialogs.Information", locale));
dialog.setClosable(false);
dialog.setResizable(false);
dialog.setModal(true);
CubaLabel messageLab = new CubaLabel();
messageLab.setWidthUndefined();
messageLab.setValue(messages.getMainMessage("sessionChangedMsg", locale));
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(false);
layout.setWidthUndefined();
layout.setStyleName("c-sessionchanged-dialog-layout");
layout.setSpacing(true);
dialog.setContent(layout);
CubaButton reloginBtn = new CubaButton();
reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME);
reloginBtn.setCaption(messages.getMainMessage(DialogAction.Type.OK.getMsgKey(), locale));
reloginBtn.addClickListener(event -> ui.getApp().recreateUi(ui));
String iconName = beanLocator.get(Icons.class).get(DialogAction.Type.OK.getIconKey());
reloginBtn.setIcon(beanLocator.get(IconResolver.class).getIconResource(iconName));
ClientConfig clientConfig = beanLocator.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();
if (ui.isTestMode()) {
dialog.setCubaId("optionDialog");
reloginBtn.setCubaId("reloginBtn");
}
if (ui.isPerformanceTestMode()) {
dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
}
}
Aggregations