use of com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup in project qcadoo by qcadoo.
the class TemplateRibbonGroupsPackTest method shouldNotCallTemplateFromUpdateInfoPack.
@Test
public final void shouldNotCallTemplateFromUpdateInfoPack() throws Exception {
// given
InternalRibbonGroup internalRibbonGroup = mock(InternalRibbonGroup.class);
given(internalRibbonGroup.getUpdate()).willReturn(internalRibbonGroup);
stubTemplateGetRibbonGroups(Lists.newArrayList(internalRibbonGroup));
RibbonGroupsPack ribbonGroupsPackUpdate = templateRibbonGroupsPack.getUpdate();
// Flush
template = mock(RibbonTemplate.class);
// when
ribbonGroupsPackUpdate.getGroups();
// then
verify(template, never()).getRibbonGroups(Mockito.any(RibbonTemplateParameters.class), Mockito.eq(viewDefinition));
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup 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);
}
}
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup 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;
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup 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;
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup 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;
}
Aggregations