use of com.haulmont.cuba.gui.components.actions.ListAction in project cuba by cuba-platform.
the class ActionsHolderLoader method loadDeclarativeAction.
@Override
protected Action loadDeclarativeAction(ActionsHolder actionsHolder, Element element) {
String id = element.attributeValue("id");
if (StringUtils.isEmpty(id)) {
throw new GuiDevelopmentException("No action id provided", context, "ActionsHolder ID", actionsHolder.getId());
}
if (StringUtils.isEmpty(element.attributeValue("invoke"))) {
// only in legacy frames
if (context instanceof ComponentContext && ((ComponentContext) context).getFrame().getFrameOwner() instanceof LegacyFrame) {
// 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;
}
}
} else {
String actionTypeId = element.attributeValue("type");
if (StringUtils.isNotEmpty(actionTypeId)) {
Actions actions = beanLocator.get(Actions.NAME);
Action instance = actions.create(actionTypeId, id);
if (instance instanceof ListAction) {
((ListAction) instance).setTarget((ListComponent) actionsHolder);
}
loadStandardActionProperties(instance, element);
loadActionConstraint(instance, element);
loadShortcut(instance, element);
loadCustomProperties(instance, element);
return instance;
}
}
}
return super.loadDeclarativeAction(actionsHolder, element);
}
Aggregations