Search in sources :

Example 1 with AppUI

use of io.jmix.ui.AppUI in project jmix by jmix-framework.

the class TablePresentationsLayout method createActionButton.

protected JmixButton createActionButton(Action action) {
    JmixButton actionBtn = new JmixButton();
    actionBtn.setWidth("100%");
    actionBtn.setPrimaryStyleName(CONTEXT_MENU_BUTTON_STYLENAME);
    setPopupButtonAction(actionBtn, action);
    AppUI ui = AppUI.getCurrent();
    if (ui != null) {
        if (ui.isTestMode()) {
            actionBtn.setJTestId(action.getId());
        }
        if (ui.isPerformanceTestMode()) {
            String debugId = getDebugId();
            if (debugId != null) {
                TestIdManager testIdManager = ui.getTestIdManager();
                actionBtn.setId(testIdManager.getTestId(debugId + "_" + action.getId()));
            }
        }
    }
    return actionBtn;
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) StringUtils.defaultString(org.apache.commons.lang3.StringUtils.defaultString) AppUI(io.jmix.ui.AppUI)

Example 2 with AppUI

use of io.jmix.ui.AppUI in project jmix by jmix-framework.

the class UserIndicatorImpl method createUserIndicator.

protected HasValue<UserDetails> createUserIndicator(UserDetails user) {
    Label<UserDetails> userNameLabel = uiComponents.create(Label.of(UserDetails.class));
    userNameLabel.setStyleName("jmix-user-select-label");
    userNameLabel.setFormatter(this::generateUserCaption);
    userNameLabel.setValue(user);
    AppUI ui = AppUI.getCurrent();
    if (ui != null && ui.isTestMode()) {
        userNameLabel.unwrap(Component.class).setJTestId("currentUserLabel");
    }
    return userNameLabel;
}
Also used : UserDetails(org.springframework.security.core.userdetails.UserDetails) Component(com.vaadin.ui.Component) AppUI(io.jmix.ui.AppUI)

Example 3 with AppUI

use of io.jmix.ui.AppUI in project jmix by jmix-framework.

the class WebFieldGroup method setDebugId.

@Override
public void setDebugId(String id) {
    super.setDebugId(id);
    AppUI ui = AppUI.getCurrent();
    if (ui != null && id != null) {
        for (final FieldConfig fc : fields.values()) {
            com.vaadin.ui.Component composition = ComponentsHelper.getComposition(fc.getComponentNN());
            composition.setId(ui.getTestIdManager().getTestId(id + "_" + fc.getId()));
        }
    }
}
Also used : AppUI(io.jmix.ui.AppUI)

Example 4 with AppUI

use of io.jmix.ui.AppUI in project jmix by jmix-framework.

the class WebFilterHelper method openFolderEditWindow.

@Override
public void openFolderEditWindow(boolean isAppFolder, AbstractSearchFolder folder, TablePresentations presentations, Runnable commitHandler) {
    FolderEditWindow window = AppFolderEditWindow.create(isAppFolder, false, folder, presentations, commitHandler);
    AppUI appUI = AppUI.getCurrent();
    if (appUI != null) {
        appUI.addWindow(window);
    }
}
Also used : AppFolderEditWindow(com.haulmont.cuba.web.app.folders.AppFolderEditWindow) FolderEditWindow(com.haulmont.cuba.web.app.folders.FolderEditWindow) AppUI(io.jmix.ui.AppUI)

Example 5 with AppUI

use of io.jmix.ui.AppUI in project jmix by jmix-framework.

the class CompositeComponent method enableEventListeners.

@Internal
protected void enableEventListeners() {
    List<ApplicationListener> listeners = getUiEventListeners();
    if (CollectionUtils.isNotEmpty(listeners)) {
        AppUI ui = AppUI.getCurrent();
        UiEventsMulticaster multicaster = ui.getUiEventsMulticaster();
        for (ApplicationListener listener : uiEventListeners) {
            multicaster.addApplicationListener(listener);
        }
    }
}
Also used : ApplicationListener(org.springframework.context.ApplicationListener) UiEventsMulticaster(io.jmix.ui.sys.event.UiEventsMulticaster) AppUI(io.jmix.ui.AppUI) Internal(io.jmix.core.annotation.Internal)

Aggregations

AppUI (io.jmix.ui.AppUI)56 TestIdManager (io.jmix.ui.sys.TestIdManager)8 Component (com.vaadin.ui.Component)5 UiEventsMulticaster (io.jmix.ui.sys.event.UiEventsMulticaster)4 ApplicationListener (org.springframework.context.ApplicationListener)4 SearchFolder (com.haulmont.cuba.security.entity.SearchFolder)3 Notifications (io.jmix.ui.Notifications)3 Folder (com.haulmont.cuba.core.entity.Folder)2 Internal (io.jmix.core.annotation.Internal)2 Screen (io.jmix.ui.screen.Screen)2 StandardCloseAction (io.jmix.ui.screen.StandardCloseAction)2 Subscribe (io.jmix.ui.screen.Subscribe)2 JmixButton (io.jmix.ui.widget.JmixButton)2 Nullable (javax.annotation.Nullable)2 Strings (com.google.common.base.Strings)1 AbstractSearchFolder (com.haulmont.cuba.core.entity.AbstractSearchFolder)1 AppFolder (com.haulmont.cuba.core.entity.AppFolder)1 AppFolderEditWindow (com.haulmont.cuba.web.app.folders.AppFolderEditWindow)1 FolderEditWindow (com.haulmont.cuba.web.app.folders.FolderEditWindow)1 KeyCode (com.vaadin.event.ShortcutAction.KeyCode)1