Search in sources :

Example 1 with MenuCustom

use of org.uberfire.workbench.model.menu.MenuCustom in project drools-wb by kiegroup.

the class GuidedDecisionTableEditorMenusTest method checkMenuStructure.

@Test
public void checkMenuStructure() {
    final AtomicInteger i = new AtomicInteger(0);
    final Menus menus = presenter.getMenus();
    final MenuVisitor visitor = new MenuVisitor() {

        @Override
        public boolean visitEnter(final Menus menus) {
            return true;
        }

        @Override
        public void visitLeave(final Menus menus) {
        }

        @Override
        public boolean visitEnter(final MenuGroup menuGroup) {
            assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuGroup.getIdentifier());
            return true;
        }

        @Override
        public void visitLeave(final MenuGroup menuGroup) {
        }

        @Override
        public void visit(final MenuItemPlain menuItemPlain) {
            assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuItemPlain.getIdentifier());
        }

        @Override
        public void visit(final MenuItemCommand menuItemCommand) {
            assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuItemCommand.getIdentifier());
        }

        @Override
        public void visit(final MenuItemPerspective menuItemPerspective) {
            assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuItemPerspective.getIdentifier());
        }

        @Override
        public void visit(final MenuCustom<?> menuCustom) {
            assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuCustom.getIdentifier());
        }
    };
    menus.accept(visitor);
}
Also used : MenuVisitor(org.uberfire.workbench.model.menu.MenuVisitor) MenuItemCommand(org.uberfire.workbench.model.menu.MenuItemCommand) MenuItemPerspective(org.uberfire.workbench.model.menu.MenuItemPerspective) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Menus(org.uberfire.workbench.model.menu.Menus) MenuItemPlain(org.uberfire.workbench.model.menu.MenuItemPlain) MenuCustom(org.uberfire.workbench.model.menu.MenuCustom) MenuGroup(org.uberfire.workbench.model.menu.MenuGroup) Test(org.junit.Test)

Aggregations

AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Test (org.junit.Test)1 MenuCustom (org.uberfire.workbench.model.menu.MenuCustom)1 MenuGroup (org.uberfire.workbench.model.menu.MenuGroup)1 MenuItemCommand (org.uberfire.workbench.model.menu.MenuItemCommand)1 MenuItemPerspective (org.uberfire.workbench.model.menu.MenuItemPerspective)1 MenuItemPlain (org.uberfire.workbench.model.menu.MenuItemPlain)1 MenuVisitor (org.uberfire.workbench.model.menu.MenuVisitor)1 Menus (org.uberfire.workbench.model.menu.Menus)1