Search in sources :

Example 11 with TestIdManager

use of io.jmix.ui.sys.TestIdManager in project jmix by jmix-framework.

the class ValuePickerImpl method setDebugId.

@Override
public void setDebugId(@Nullable String id) {
    super.setDebugId(id);
    if (id != null && AppUI.getCurrent() != null) {
        String debugId = getDebugId();
        TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
        for (Action action : actions) {
            JmixButton button = actionButtons.get(action);
            if (button != null && Strings.isNullOrEmpty(button.getId())) {
                button.setId(testIdManager.getTestId(debugId + "_" + action.getId()));
            }
        }
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) Action(io.jmix.ui.action.Action) ShortcutAction(com.vaadin.event.ShortcutAction) JmixButton(io.jmix.ui.widget.JmixButton)

Example 12 with TestIdManager

use of io.jmix.ui.sys.TestIdManager in project jmix by jmix-framework.

the class PopupButtonImpl method createActionButton.

protected JmixButton createActionButton(Action action) {
    JmixButton button = new JmixButton();
    button.setWidth(100, Sizeable.Unit.PERCENTAGE);
    button.setPrimaryStyleName(CONTEXT_MENU_BUTTON_STYLENAME);
    setPopupButtonAction(button, action);
    AppUI ui = AppUI.getCurrent();
    if (ui != null) {
        if (ui.isTestMode()) {
            button.setJTestId(action.getId());
        }
        if (ui.isPerformanceTestMode()) {
            String debugId = getDebugId();
            if (debugId != null) {
                TestIdManager testIdManager = ui.getTestIdManager();
                button.setId(testIdManager.getTestId(debugId + "_" + action.getId()));
            }
        }
    }
    return button;
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) JmixButton(io.jmix.ui.widget.JmixButton) AppUI(io.jmix.ui.AppUI)

Example 13 with TestIdManager

use of io.jmix.ui.sys.TestIdManager in project jmix by jmix-framework.

the class WindowBreadCrumbs method componentAttachedToUI.

protected void componentAttachedToUI() {
    adjustParentStyles();
    if (ui.isTestMode()) {
        linksLayout.setJTestId("breadCrumbs");
        if (closeBtn != null) {
            closeBtn.setJTestId("closeBtn");
        }
    }
    if (ui.isPerformanceTestMode()) {
        TestIdManager testIdManager = ui.getTestIdManager();
        linksLayout.setId(testIdManager.getTestId("breadCrumbs"));
        if (closeBtn != null) {
            closeBtn.setId(testIdManager.getTestId("closeBtn"));
        }
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager)

Aggregations

TestIdManager (io.jmix.ui.sys.TestIdManager)13 AppUI (io.jmix.ui.AppUI)8 JmixButton (io.jmix.ui.widget.JmixButton)4 Action (io.jmix.ui.action.Action)2 ShortcutAction (com.vaadin.event.ShortcutAction)1 Button (com.vaadin.ui.Button)1 JmixAccordion (io.jmix.ui.widget.JmixAccordion)1 JmixPopupButton (io.jmix.ui.widget.JmixPopupButton)1 JmixTabSheet (io.jmix.ui.widget.JmixTabSheet)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 StringUtils.defaultString (org.apache.commons.lang3.StringUtils.defaultString)1