use of com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack 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.RibbonGroupsPack in project qcadoo by qcadoo.
the class ViewRibbonModule method enable.
@Override
public void enable() {
addedGroups = new HashMap<WindowComponentPattern, RibbonGroupsPack>();
InternalViewDefinition viewDefinition = viewDefinitionService.getWithoutSession(viewExtension.getPluginName(), viewExtension.getViewName());
if (viewDefinition == null) {
throw new ModuleException(pluginIdentifier, "view", "reference to view which not exists");
}
try {
for (Node groupNode : viewDefinitionParser.geElementChildren(viewExtension.getExtesionNode())) {
try {
InternalRibbonGroup group = viewDefinitionParser.parseRibbonGroup(groupNode, viewDefinition);
group.setExtensionPluginIdentifier(pluginIdentifier);
RibbonGroupsPack groupsPack = new SingleRibbonGroupPack(group);
WindowComponentPattern window = viewDefinition.getRootWindow();
window.getRibbon().addGroupsPack(groupsPack);
addedGroups.put(window, groupsPack);
} catch (ViewDefinitionParserNodeException e) {
throw ViewDefinitionParserException.forFileAndNode(fileName, e);
}
}
} catch (Exception e) {
throw new ModuleException(pluginIdentifier, "view-ribbon-group", e);
}
}
use of com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack in project qcadoo by qcadoo.
the class TemplateRibbonGroupsPackTest method shouldGetUpdateReturnNullIfUpdateGroupsListIsEmpty.
@Test
public final void shouldGetUpdateReturnNullIfUpdateGroupsListIsEmpty() throws Exception {
// when
RibbonGroupsPack ribbonGroupsPackUpdate = templateRibbonGroupsPack.getUpdate();
// then
Assert.assertNull(ribbonGroupsPackUpdate);
}
Aggregations