Search in sources :

Example 1 with TestIdManager

use of io.jmix.ui.sys.TestIdManager 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 TestIdManager

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

the class CompositeComponent method assignDebugId.

protected void assignDebugId() {
    AppUI ui = AppUI.getCurrent();
    if (ui == null) {
        return;
    }
    if (root == null || frame == null || StringUtils.isEmpty(frame.getId())) {
        return;
    }
    if (ui.isPerformanceTestMode() && getDebugId() == null) {
        String fullFrameId = ComponentsHelper.getFullFrameId(frame);
        TestIdManager testIdManager = ui.getTestIdManager();
        String alternativeId = id != null ? id : getClass().getSimpleName();
        String candidateId = fullFrameId + "." + alternativeId;
        setDebugId(testIdManager.getTestId(candidateId));
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) AppUI(io.jmix.ui.AppUI)

Example 3 with TestIdManager

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

the class FormImpl method assignDebugId.

protected void assignDebugId(@Nullable com.vaadin.ui.Component composition, String id) {
    AppUI ui = AppUI.getCurrent();
    if (ui == null) {
        return;
    }
    String debugId = getDebugId();
    if (ui.isPerformanceTestMode()) {
        if (composition != null && debugId != null) {
            TestIdManager testIdManager = ui.getTestIdManager();
            composition.setId(testIdManager.getTestId(debugId + "_" + id));
        }
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) AppUI(io.jmix.ui.AppUI)

Example 4 with TestIdManager

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

the class AccordionImpl method setDebugId.

@Override
public void setDebugId(@Nullable String id) {
    super.setDebugId(id);
    String debugId = getDebugId();
    AppUI ui = AppUI.getCurrent();
    if (debugId != null && ui != null) {
        TestIdManager testIdManager = ui.getTestIdManager();
        for (Map.Entry<com.vaadin.ui.Component, ComponentDescriptor> tabEntry : tabMapping.entrySet()) {
            com.vaadin.ui.Component tabComponent = tabEntry.getKey();
            com.vaadin.ui.Accordion.Tab tab = component.getTab(tabComponent);
            ComponentDescriptor componentDescriptor = tabEntry.getValue();
            String name = componentDescriptor.name;
            component.setTestId(tab, testIdManager.getTestId(debugId + "." + name));
        }
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) JmixAccordion(io.jmix.ui.widget.JmixAccordion) AppUI(io.jmix.ui.AppUI)

Example 5 with TestIdManager

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

the class AbstractComponent method assignDebugId.

protected void assignDebugId() {
    AppUI ui = AppUI.getCurrent();
    if (ui == null) {
        return;
    }
    if (this.component == null || frame == null || StringUtils.isEmpty(frame.getId())) {
        return;
    }
    if (ui.isPerformanceTestMode() && getDebugId() == null) {
        String fullFrameId = ComponentsHelper.getFullFrameId(frame);
        TestIdManager testIdManager = ui.getTestIdManager();
        String alternativeId = id != null ? id : getClass().getSimpleName();
        String candidateId = fullFrameId + "." + alternativeId;
        setDebugId(testIdManager.getTestId(candidateId));
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) AppUI(io.jmix.ui.AppUI)

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