Search in sources :

Example 1 with CubaLabel

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);
}
Also used : CubaLabel(com.haulmont.cuba.web.widgets.CubaLabel)

Example 2 with CubaLabel

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"));
    }
}
Also used : Locale(java.util.Locale) Window(com.vaadin.ui.Window) CubaWindow(com.haulmont.cuba.web.widgets.CubaWindow) Messages(com.haulmont.cuba.core.global.Messages) CubaLabel(com.haulmont.cuba.web.widgets.CubaLabel) Configuration(com.haulmont.cuba.core.global.Configuration) CubaButton(com.haulmont.cuba.web.widgets.CubaButton) Connection(com.haulmont.cuba.web.Connection) VerticalLayout(com.vaadin.ui.VerticalLayout) Icons(com.haulmont.cuba.gui.icons.Icons) ClientConfig(com.haulmont.cuba.client.ClientConfig)

Example 3 with CubaLabel

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"));
    }
}
Also used : Locale(java.util.Locale) Window(com.vaadin.ui.Window) CubaWindow(com.haulmont.cuba.web.widgets.CubaWindow) Messages(com.haulmont.cuba.core.global.Messages) CubaLabel(com.haulmont.cuba.web.widgets.CubaLabel) Configuration(com.haulmont.cuba.core.global.Configuration) CubaButton(com.haulmont.cuba.web.widgets.CubaButton) Connection(com.haulmont.cuba.web.Connection) VerticalLayout(com.vaadin.ui.VerticalLayout) Icons(com.haulmont.cuba.gui.icons.Icons) ClientConfig(com.haulmont.cuba.client.ClientConfig)

Aggregations

CubaLabel (com.haulmont.cuba.web.widgets.CubaLabel)3 ClientConfig (com.haulmont.cuba.client.ClientConfig)2 Configuration (com.haulmont.cuba.core.global.Configuration)2 Messages (com.haulmont.cuba.core.global.Messages)2 Icons (com.haulmont.cuba.gui.icons.Icons)2 Connection (com.haulmont.cuba.web.Connection)2 CubaButton (com.haulmont.cuba.web.widgets.CubaButton)2 CubaWindow (com.haulmont.cuba.web.widgets.CubaWindow)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 Window (com.vaadin.ui.Window)2 Locale (java.util.Locale)2