当前位置: 首页>>代码示例>>Java>>正文


Java MenuGroup类代码示例

本文整理汇总了Java中org.uberfire.workbench.model.menu.MenuGroup的典型用法代码示例。如果您正苦于以下问题:Java MenuGroup类的具体用法?Java MenuGroup怎么用?Java MenuGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MenuGroup类属于org.uberfire.workbench.model.menu包,在下文中一共展示了MenuGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testVisit3

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Test
public void testVisit3() {
    permissionManager.setAuthorizationPolicy(
            permissionManager.newAuthorizationPolicy()
                    .role("admin")
                    .permission("perspective.read.perspective1",
                                false)
                    .permission("perspective.read.perspective2",
                                false)
                    .build());

    menus.accept(authzVisitor);

    verify(menuVisitor,
           never()).visitEnter(any(MenuGroup.class));
    verify(menuVisitor,
           never()).visit(any(MenuItemPerspective.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:MenuBuilderAuthzTest.java

示例2: testVisit4

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Test
public void testVisit4() {
    Menus menus = newTopLevelMenu("Group")
            .withItems(Arrays.asList(
                    newSimpleItem("Perspective 1").withPermission("perspective.read.perspective1").endMenu().build().getItems().get(0),
                    newSimpleItem("Perspective 2").withPermission("perspective.read.perspective2").endMenu().build().getItems().get(0)
            ))
            .endMenu().build();

    permissionManager.setAuthorizationPolicy(
            permissionManager.newAuthorizationPolicy()
                    .role("admin")
                    .permission("perspective.read.perspective1",
                                false)
                    .permission("perspective.read.perspective2",
                                false)
                    .build());

    menus.accept(authzVisitor);

    verify(menuVisitor,
           never()).visitEnter(any(MenuGroup.class));
    verify(menuVisitor,
           never()).visit(any(MenuItemPerspective.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:MenuBuilderAuthzTest.java

示例3: testVisit5

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Test
public void testVisit5() {
    permissionManager.setAuthorizationPolicy(
            permissionManager.newAuthorizationPolicy()
                    .role("admin")
                    .permission("group1",
                                false)
                    .build());

    menus.accept(authzVisitor);

    verify(menuVisitor,
           never()).visitEnter(any(MenuGroup.class));
    verify(menuVisitor,
           never()).visit(any(MenuItemPerspective.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:MenuBuilderAuthzTest.java

示例4: makeItem

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
protected Widget makeItem(final MenuItem item,
                          boolean isRoot) {

    Widget[] menuWidget = new Widget[]{null};
    item.accept(new AuthFilterMenuVisitor(authzManager,
                                          identity,
                                          new BaseMenuVisitor() {

                                              @Override
                                              public boolean visitEnter(MenuGroup menuGroup) {
                                                  menuWidget[0] = makeMenuGroup(menuGroup,
                                                                                isRoot);
                                                  return false;
                                              }

                                              @Override
                                              public void visit(MenuItemCommand menuItemCommand) {
                                                  menuWidget[0] = makeMenuItemCommand(menuItemCommand,
                                                                                      isRoot);
                                              }

                                              @Override
                                              public void visit(MenuCustom<?> menuCustom) {
                                                  menuWidget[0] = makeMenuCustom(menuCustom);
                                              }
                                          }));
    return menuWidget[0];
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:29,代码来源:ListBarWidgetImpl.java

示例5: buildMenuGroup

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
protected Widget buildMenuGroup(final MenuGroup menuGroup,
                                final HasMenuItems hasMenuItems) {
    final DropDownHeader group = new DropDownHeader();
    group.setText(menuGroup.getCaption());
    hasMenuItems.addMenuItem(menuGroup.getPosition(),
                             group);
    return group;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:9,代码来源:DropdownMenuVisitor.java

示例6: synchronizeUIWithMenus

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
protected void synchronizeUIWithMenus(final List<MenuItem> menuItems) {
    for (MenuItem menuItem : ensureIterable(menuItems)) {
        if (menuItem instanceof MenuGroup) {
            synchronizeUIWithMenus(((MenuGroup) menuItem).getItems());
        } else {
            menuItem.setEnabled(menuItem.isEnabled());
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:10,代码来源:WorkbenchBaseMenuPresenter.java

示例7: visitEnter

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public boolean visitEnter(final MenuGroup menuGroup) {
    parentId = WorkbenchBaseMenuUtils.getMenuItemId(menuGroup);
    presenter.addGroupMenuItem(parentId,
                               menuGroup.getCaption(),
                               menuGroup.getPosition());
    return true;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:9,代码来源:WorkbenchMegaMenuVisitor.java

示例8: visitEnter

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public boolean visitEnter(final MenuGroup menuGroup) {
    parentId = WorkbenchBaseMenuUtils.getMenuItemId(menuGroup);
    presenter.addContextGroupMenuItem(perspectiveId,
                                      parentId,
                                      menuGroup.getCaption(),
                                      menuGroup.getPosition());
    return true;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:10,代码来源:WorkbenchMegaMenuContextMenuVisitor.java

示例9: visitEnter

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public boolean visitEnter(MenuGroup menuGroup) {
    if (!authorize(menuGroup)) {
        return false;
    }
    return chainedVisitor.visitEnter(menuGroup);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:8,代码来源:AuthFilterMenuVisitor.java

示例10: authorize

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
/**
 * Check the user is allowed to access the given menu item.
 * <p>
 * <p>If the item has any references to resource actions {@link ResourceActionRef} or custom permissions
 * then the access is granted provided all those references are also granted.</p>
 */
public boolean authorize(MenuItem item) {
    List<ResourceActionRef> actions = item.getResourceActions();
    if (actions != null && !actions.isEmpty()) {
        for (ResourceActionRef ref : ensureIterable(actions)) {
            if (!authzManager.authorize(ref.getResource(),
                                        ref.getAction(),
                                        user)) {
                return false;
            }
        }
    }
    List<String> permissions = ensureIterable(item.getPermissions());
    if (permissions != null && !permissions.isEmpty()) {
        for (String p : permissions) {
            if (!authzManager.authorize(p,
                                        user)) {
                return false;
            }
        }
    }
    // Check the item
    boolean itemResult = authzManager.authorize(item,
                                                user);
    boolean denied = false;

    // For menu groups ensure at least one child item can be accessed
    if (item instanceof MenuGroup) {
        MenuGroup group = (MenuGroup) item;
        for (MenuItem child : ensureIterable(group.getItems())) {
            if (authorize(child)) {
                return itemResult;
            } else {
                denied = true;
            }
        }
    }
    return itemResult && !denied;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:45,代码来源:AuthFilterMenuVisitor.java

示例11: testVisit

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Test
public void testVisit() {
    menus.accept(authzVisitor);

    verify(menuVisitor).visitEnter(any(MenuGroup.class));
    verify(menuVisitor,
           times(2)).visit(any(MenuItemPerspective.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:9,代码来源:MenuBuilderAuthzTest.java

示例12: testVisit2

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Test
public void testVisit2() {
    permissionManager.setAuthorizationPolicy(
            permissionManager.newAuthorizationPolicy()
                    .role("admin")
                    .permission("perspective.read.perspective1",
                                false)
                    .build());

    menus.accept(authzVisitor);

    verify(menuVisitor).visitEnter(any(MenuGroup.class));
    verify(menuVisitor,
           times(1)).visit(any(MenuItemPerspective.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:MenuBuilderAuthzTest.java

示例13: visitEnter

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public boolean visitEnter(MenuGroup menuGroup) {
    return true;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:5,代码来源:BaseMenuVisitor.java

示例14: visitEnter

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public boolean visitEnter(final MenuGroup menuGroup) {
    buildMenuGroup(menuGroup,
                   this.hasMenuItems);
    return true;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:7,代码来源:DropdownMenuVisitor.java

示例15: visitLeave

import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public void visitLeave(MenuGroup menuGroup) {
    parentId = null;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:5,代码来源:WorkbenchMegaMenuVisitor.java


注:本文中的org.uberfire.workbench.model.menu.MenuGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。