org.uberfire.workbench.model.menu.MenuItem.setEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.uberfire.workbench.model.menu.MenuItem.setEnabled()方法的一些代码示例,展示了MenuItem.setEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.setEnabled()方法的具体详情如下:
包路径:org.uberfire.workbench.model.menu.MenuItem
类名称:MenuItem
方法名:setEnabled

暂无

代码示例

代码示例来源:origin: org.uberfire/uberfire-wires-core-trees

@Override
  public void execute() {
    menus.getItems().get(3).setEnabled(true);
    menus.getItems().get(4).setEnabled(false);
  }
});

代码示例来源:origin: kiegroup/appformer

@Override
  public void execute() {
    menus.getItems().get(3).setEnabled(false);
    menus.getItems().get(4).setEnabled(true);
  }
});

代码示例来源:origin: org.kie.uberfire/kie-uberfire-wires-core-trees

@Override
  public void execute() {
    menus.getItems().get( 3 ).setEnabled( true );
    menus.getItems().get( 4 ).setEnabled( false );
  }
} );

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

@Override
protected void enableMenus(final boolean enabled) {
  super.enableMenus(enabled);
  getEditMenuItem().setEnabled(enabled);
  getViewMenuItem().setEnabled(enabled);
  getInsertMenuItem().setEnabled(enabled);
  getRadarMenuItem().setEnabled(enabled);
}

代码示例来源:origin: kiegroup/appformer

@Override
  public void execute() {
    if (isShapeSelected()) {
      clearSelection();
      menus.getItems().get(1).setEnabled(false);
      menus.getItems().get(2).setEnabled(false);
      menus.getItems().get(3).setEnabled(false);
      menus.getItems().get(4).setEnabled(false);
    }
  }
})

代码示例来源:origin: org.uberfire/uberfire-wires-core-trees

@Override
  public void execute() {
    if (isShapeSelected()) {
      clearSelection();
      menus.getItems().get(1).setEnabled(false);
      menus.getItems().get(2).setEnabled(false);
      menus.getItems().get(3).setEnabled(false);
      menus.getItems().get(4).setEnabled(false);
    }
  }
})

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

