use of org.uberfire.workbench.model.menu.MenuVisitor in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorMenusTest method checkMenuStructure.
@Test
public void checkMenuStructure() {
presenter.getMenus(menus -> {
final AtomicInteger i = new AtomicInteger(0);
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);
});
}
Aggregations