Search in sources :

Example 1 with TestIdManager

use of com.haulmont.cuba.gui.sys.TestIdManager in project cuba by cuba-platform.

the class WebPopupButton method createActionButton.

protected CubaButton createActionButton(Action action) {
    CubaButton button = new CubaButton();
    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.setCubaId(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(com.haulmont.cuba.gui.sys.TestIdManager) CubaButton(com.haulmont.cuba.web.widgets.CubaButton) AppUI(com.haulmont.cuba.web.AppUI)

Example 2 with TestIdManager

use of com.haulmont.cuba.gui.sys.TestIdManager in project cuba by cuba-platform.

the class WebForm method assignDebugId.

protected void assignDebugId(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(com.haulmont.cuba.gui.sys.TestIdManager) AppUI(com.haulmont.cuba.web.AppUI)

Example 3 with TestIdManager

use of com.haulmont.cuba.gui.sys.TestIdManager in project cuba by cuba-platform.

the class WindowBreadCrumbs method componentAttachedToUI.

protected void componentAttachedToUI() {
    adjustParentStyles();
    if (ui.isTestMode()) {
        linksLayout.setCubaId("breadCrumbs");
        if (closeBtn != null) {
            closeBtn.setCubaId("closeBtn");
        }
    }
    if (ui.isPerformanceTestMode()) {
        TestIdManager testIdManager = ui.getTestIdManager();
        linksLayout.setId(testIdManager.getTestId("breadCrumbs"));
        if (closeBtn != null) {
            closeBtn.setId(testIdManager.getTestId("closeBtn"));
        }
    }
}
Also used : TestIdManager(com.haulmont.cuba.gui.sys.TestIdManager)

Example 4 with TestIdManager

use of com.haulmont.cuba.gui.sys.TestIdManager in project cuba by cuba-platform.

the class WebAbstractComponent 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(com.haulmont.cuba.gui.sys.TestIdManager) AppUI(com.haulmont.cuba.web.AppUI)

Example 5 with TestIdManager

use of com.haulmont.cuba.gui.sys.TestIdManager in project cuba by cuba-platform.

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(com.haulmont.cuba.gui.sys.TestIdManager) AppUI(com.haulmont.cuba.web.AppUI)

Aggregations

TestIdManager (com.haulmont.cuba.gui.sys.TestIdManager)13 AppUI (com.haulmont.cuba.web.AppUI)8 CubaButton (com.haulmont.cuba.web.widgets.CubaButton)5 Action (com.haulmont.cuba.gui.components.Action)1 CubaAccordion (com.haulmont.cuba.web.widgets.CubaAccordion)1 CubaPopupButton (com.haulmont.cuba.web.widgets.CubaPopupButton)1 CubaTabSheet (com.haulmont.cuba.web.widgets.CubaTabSheet)1 ShortcutAction (com.vaadin.event.ShortcutAction)1 AbstractComponent (com.vaadin.ui.AbstractComponent)1 Button (com.vaadin.ui.Button)1 StringUtils.defaultString (org.apache.commons.lang3.StringUtils.defaultString)1