private void disableMenuItems() {
  miCut.getMenuItem().setEnabled(false);
  miCopy.getMenuItem().setEnabled(false);
  miPaste.getMenuItem().setEnabled(false);
  miDeleteSelectedCells.getMenuItem().setEnabled(false);
  miDeleteSelectedColumns.getMenuItem().setEnabled(false);
  miDeleteSelectedRows.getMenuItem().setEnabled(false);
  miOtherwiseCell.getMenuItem().setEnabled(false);
  popoverUtils.enableOtherwisePopover(miOtherwiseCell.getMenuItemView().getElement(),
                    false);
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-metadata-widget

/**
 * Enable/disable a single menu associated with the MDI container.
 * @param enabled
 */
protected void enableMenuItem(final boolean enabled,
               final MenuItems menuItem) {
  if (menus.getItemsMap().containsKey(menuItem)) {
    menus.getItemsMap().get(menuItem).setEnabled(enabled);
  }
}

代码示例来源:origin: kiegroup/appformer

@Override
public void deselectShape(final WiresBaseShape shape) {
  super.deselectShape(shape);
  menus.getItems().get(1).setEnabled(isShapeSelected());
  menus.getItems().get(2).setEnabled(isShapeSelected());
  menus.getItems().get(3).setEnabled(isShapeSelected());
  menus.getItems().get(4).setEnabled(isShapeSelected());
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-metadata-widget

public void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event) {
  Optional.ofNullable(workbenchContext)
      .flatMap(context -> context.getActiveWorkspaceProject())
      .filter(proj -> event.getRepository() != null && proj.getRepository().equals(event.getRepository()))
      .ifPresent(proj -> {
        for (MenuItem mi : menus.getItemsMap().values()) {
          mi.setEnabled(false);
        }
      });
}

代码示例来源:origin: kiegroup/drools-wb

@Override
protected void enableMenus(final boolean enabled) {
  super.enableMenus(enabled);
  getRegisteredDocumentsMenuItem().setEnabled(enabled);
}

代码示例来源:origin: org.kie.uberfire/kie-uberfire-wires-core-trees

public void onShapeSelected( @Observes ShapeSelectedEvent event ) {
  final WiresBaseShape shape = event.getShape();
  super.selectShape( shape );
  menus.getItems().get( 1 ).setEnabled( isShapeSelected() );
  menus.getItems().get( 2 ).setEnabled( isShapeSelected() );
  menus.getItems().get( 3 ).setEnabled( nodeHasChildren( shape ) && !nodeHasCollapsedChildren( shape ) );
  menus.getItems().get( 4 ).setEnabled( nodeHasCollapsedChildren( shape ) );
}

代码示例来源:origin: org.uberfire/uberfire-wires-core-trees

public void onShapeDeleted(@Observes ShapeDeletedEvent event) {
  if (root != null && root.equals(event.getShape())) {
    root = null;
  }
  super.deleteShape(event.getShape());
  menus.getItems().get(0).setEnabled(getShapesInCanvas().size() > 0);
  menus.getItems().get(1).setEnabled(isShapeSelected());
  menus.getItems().get(2).setEnabled(isShapeSelected());
  menus.getItems().get(3).setEnabled(isShapeSelected());
  menus.getItems().get(4).setEnabled(isShapeSelected());
}

代码示例来源:origin: org.uberfire/uberfire-wires-core-scratchpad

public void onShapeSelected(@Observes ShapeSelectedEvent event) {
  super.selectShape(event.getShape());
  menus.getItems().get(1).setEnabled(isShapeSelected());
  menus.getItems().get(2).setEnabled(isShapeSelected());
}

代码示例来源:origin: org.uberfire/uberfire-commons-editor-client

private void setEnableMenuItem(final MenuItems menuItem,
                final boolean isEnabled) {
  if (menus().getItemsMap().containsKey(menuItem)) {
    menus().getItemsMap().get(menuItem).setEnabled(isEnabled);
  }
}

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

@Override
public void initialise() {
  if (activeDecisionTable == null || !activeDecisionTable.getAccess().isEditable()) {
    miToggleMergeState.getMenuItem().setEnabled(false);
    miToggleMergeState.getMenuItemView().setIconType(null);
    miViewAuditLog.getMenuItem().setEnabled(false);
  } else {
    miToggleMergeState.getMenuItem().setEnabled(true);
    miToggleMergeState.getMenuItemView().setIconType(activeDecisionTable.isMerged() ? IconType.CHECK : null);
    miViewAuditLog.getMenuItem().setEnabled(true);
  }
}

代码示例来源:origin: kiegroup/appformer

@Test
public void testEnableMenuItem() {
  final Menus menus = mock(Menus.class);
  final MenuItem menuItem = mock(MenuItem.class);
  final Map<Object, MenuItem> itemMap = new HashMap<>();
  itemMap.put(SAVE, menuItem);
  when(menus.getItemsMap()).thenReturn(itemMap);
  doReturn(menus).when(editor).menus();
  editor.enableMenuItem(SAVE);
  verify(menuItem).setEnabled(true);
}

代码示例来源:origin: org.uberfire/uberfire-commons-editor-client

@Test
public void testDisableMenuItem() {
  final Menus menus = mock(Menus.class);
  final MenuItem menuItem = mock(MenuItem.class);
  final Map<Object, MenuItem> itemMap = new HashMap<>();
  itemMap.put(SAVE, menuItem);
  when(menus.getItemsMap()).thenReturn(itemMap);
  doReturn(menus).when(editor).menus();
  editor.disableMenuItem(SAVE);
  verify(menuItem).setEnabled(false);
}

代码示例来源:origin: org.uberfire/uberfire-workbench-client

@Test
public void testSetupEnableDisableMenuItemPerspective() {
  final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();
  when(authzManager.authorize(menus.getItems().get(0),
                identity)).thenReturn(true);
  presenter.addMenus(menus);
  verify(view).enableMenuItem(anyString(), eq(true));
  menus.getItems().get(0).setEnabled(true);
  verify(view, times(2)).enableMenuItem(anyString(), eq(true));
  menus.getItems().get(0).setEnabled(false);
  verify(view).enableMenuItem(anyString(), eq(false));
}

代码示例来源:origin: kiegroup/appformer

@Test
public void checkMenuItemWithIconEnabled() {
  final Command c = mock(Command.class);
  final MenuItemViewHolder<MenuItemWithIconView> mih = menuItemFactory.makeMenuItemWithIcon("caption",
                                               c);
  mih.getMenuItem().setEnabled(true);
  verify(mih.getMenuItemView(),
      times(1)).setEnabled(eq(true));
  mih.getMenuItemView().onClickListItem(mock(ClickEvent.class));
  verify(c,
      times(1)).execute();
}

相关文章