Search in sources :

Example 1 with DeclarativeTrackingAction

use of com.haulmont.cuba.gui.xml.DeclarativeTrackingAction 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);
    }
}
Also used : Element(org.dom4j.Element) GuiDevelopmentException(com.haulmont.cuba.gui.GuiDevelopmentException) DeclarativeTrackingAction(com.haulmont.cuba.gui.xml.DeclarativeTrackingAction) DeclarativeAction(com.haulmont.cuba.gui.xml.DeclarativeAction)

Aggregations

GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)1 DeclarativeAction (com.haulmont.cuba.gui.xml.DeclarativeAction)1 DeclarativeTrackingAction (com.haulmont.cuba.gui.xml.DeclarativeTrackingAction)1 Element (org.dom4j.Element)1