本文整理汇总了Java中org.uberfire.workbench.model.menu.MenuFactory类的典型用法代码示例。如果您正苦于以下问题:Java MenuFactory类的具体用法?Java MenuFactory怎么用?Java MenuFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuFactory类属于org.uberfire.workbench.model.menu包,在下文中一共展示了MenuFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setupMenu
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
private void setupMenu( @Observes final ApplicationReadyEvent event ) {
Menus menus =
MenuFactory.newTopLevelMenu("Data Library")
.position(MenuPosition.LEFT)
.respondsWith(new Command() {
public void execute() {
placeManager.goTo(Constants.DATA_SERVICES_LIBRARY_SCREEN);
}
})
.endMenu()
.newTopLevelMenu("Logout")
.position(MenuPosition.RIGHT)
.respondsWith(new LogoutCommand())
.endMenu()
.build();
menubar.addMenus(menus);
}
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:19,代码来源:TeiidWebUiEntryPoint.java
示例2: getRepositoriesMenuItems
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
private List<? extends MenuItem> getRepositoriesMenuItems() {
ArrayList<MenuItem> menuItems = new ArrayList<MenuItem>();
menuItems.add(MenuFactory.newSimpleItem(translationService.getTranslation(AppConstants.AdministrationPerspective_MenuListRepositories)).respondsWith(
() -> placeManager.goTo("RepositoriesEditor")).endMenu().build().getItems().get(0));
menuItems.add(MenuFactory.newSimpleItem(translationService.getTranslation(AppConstants.AdministrationPerspective_MenuCloneRepository)).respondsWith(
() -> cloneRepositoryPresenter.showForm()).endMenu().build().getItems().get(0));
menuItems.add(MenuFactory.newSimpleItem(translationService.getTranslation(AppConstants.AdministrationPerspective_MenuNewRepository)).respondsWith(
() -> {
final CreateRepositoryWizard newRepositoryWizard = createRepositoryWizardProvider.get();
//When pop-up is closed destroy bean to avoid memory leak
newRepositoryWizard.onCloseCallback(result -> createRepositoryWizardProvider.destroy(newRepositoryWizard));
newRepositoryWizard.start();
}).endMenu().build().getItems().get(0));
return menuItems;
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:17,代码来源:AdministrationPerspective.java
示例3: getMenu
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@WorkbenchMenu
public Menus getMenu() {
return MenuFactory
.newTopLevelMenu("Save")
.respondsWith(() -> Window.alert("Saved!"))
.endMenu()
.newTopLevelMenu("Delete")
.respondsWith(() -> Window.alert("Deleted!"))
.endMenu()
.newTopLevelMenu("Edit")
.menus()
.menu("Cut")
.respondsWith(() -> Window.alert("Cut!"))
.endMenu()
.menu("Paste")
.respondsWith(() -> Window.alert("Paste!"))
.endMenu()
.endMenus()
.endMenu()
.build();
}
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:TodoListScreen.java
示例4: getPerspectives
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
private List<MenuItem> getPerspectives() {
final List<MenuItem> perspectives = new ArrayList<MenuItem>();
for (final PerspectiveActivity perspective : getPerspectiveActivities()) {
final String name = perspective.getDefaultPerspectiveLayout().getName();
final Command cmd = new Command() {
@Override
public void execute() {
placeManager.goTo(new DefaultPlaceRequest(perspective.getIdentifier()));
}
};
final MenuItem item = MenuFactory.newSimpleItem(name).respondsWith(cmd).endMenu().build().getItems().get(0);
perspectives.add(item);
}
return perspectives;
}
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:ShowcaseEntryPoint.java
示例5: makeMenuBar
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
private void makeMenuBar() {
menus = MenuFactory
.newTopLevelMenu(MessageConsoleResources.CONSTANTS.ClearMessageConsole())
.respondsWith(new Command() {
@Override
public void execute() {
PublishBatchMessagesEvent batchMessages = new PublishBatchMessagesEvent();
batchMessages.setCleanExisting(true);
batchMessages.setMessagesToPublish(new ArrayList<SystemMessage>());
publishBatchMessagesEvent.fire(batchMessages);
}
})
.endMenu()
.newTopLevelCustomMenu(new RefreshMenuBuilder(this))
.endMenu()
.build();
}
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:MessageConsoleScreen.java
示例6: getMenus
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@WorkbenchMenu
public Menus getMenus() {
if (perspectiveIdentifierToGoBackTo != null) {
return MenuFactory
.newTopLevelMenu(translationService.format(Constants.AdminPagePerspective_GoBackToThePreviousPage))
.respondsWith(new Command() {
@Override
public void execute() {
placeManager.goTo(perspectiveIdentifierToGoBackTo);
}
})
.endMenu()
.build();
}
return null;
}
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:AdminPagePerspective.java
示例7: buildMenu
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@WorkbenchMenu
public Menus buildMenu() {
return MenuFactory
.newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {
@Override
public void push(MenuFactory.CustomMenuBuilder element) {
}
@Override
public MenuItem build() {
return new BaseMenuCustom<IsWidget>() {
@Override
public void accept(MenuVisitor visitor) {
visitor.visit(this);
}
@Override
public IsWidget build() {
return getNewButton();
}
};
}
}).endMenu().build();
}
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:PluginExplorerScreen.java
示例8: testAddMenus
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddMenus() {
final String perspectiveId = "perspectiveId";
final String label = "perspectiveLabel";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(authzManager,
never()).authorize(any(MenuItem.class),
any(User.class));
verify(presenter,
never()).addMenuItem(anyString(),
anyString(),
anyString(),
any(Command.class),
any(MenuPosition.class));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:WorkbenchMegaMenuStandalonePresenterTest.java
示例9: testAddPerspective
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddPerspective() {
final String perspectiveId = "perspectiveId";
final Menus menus = MenuFactory.newSimpleItem("test").perspective(perspectiveId).endMenu().build();
final PlaceRequest placeRequest = new DefaultPlaceRequest("anyId");
final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);
when(perspectiveActivity.getPlace()).thenReturn(placeRequest);
when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);
when(authzManager.authorize(any(Resource.class),
eq(identity))).thenReturn(true);
presenter.addMenus(menus);
verify(presenter,
never()).selectMenuItem(perspectiveId);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:WorkbenchMegaMenuPresenterTest.java
示例10: testPerspectiveChangeEvent
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testPerspectiveChangeEvent() {
final String perspectiveId = "perspectiveId";
final Menus menus = MenuFactory.newSimpleItem("test").perspective(perspectiveId).endMenu().build();
final PlaceRequest placeRequest = new DefaultPlaceRequest(perspectiveId);
final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);
final PerspectiveChange perspectiveChange = new PerspectiveChange(placeRequest,
null,
null,
perspectiveId);
when(perspectiveActivity.getPlace()).thenReturn(placeRequest);
when(perspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);
when(authzManager.authorize(any(Resource.class),
eq(identity))).thenReturn(true);
presenter.addMenus(menus);
presenter.onPerspectiveChange(perspectiveChange);
verify(presenter).selectMenuItem(perspectiveId);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:WorkbenchMegaMenuPresenterTest.java
示例11: testAddMenuWithPermission
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddMenuWithPermission() {
final String perspectiveId = "perspectiveId";
final String label = "perspectiveLabel";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(authzManager).authorize(menus.getItems().get(0),
identity);
verify(presenter).addMenuItem(eq(perspectiveId),
eq(label),
isNull(String.class),
any(Command.class),
any(MenuPosition.class));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:WorkbenchMegaMenuPresenterTest.java
示例12: testAddMenuWithoutPermission
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddMenuWithoutPermission() {
final String perspectiveId = "perspectiveId";
final String label = "perspectiveLabel";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(false);
presenter.addMenus(menus);
verify(authzManager).authorize(menus.getItems().get(0),
identity);
verify(presenter,
never()).addMenuItem(eq(perspectiveId),
eq(label),
isNull(String.class),
any(Command.class),
any(MenuPosition.class));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:20,代码来源:WorkbenchMegaMenuPresenterTest.java
示例13: testSetupEnableDisableMenuItemCommand
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testSetupEnableDisableMenuItemCommand() {
final String label = "command";
final Command command = mock(Command.class);
final Menus menus = MenuFactory.newSimpleItem(label).respondsWith(command).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(presenter,
times(1)).enableMenuItem(anyString(),
eq(true));
menus.getItems().get(0).setEnabled(true);
verify(presenter,
times(2)).enableMenuItem(anyString(),
eq(true));
menus.getItems().get(0).setEnabled(false);
verify(presenter,
times(1)).enableMenuItem(anyString(),
eq(false));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:WorkbenchMegaMenuPresenterTest.java
示例14: testSetupEnableDisableMenuItemPlace
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testSetupEnableDisableMenuItemPlace() {
final String label = "placeLabel";
final PlaceRequest place = mock(PlaceRequest.class);
final Menus menus = MenuFactory.newSimpleItem(label).place(place).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(presenter,
times(1)).enableMenuItem(anyString(),
eq(true));
menus.getItems().get(0).setEnabled(true);
verify(presenter,
times(2)).enableMenuItem(anyString(),
eq(true));
menus.getItems().get(0).setEnabled(false);
verify(presenter,
times(1)).enableMenuItem(anyString(),
eq(false));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:WorkbenchMegaMenuPresenterTest.java
示例15: testSetupEnableDisableMenuItemPerspective
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testSetupEnableDisableMenuItemPerspective() {
final String label = "perspectiveLabel";
final String perspectiveId = "perspectiveId";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(presenter,
times(1)).enableMenuItem(anyString(),
eq(true));
menus.getItems().get(0).setEnabled(true);
verify(presenter,
times(2)).enableMenuItem(anyString(),
eq(true));
menus.getItems().get(0).setEnabled(false);
verify(presenter,
times(1)).enableMenuItem(anyString(),
eq(false));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:WorkbenchMegaMenuPresenterTest.java
示例16: testAddMenus
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddMenus() {
final String perspectiveId = "perspectiveId";
final String label = "perspectiveLabel";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(authzManager,
never()).authorize(any(MenuItem.class),
any(User.class));
verify(view,
never()).addMenuItem(anyString(),
anyString(),
anyString(),
any(Command.class),
any(MenuPosition.class));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:WorkbenchMenuBarStandalonePresenterTest.java
示例17: testAddPerspective
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddPerspective() {
final String perspectiveId = "perspectiveId";
final Menus menus = MenuFactory.newSimpleItem("test").perspective(perspectiveId).endMenu().build();
final PlaceRequest placeRequest = new DefaultPlaceRequest("anyId");
final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);
when(perspectiveActivity.getPlace()).thenReturn(placeRequest);
when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);
when(authzManager.authorize(any(Resource.class),
eq(identity))).thenReturn(true);
presenter.addMenus(menus);
verify(view,
never()).selectMenuItem(perspectiveId);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:WorkbenchMenuBarPresenterTest.java
示例18: testPerspectiveChangeEvent
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testPerspectiveChangeEvent() {
final String perspectiveId = "perspectiveId";
final Menus menus = MenuFactory.newSimpleItem("test").perspective(perspectiveId).endMenu().build();
final PlaceRequest placeRequest = new DefaultPlaceRequest(perspectiveId);
final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);
final PerspectiveChange perspectiveChange = new PerspectiveChange(placeRequest,
null,
null,
perspectiveId);
when(perspectiveActivity.getPlace()).thenReturn(placeRequest);
when(perspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);
when(authzManager.authorize(any(Resource.class),
eq(identity))).thenReturn(true);
presenter.addMenus(menus);
presenter.onPerspectiveChange(perspectiveChange);
verify(view).selectMenuItem(perspectiveId);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:WorkbenchMenuBarPresenterTest.java
示例19: testAddMenuWithPermission
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddMenuWithPermission() {
final String perspectiveId = "perspectiveId";
final String label = "perspectiveLabel";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(authzManager).authorize(menus.getItems().get(0),
identity);
verify(view).addMenuItem(eq(perspectiveId),
eq(label),
isNull(String.class),
any(Command.class),
any(MenuPosition.class));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:WorkbenchMenuBarPresenterTest.java
示例20: testAddMenuWithoutPermission
import org.uberfire.workbench.model.menu.MenuFactory; //导入依赖的package包/类
@Test
public void testAddMenuWithoutPermission() {
final String perspectiveId = "perspectiveId";
final String label = "perspectiveLabel";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(false);
presenter.addMenus(menus);
verify(authzManager).authorize(menus.getItems().get(0),
identity);
verify(view,
never()).addMenuItem(eq(perspectiveId),
eq(label),
isNull(String.class),
any(Command.class),
any(MenuPosition.class));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:20,代码来源:WorkbenchMenuBarPresenterTest.java
注:本文中的org.uberfire.workbench.model.menu.MenuFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论