use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DiagramEditorMenuSessionItemsTest method testIsEnabledWithUnknownMenuItem.
@Test
public void testIsEnabledWithUnknownMenuItem() {
final MenuItem menuItem = mock(MenuItem.class);
when(itemsBuilder.newClearItem(Mockito.<Command>any())).thenReturn(menuItem);
editorMenuSessionItems.populateMenu(fileMenuBuilder);
try {
assertFalse(editorMenuSessionItems.isItemEnabled(ClearSessionCommand.class));
} catch (Exception e) {
fail(e);
}
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class AbstractProcessProjectEditorMenuSessionItems method newFormsGenerationMenuItem.
private MenuItem newFormsGenerationMenuItem(final Command generateProcessForm, final Command generateAllForms, final Command generateSelectedForms) {
final DropDownMenu menu = new DropDownMenu() {
{
setPull(Pull.RIGHT);
}
};
menu.add(createAnchorListItem(getEditorGenerateProcessFormPropertyKey(), event -> generateProcessForm.execute()));
menu.add(createAnchorListItem(getEditorGenerateAllFormsPropertyKey(), event -> generateAllForms.execute()));
menu.add(createAnchorListItem(getEditorGenerateSelectionFormsPropertyKey(), event -> generateSelectedForms.execute()));
final Button button = createButton(getEditorFormGenerationTitlePropertyKey());
final IsWidget group = MenuUtils.buildHasEnabledWidget(new ButtonGroup() {
{
add(button);
add(menu);
}
}, button);
return MenuUtils.buildItem(group);
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class KieEditorTest method testAddCommonActions.
@Test
public void testAddCommonActions() {
final Command onValidate = mock(Command.class);
final MenuItem buildMenu = mock(MenuItem.class);
final MenuItem build = mock(MenuItem.class);
doReturn(onValidate).when(presenter).getValidateCommand();
doReturn(buildMenu).when(versionRecordManager).buildMenu();
doReturn(build).when(alertsButtonMenuItemBuilder).build();
presenter.addCommonActions(fileMenuBuilder);
verify(fileMenuBuilder).addValidate(onValidate);
verify(fileMenuBuilder).addNewTopLevelMenu(buildMenu);
verify(fileMenuBuilder).addNewTopLevelMenu(build);
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method testEnable.
@Test
public void testEnable() {
final MenuItem mi = builder.build();
mi.setEnabled(true);
verify(view, times(1)).setEnabled(eq(true));
}
Aggregations