Search in sources :

Example 1 with RibbonGroupsPack

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));
}
Also used : RibbonTemplateParameters(com.qcadoo.view.internal.ribbon.templates.RibbonTemplateParameters) RibbonTemplate(com.qcadoo.view.internal.ribbon.templates.model.RibbonTemplate) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup) RibbonGroupsPack(com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack) TemplateRibbonGroupsPack(com.qcadoo.view.internal.ribbon.templates.model.TemplateRibbonGroupsPack) Test(org.junit.Test)

Example 2 with RibbonGroupsPack

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);
    }
}
Also used : WindowComponentPattern(com.qcadoo.view.internal.components.window.WindowComponentPattern) InternalViewDefinition(com.qcadoo.view.internal.api.InternalViewDefinition) Node(org.w3c.dom.Node) SingleRibbonGroupPack(com.qcadoo.view.internal.ribbon.model.SingleRibbonGroupPack) ViewDefinitionParserNodeException(com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException) RibbonGroupsPack(com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack) ModuleException(com.qcadoo.plugin.api.ModuleException) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup) ViewDefinitionParserNodeException(com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException) IOException(java.io.IOException) ModuleException(com.qcadoo.plugin.api.ModuleException) ViewDefinitionParserException(com.qcadoo.view.internal.xml.ViewDefinitionParserException)

Example 3 with RibbonGroupsPack

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);
}
Also used : RibbonGroupsPack(com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack) TemplateRibbonGroupsPack(com.qcadoo.view.internal.ribbon.templates.model.TemplateRibbonGroupsPack) Test(org.junit.Test)

Aggregations

RibbonGroupsPack (com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack)3 InternalRibbonGroup (com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)2 TemplateRibbonGroupsPack (com.qcadoo.view.internal.ribbon.templates.model.TemplateRibbonGroupsPack)2 Test (org.junit.Test)2 ModuleException (com.qcadoo.plugin.api.ModuleException)1 InternalViewDefinition (com.qcadoo.view.internal.api.InternalViewDefinition)1 WindowComponentPattern (com.qcadoo.view.internal.components.window.WindowComponentPattern)1 SingleRibbonGroupPack (com.qcadoo.view.internal.ribbon.model.SingleRibbonGroupPack)1 RibbonTemplateParameters (com.qcadoo.view.internal.ribbon.templates.RibbonTemplateParameters)1 RibbonTemplate (com.qcadoo.view.internal.ribbon.templates.model.RibbonTemplate)1 ViewDefinitionParserException (com.qcadoo.view.internal.xml.ViewDefinitionParserException)1 ViewDefinitionParserNodeException (com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException)1 IOException (java.io.IOException)1 Node (org.w3c.dom.Node)1