Search in sources :

Example 11 with TestIdManager

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

the class WebPickerField method setDebugId.

@Override
public void setDebugId(String id) {
    super.setDebugId(id);
    if (id != null) {
        String debugId = getDebugId();
        TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
        for (Action action : actions) {
            CubaButton button = actionButtons.get(action);
            if (button != null && Strings.isNullOrEmpty(button.getId())) {
                button.setId(testIdManager.getTestId(debugId + "_" + action.getId()));
            }
        }
    }
}
Also used : TestIdManager(com.haulmont.cuba.gui.sys.TestIdManager) ShortcutAction(com.vaadin.event.ShortcutAction) Action(com.haulmont.cuba.gui.components.Action) CubaButton(com.haulmont.cuba.web.widgets.CubaButton)

Example 12 with TestIdManager

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

the class WebPickerField 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);
    CubaButton vButton = new CubaButton();
    setPickerButtonAction(vButton, action);
    component.addButton(vButton, index);
    actionButtons.put(action, vButton);
    if (StringUtils.isNotEmpty(getDebugId())) {
        TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
        // Set debug id
        vButton.setId(testIdManager.getTestId(getDebugId() + "_" + action.getId()));
    }
    if (action instanceof PickerFieldAction) {
        PickerFieldAction pickerFieldAction = (PickerFieldAction) action;
        pickerFieldAction.setPickerField(this);
        if (!isEditable()) {
            pickerFieldAction.editableChanged(this, isEditable());
        }
    }
    actionsPermissions.apply(action);
    refreshActionsState();
}
Also used : TestIdManager(com.haulmont.cuba.gui.sys.TestIdManager) CubaButton(com.haulmont.cuba.web.widgets.CubaButton)

Example 13 with TestIdManager

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

the class WebPopupButton method setDebugId.

@Override
public void setDebugId(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(com.haulmont.cuba.gui.sys.TestIdManager) CubaButton(com.haulmont.cuba.web.widgets.CubaButton) CubaPopupButton(com.haulmont.cuba.web.widgets.CubaPopupButton) Button(com.vaadin.ui.Button) 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