Search in sources :

Example 1 with ListActionType

use of com.haulmont.cuba.gui.components.actions.ListActionType in project cuba by cuba-platform.

the class ActionsHolderLoader method loadDeclarativeAction.

@Override
protected Action loadDeclarativeAction(Component.ActionsHolder actionsHolder, Element element) {
    String id = element.attributeValue("id");
    if (StringUtils.isEmpty(id)) {
        throw new GuiDevelopmentException("No action id provided", context.getFullFrameId(), "ActionsHolder ID", actionsHolder.getId());
    }
    if (StringUtils.isBlank(element.attributeValue("invoke"))) {
        // Try to create a standard list action
        for (ListActionType type : ListActionType.values()) {
            if (type.getId().equals(id)) {
                Action instance = type.createAction((ListComponent) actionsHolder);
                loadStandardActionProperties(instance, element);
                loadActionOpenType(instance, element);
                loadActionConstraint(instance, element);
                loadShortcut(instance, element);
                return instance;
            }
        }
    }
    return super.loadDeclarativeAction(actionsHolder, element);
}
Also used : Action(com.haulmont.cuba.gui.components.Action) GuiDevelopmentException(com.haulmont.cuba.gui.GuiDevelopmentException) ListActionType(com.haulmont.cuba.gui.components.actions.ListActionType)

Aggregations

GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)1 Action (com.haulmont.cuba.gui.components.Action)1 ListActionType (com.haulmont.cuba.gui.components.actions.ListActionType)1