本文整理了Java中org.uberfire.workbench.model.menu.MenuItem
类的一些代码示例,展示了MenuItem
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem
类的具体详情如下:
包路径:org.uberfire.workbench.model.menu.MenuItem
类名称:MenuItem
[英]Meta-data for a Workbench MenuItem including permissions. The default is that all users have permission to access a MenuItem and that it is enabled.
[中]工作台菜单项的元数据,包括权限。默认情况下,所有用户都有访问菜单项的权限,并且该菜单项已启用。
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-project-client
public void setItemEnabled(final Class<? extends ClientSessionCommand> type,
final boolean enabled) {
if (menuItems.containsKey(type)) {
menuItems.get(type).setEnabled(enabled);
}
}
代码示例来源:origin: kiegroup/appformer
/**
* Sets up the enabled/disabled state of the view widget, and installs a listener on the model to keep the
* widget's enabled state in sync with it.
* @param model the description of the menu item to get the current enabled state from, and to subscibe to for
* future changes.
* @param view the widget that provides a view of the given model.
*/
protected void setupEnableDisable(final MenuItem model,
final AnchorListItem view) {
view.setEnabled(model.isEnabled());
model.addEnabledStateChangeListener(new EnabledStateChangeListener() {
@Override
public void enabledStateChanged(final boolean enabled) {
view.setEnabled(enabled);
}
});
}
}
代码示例来源:origin: org.kie.workbench.widgets/kie-wb-common-ui
@Override
public int compare( final MenuItem o1,
final MenuItem o2 ) {
return o1.getCaption().compareToIgnoreCase( o2.getCaption() );
}
} );
代码示例来源:origin: kiegroup/appformer
public static String getMenuItemId(final MenuItem menuItem) {
return menuItem.getIdentifier() == null ? menuItem.getCaption() : menuItem.getIdentifier();
}
}
代码示例来源:origin: org.uberfire/uberfire-workbench-client-views-bs2
Widget makeNavLink( final MenuItem item ) {
final NavLink gwtItem = new NavLink( item.getCaption() ) {{
setDisabled( !item.isEnabled() );
}};
item.addEnabledStateChangeListener( new EnabledStateChangeListener() {
@Override
public void enabledStateChanged( final boolean enabled ) {
gwtItem.setDisabled( !enabled );
}
} );
return gwtItem;
}
代码示例来源:origin: org.uberfire/uberfire-commons-editor-client
private void assertMenuItemEnabled(final MenuItem menuItem,
final boolean enabled) {
assertEquals(enabled,
menuItem.isEnabled());
}
代码示例来源:origin: kiegroup/appformer
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());
}
}
}
代码示例来源:origin: kiegroup/drools-wb
private boolean getMenuState(final Menus menus,
final MenuItems menuItem) {
return menus.getItems().stream().filter(m -> m.getIdentifier() != null).filter(m -> m.getCaption().toLowerCase().equals(menuItem.name().toLowerCase())).findFirst().get().isEnabled();
}
代码示例来源:origin: org.uberfire/uberfire-api
assertThat(menus.getItems().get(0)).isNotNull();
assertThat(menus.getItems().get(0)).isInstanceOf(MenuGroup.class);
assertThat(menus.getItems().get(0).getPosition()).isEqualTo(MenuPosition.RIGHT);
assertThat(menus.getItems().get(0).getCaption()).isEqualTo("File");
assertThat(((MenuGroup) menus.getItems().get(0)).getItems()).hasSize(2);
assertThat(menuItem.getCaption()).isEqualTo("Save");
assertThat(menuItem.getOrder()).isEqualTo(2);
assertThat(menuItem.getCaption()).isEqualTo("Close");
代码示例来源:origin: kiegroup/appformer
protected AnchorListItem createListItem(final MenuItem menuItem,
final HasMenuItems hasMenuItems) {
final AnchorListItem option = GWT.create(AnchorListItem.class);
option.setText(menuItem.getCaption());
setupEnableDisable(menuItem,
option);
hasMenuItems.addMenuItem(menuItem.getPosition(),
option);
return option;
}
代码示例来源:origin: kiegroup/appformer
@Override
public void accept(MenuVisitor visitor) {
if (visitor.visitEnter(this)) {
for (final MenuItem item : menuItems.values()) {
item.accept(visitor);
}
visitor.visitLeave(this);
}
}
代码示例来源:origin: kiegroup/appformer
private void setupEnableDisableContextMenuItem(final MenuItem menuItem) {
menuItem.addEnabledStateChangeListener(new EnabledStateChangeListener() {
@Override
public void enabledStateChanged(final boolean enabled) {
view.enableContextMenuItem(getMenuItemId(menuItem),
enabled);
}
});
}
}));
代码示例来源:origin: kiegroup/appformer
private void assertMenuItemEnabled(final MenuItem menuItem,
final boolean enabled) {
assertEquals(enabled,
menuItem.isEnabled());
}
代码示例来源:origin: kiegroup/appformer
assertThat(menus.getItems().get(0)).isNotNull();
assertThat(menus.getItems().get(0)).isInstanceOf(MenuGroup.class);
assertThat(menus.getItems().get(0).getPosition()).isEqualTo(MenuPosition.RIGHT);
assertThat(menus.getItems().get(0).getCaption()).isEqualTo("File");
assertThat(((MenuGroup) menus.getItems().get(0)).getItems()).hasSize(2);
assertThat(menuItem.getCaption()).isEqualTo("Save");
assertThat(menuItem.getOrder()).isEqualTo(2);
assertThat(menuItem.getCaption()).isEqualTo("Close");
代码示例来源:origin: org.uberfire/uberfire-workbench-client-views-patternfly
protected AnchorListItem createListItem(final MenuItem menuItem,
final HasMenuItems hasMenuItems) {
final AnchorListItem option = GWT.create(AnchorListItem.class);
option.setText(menuItem.getCaption());
setupEnableDisable(menuItem,
option);
hasMenuItems.addMenuItem(menuItem.getPosition(),
option);
return option;
}
代码示例来源:origin: kiegroup/appformer
private String getMenuItemId(final MenuItem menuItem) {
return menuItem.getIdentifier() == null ? menuItem.getCaption() : menuItem.getIdentifier();
}
代码示例来源:origin: org.uberfire/uberfire-workbench-client-views-patternfly
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];
}
代码示例来源:origin: kiegroup/appformer
private void setupEnableDisableMenuItem(final MenuItem menuItem) {
menuItem.addEnabledStateChangeListener(new EnabledStateChangeListener() {
@Override
public void enabledStateChanged(final boolean enabled) {
view.enableMenuItem(getMenuItemId(menuItem),
enabled);
}
});
}
}));
代码示例来源:origin: org.uberfire/uberfire-wires-core-trees
@Override
public void execute() {
menus.getItems().get(3).setEnabled(true);
menus.getItems().get(4).setEnabled(false);
}
});
代码示例来源:origin: org.uberfire/uberfire-asset-mgmt-client
public void init(final HasModel<RepositoryStructureModel> hasModel) {
configure = MenuFactory
.newTopLevelMenu(Constants.INSTANCE.Configure())
.withPermission(RepositoryFeatures.CONFIGURE_REPOSITORY)
.respondsWith(getConfigureCommand(hasModel))
.endMenu()
.build().getItems().get(0);
items.add(configure);
MenuItem item;
item = getItem(MenuItems.CONFIGURE_MENU_ITEM);
configureIsGranted = item != null && item.isEnabled();
}
内容来源于网络,如有侵权,请联系作者删除!