Search in sources :

Example 6 with TestIdManager

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

the class TabSheetImpl method setDebugId.

@Override
public void setDebugId(@Nullable String id) {
    super.setDebugId(id);
    String debugId = getDebugId();
    if (debugId != null && AppUI.getCurrent() != null) {
        TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
        for (Map.Entry<com.vaadin.ui.Component, ComponentDescriptor> tabEntry : tabMapping.entrySet()) {
            com.vaadin.ui.Component tabComponent = tabEntry.getKey();
            com.vaadin.ui.TabSheet.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) JmixTabSheet(io.jmix.ui.widget.JmixTabSheet) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 7 with TestIdManager

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

the class ValuePickerImpl method addAction.

@Override
public void addAction(Action action, int index) {
    checkNotNullArgument(action, "Action must be non null");
    int oldIndex = findActionById(actions, action.getId());
    if (oldIndex >= 0) {
        removeAction(actions.get(oldIndex));
        if (index > oldIndex) {
            index--;
        }
    }
    actions.add(index, action);
    actionHandler.addAction(action, index);
    JmixButton vButton = new JmixButton();
    setupButtonAction(vButton, action);
    action.addPropertyChangeListener(actionPropertyChangeListener);
    component.addButton(vButton, index);
    actionButtons.put(action, vButton);
    if (StringUtils.isNotEmpty(getDebugId()) && AppUI.getCurrent() != null) {
        TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
        // Set debug id
        vButton.setId(testIdManager.getTestId(getDebugId() + "_" + action.getId()));
    }
    if (action instanceof ValuePickerAction) {
        ValuePickerAction pickerAction = (ValuePickerAction) action;
        pickerAction.setPicker(this);
        if (!isEditable()) {
            pickerAction.editableChanged(isEditable());
        }
    }
    actionsPermissions.apply(action);
    refreshActionsState();
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) JmixButton(io.jmix.ui.widget.JmixButton)

Example 8 with TestIdManager

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

the class WebFieldGroup method assignDebugId.

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

Example 9 with TestIdManager

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

the class DateFieldImpl method setDebugId.

@Override
public void setDebugId(@Nullable String id) {
    super.setDebugId(id);
    if (id != null && AppUI.getCurrent() != null) {
        TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
        timeField.setId(testIdManager.getTestId(id + "_time"));
        dateField.setId(testIdManager.getTestId(id + "_date"));
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager)

Example 10 with TestIdManager

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

the class PopupButtonImpl method setDebugId.

@Override
public void setDebugId(@Nullable String id) {
    super.setDebugId(id);
    AppUI ui = AppUI.getCurrent();
    if (id != null && ui != null && ui.isPerformanceTestMode()) {
        TestIdManager testIdManager = ui.getTestIdManager();
        for (Map.Entry<Action, Button> entry : actionButtons.entrySet()) {
            Button button = entry.getValue();
            Action action = entry.getKey();
            button.setId(testIdManager.getTestId(id + "_" + action.getId()));
        }
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) Action(io.jmix.ui.action.Action) Button(com.vaadin.ui.Button) JmixPopupButton(io.jmix.ui.widget.JmixPopupButton) JmixButton(io.jmix.ui.widget.JmixButton) 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