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

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

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

暂无

代码示例

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

private void assertMenuItemEnabled(final MenuItem menuItem,
                  final boolean enabled) {
  assertEquals(enabled,
         menuItem.isEnabled());
}

代码示例来源: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: kiegroup/appformer

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: 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();
}

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

@Test
public void testOnDecisionTableSelectionsChangedEventWithNoSelections() {
  builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
  assertFalse(builder.miCut.getMenuItem().isEnabled());
  assertFalse(builder.miCopy.getMenuItem().isEnabled());
  assertFalse(builder.miPaste.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedCells.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedColumns.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedRows.getMenuItem().isEnabled());
  assertFalse(builder.miOtherwiseCell.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectionsChangedEventWithNoSelectionsAndItDoesNotHaveEditableColumns() {
  when(dtPresenter.hasEditableColumns()).thenReturn(false);
  builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
  assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventWithNoSelections() {
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertFalse(builder.miCut.getMenuItem().isEnabled());
  assertFalse(builder.miCopy.getMenuItem().isEnabled());
  assertFalse(builder.miPaste.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedCells.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedColumns.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedRows.getMenuItem().isEnabled());
  assertFalse(builder.miOtherwiseCell.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventNoTableSelected() {
  //ViewMenuBuilder.setup() called in @Setup disables view by default
  assertFalse(builder.miToggleMergeState.getMenuItem().isEnabled());
  assertFalse(builder.miViewAuditLog.getMenuItem().isEnabled());
  builder.onDecisionTableSelectedEvent(DecisionTableSelectedEvent.NONE);
  //Verify clearing Decision Table selection disables view
  assertFalse(builder.miToggleMergeState.getMenuItem().isEnabled());
  assertFalse(builder.miViewAuditLog.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventWithNoSelectionsAndItDoesNotHaveEditableColumns() {
  when(dtPresenter.hasEditableColumns()).thenReturn(false);
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventReadOnly() {
  dtPresenter.getAccess().setReadOnly(true);
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertFalse(builder.miCut.getMenuItem().isEnabled());
  assertFalse(builder.miCopy.getMenuItem().isEnabled());
  assertFalse(builder.miPaste.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedCells.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedColumns.getMenuItem().isEnabled());
  assertFalse(builder.miDeleteSelectedRows.getMenuItem().isEnabled());
  assertFalse(builder.miOtherwiseCell.getMenuItem().isEnabled());
}

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

@Test
public void testEnableZoom_Pinned() {
  builder.onDecisionTablePinnedEvent(new DecisionTablePinnedEvent(modeller,
                                  true));
  assertFalse(builder.miZoom125pct.getMenuItem().isEnabled());
  assertFalse(builder.miZoom100pct.getMenuItem().isEnabled());
  assertFalse(builder.miZoom75pct.getMenuItem().isEnabled());
  assertFalse(builder.miZoom50pct.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventWithNoSelectionsAndItHasEditableColumns() {
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertTrue(builder.miInsertColumn.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventReadOnly() {
  dtPresenter.getAccess().setReadOnly(true);
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertFalse(builder.miAppendRow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventWithSingleRowSelectedAndItDoesNotHaveEditableColumns() {
  when(dtPresenter.hasEditableColumns()).thenReturn(false);
  model.getConditions().add(makePattern52());
  model.getData().add(makeDTCellValue52List());
  uiModel.selectCell(0, 2);
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
  assertTrue(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertTrue(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectionsChangedEventWithSingleRowSelectedAndItDoesNotHaveEditableColumns() {
  when(dtPresenter.hasEditableColumns()).thenReturn(false);
  model.getConditions().add(makePattern52());
  model.getData().add(makeDTCellValue52List());
  uiModel.selectCell(0, 2);
  builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
  assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
  assertTrue(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertTrue(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventReadOnly() {
  //ViewMenuBuilder.setup() called in @Setup disables view by default
  assertFalse(builder.miToggleMergeState.getMenuItem().isEnabled());
  assertFalse(builder.miViewAuditLog.getMenuItem().isEnabled());
  dtPresenter.getAccess().setReadOnly(true);
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  //Verify selecting a read-only Decision Table also disables view
  assertFalse(builder.miToggleMergeState.getMenuItem().isEnabled());
  assertFalse(builder.miViewAuditLog.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectionsChangedEventWithMultipleRowsSelectedAndItHasEditableColumns() {
  model.getConditions().add(makePattern52());
  model.getData().add(makeDTCellValue52List());
  model.getData().add(makeDTCellValue52List());
  uiModel.selectCells(0, 2, 1, 2);
  builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
  assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertTrue(builder.miInsertColumn.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventWithNonOtherwiseColumnSelected() {
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertTrue(builder.miToggleMergeState.getMenuItem().isEnabled());
  assertTrue(builder.miViewAuditLog.getMenuItem().isEnabled());
}

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

@Test
public void testOnDecisionTableSelectedEventWithMultipleRowsSelectedAndItHasEditableColumns() {
  model.getConditions().add(makePattern52());
  model.getData().add(makeDTCellValue52List());
  model.getData().add(makeDTCellValue52List());
  uiModel.selectCells(0, 2, 1, 2);
  builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
  assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
  assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
  assertTrue(builder.miInsertColumn.getMenuItem().isEnabled());
}

相关文章