Search in sources :

Example 1 with NavTreeBuilder

use of org.dashbuilder.navigation.impl.NavTreeBuilder in project kie-wb-common by kiegroup.

the class DefaultWorkbenchFeaturesMenusHelperTest method buildMenusFromNavTreeTest.

@Test
public void buildMenusFromNavTreeTest() {
    NavTree navTree = new NavTreeBuilder().group("g1", "g1", "g1", true).item("i1", "i1", "i1", true).endGroup().group("g2", "g2", "g2", true).item("i2", "i2", "i2", true).endGroup().group("g3", "g3", "g3", true).endGroup().build();
    Menus menus = menusHelper.buildMenusFromNavTree(navTree).build();
    List<MenuItem> menuItems = menus.getItems();
    assertEquals(menuItems.size(), 2);
    MenuGroup group1 = (MenuGroup) menuItems.get(0);
    assertEquals(group1.getCaption(), "g1");
    assertEquals(group1.getItems().size(), 1);
    MenuItem item1 = group1.getItems().get(0);
    assertEquals(item1.getCaption(), "i1");
    MenuGroup group2 = (MenuGroup) menuItems.get(1);
    assertEquals(group2.getCaption(), "g2");
    assertEquals(group2.getItems().size(), 1);
    MenuItem item2 = group2.getItems().get(0);
    assertEquals(item2.getCaption(), "i2");
}
Also used : NavTree(org.dashbuilder.navigation.NavTree) NavTreeBuilder(org.dashbuilder.navigation.impl.NavTreeBuilder) Menus(org.uberfire.workbench.model.menu.Menus) MenuItem(org.uberfire.workbench.model.menu.MenuItem) MenuGroup(org.uberfire.workbench.model.menu.MenuGroup) Test(org.junit.Test)

Aggregations

NavTree (org.dashbuilder.navigation.NavTree)1 NavTreeBuilder (org.dashbuilder.navigation.impl.NavTreeBuilder)1 Test (org.junit.Test)1 MenuGroup (org.uberfire.workbench.model.menu.MenuGroup)1 MenuItem (org.uberfire.workbench.model.menu.MenuItem)1 Menus (org.uberfire.workbench.model.menu.Menus)1