本文整理汇总了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));
}
示例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));
}
示例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));
}
示例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];
}
示例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;
}
示例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());
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例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));
}
示例13: visitEnter
import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public boolean visitEnter(MenuGroup menuGroup) {
return true;
}
示例14: visitEnter
import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public boolean visitEnter(final MenuGroup menuGroup) {
buildMenuGroup(menuGroup,
this.hasMenuItems);
return true;
}
示例15: visitLeave
import org.uberfire.workbench.model.menu.MenuGroup; //导入依赖的package包/类
@Override
public void visitLeave(MenuGroup menuGroup) {
parentId = null;
}