Search in sources :

Example 1 with RibbonGroupImpl

use of com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl in project qcadoo by qcadoo.

the class RibbonParserService method parseRibbonGroup.

public InternalRibbonGroup parseRibbonGroup(final Node groupNode, final ViewDefinitionParser parser, final ViewDefinition viewDefinition) throws ViewDefinitionParserNodeException {
    String template = parser.getStringAttribute(groupNode, "template");
    SecurityRole role = parser.getAuthorizationRole(groupNode);
    if (template == null) {
        String groupName = parser.getStringAttribute(groupNode, NAME);
        if (groupName == null) {
            throw new ViewDefinitionParserNodeException(groupNode, "Name attribute cannot be empty");
        }
        InternalRibbonGroup ribbonGroup = new RibbonGroupImpl(groupName, role);
        NodeList childNodes = groupNode.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node child = childNodes.item(i);
            if (child.getNodeType() == Node.ELEMENT_NODE) {
                ribbonGroup.addItem(parseRibbonItem(child, parser, viewDefinition));
            }
        }
        return ribbonGroup;
    } else {
        try {
            return ribbonTemplates.getGroupTemplate(template, viewDefinition, role);
        } catch (IllegalStateException e) {
            throw new ViewDefinitionParserNodeException(groupNode, e);
        }
    }
}
Also used : SecurityRole(com.qcadoo.security.api.SecurityRole) RibbonGroupImpl(com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) ViewDefinitionParserNodeException(com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)

Example 2 with RibbonGroupImpl

use of com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl in project qcadoo by qcadoo.

the class RibbonTemplates method createGridNewActionTemplate.

private InternalRibbonGroup createGridNewActionTemplate(final ViewDefinition viewDefinition, final SecurityRole role) {
    InternalRibbonGroup ribbonGroup = new RibbonGroupImpl(ACTIONS, role);
    ribbonGroup.addItem(createGridNewAction(viewDefinition));
    return ribbonGroup;
}
Also used : RibbonGroupImpl(com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)

Example 3 with RibbonGroupImpl

use of com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl in project qcadoo by qcadoo.

the class RibbonTemplates method createGridNewAndCopyActionsTemplate.

private InternalRibbonGroup createGridNewAndCopyActionsTemplate(final ViewDefinition viewDefinition, final SecurityRole role) {
    InternalRibbonGroup ribbonGroup = new RibbonGroupImpl(ACTIONS, role);
    ribbonGroup.addItem(createGridNewAction(viewDefinition));
    ribbonGroup.addItem(createGridCopyAction(viewDefinition));
    return ribbonGroup;
}
Also used : RibbonGroupImpl(com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)

Example 4 with RibbonGroupImpl

use of com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl in project qcadoo by qcadoo.

the class RibbonTemplates method createFormSaveActionTemplate.

private InternalRibbonGroup createFormSaveActionTemplate(final ViewDefinition viewDefinition, final SecurityRole role) {
    InternalRibbonActionItem ribbonSaveAction = new RibbonActionItemImpl();
    ribbonSaveAction.setAction(RibbonUtils.translateRibbonAction("#{form}.performSave; #{window}.performBack", viewDefinition));
    ribbonSaveAction.setIcon("saveBackIcon24.png");
    ribbonSaveAction.setName("saveBack");
    ribbonSaveAction.setType(RibbonActionItem.Type.BIG_BUTTON);
    ribbonSaveAction.setEnabled(true);
    InternalRibbonGroup ribbonGroup = new RibbonGroupImpl(ACTIONS, role);
    ribbonGroup.addItem(ribbonSaveAction);
    return ribbonGroup;
}
Also used : RibbonGroupImpl(com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl) RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)

Example 5 with RibbonGroupImpl

use of com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl in project qcadoo by qcadoo.

the class RibbonTemplates method createGridNewCopyAndRemoveActionsTemplate.

private InternalRibbonGroup createGridNewCopyAndRemoveActionsTemplate(final ViewDefinition viewDefinition, final SecurityRole role) {
    InternalRibbonGroup ribbonGroup = new RibbonGroupImpl(ACTIONS, role);
    ribbonGroup.addItem(createGridNewAction(viewDefinition));
    ribbonGroup.addItem(createGridCopyAction(viewDefinition));
    ribbonGroup.addItem(createGridDeleteAction(viewDefinition));
    return ribbonGroup;
}
Also used : RibbonGroupImpl(com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)

Aggregations

InternalRibbonGroup (com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)18 RibbonGroupImpl (com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl)18 InternalRibbonActionItem (com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)4 RibbonActionItemImpl (com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl)2 SecurityRole (com.qcadoo.security.api.SecurityRole)1 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)1 ViewDefinitionParserNodeException (com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1