use of com.haulmont.cuba.gui.xml.DeclarativeAction in project cuba by cuba-platform.
the class AbstractComponentLoader method loadDeclarativeActionDefault.
protected Action loadDeclarativeActionDefault(Component.ActionsHolder actionsHolder, Element element) {
String id = element.attributeValue("id");
if (id == null) {
Element component = element;
for (int i = 0; i < 2; i++) {
if (component.getParent() != null)
component = component.getParent();
else
throw new GuiDevelopmentException("No action ID provided", context.getFullFrameId());
}
throw new GuiDevelopmentException("No action ID provided", context.getFullFrameId(), "Component ID", component.attributeValue("id"));
}
String trackSelection = element.attributeValue("trackSelection");
String shortcut = StringUtils.trimToNull(element.attributeValue("shortcut"));
shortcut = loadShortcut(shortcut);
if (Boolean.parseBoolean(trackSelection)) {
DeclarativeTrackingAction action = new DeclarativeTrackingAction(id, loadResourceString(element.attributeValue("caption")), loadResourceString(element.attributeValue("description")), getIconPath(element.attributeValue("icon")), element.attributeValue("enable"), element.attributeValue("visible"), element.attributeValue("invoke"), shortcut, actionsHolder);
loadActionConstraint(action, element);
return action;
} else {
return new DeclarativeAction(id, loadResourceString(element.attributeValue("caption")), loadResourceString(element.attributeValue("description")), getIconPath(element.attributeValue("icon")), element.attributeValue("enable"), element.attributeValue("visible"), element.attributeValue("invoke"), shortcut, actionsHolder);
}
}
use of com.haulmont.cuba.gui.xml.DeclarativeAction in project cuba by cuba-platform.
the class ButtonLoader method loadInvoke.
protected void loadInvoke(Button component, boolean enabled, boolean visible, Element element) {
if (!StringUtils.isBlank(element.attributeValue("action"))) {
return;
}
final String methodName = element.attributeValue("invoke");
if (StringUtils.isBlank(methodName)) {
return;
}
String actionBaseId = component.getId();
if (StringUtils.isEmpty(actionBaseId)) {
actionBaseId = methodName;
}
DeclarativeAction action = new DeclarativeAction(actionBaseId + "_invoke", component.getCaption(), component.getDescription(), component.getIcon(), enabled, visible, methodName, component.getFrame());
component.setAction(action);
}
Aggregations