use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class MenuDevCommandsBuilder method buildDevMenuItem.
private MenuItem buildDevMenuItem() {
final DropDownMenu menu = new DropDownMenu() {
{
addStyleName("pull-right");
}
};
for (final MenuDevCommand command : devCommands) {
menu.add(new AnchorListItem(command.getText()) {
{
setIcon(command.getIcon());
addClickHandler(event -> command.execute());
}
});
}
final IsWidget group = new ButtonGroup() {
{
add(new Button() {
{
setToggleCaret(false);
setDataToggle(Toggle.DROPDOWN);
setIcon(IconType.COG);
setSize(ButtonSize.SMALL);
setTitle("Development");
}
});
add(menu);
}
};
return MenuUtils.buildItem(group);
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DMNEditorMenuSessionItems method addPerformAutomaticLayout.
void addPerformAutomaticLayout(final FileMenuBuilder menu) {
final MenuItem performAutomaticLayoutMenuItem = newPerformAutomaticLayout();
addMenuItem(DMNPerformAutomaticLayoutCommand.class, performAutomaticLayoutMenuItem);
menu.addNewTopLevelMenu(performAutomaticLayoutMenuItem);
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DMNEditorMenuSessionItemsValidateTest method setUp.
@Before
public void setUp() {
menuItems = new DMNEditorMenuSessionItems(builder, sessionCommands, placeManager) {
@Override
MenuItem newPerformAutomaticLayout() {
return mock(MenuItem.class);
}
};
final FileMenuBuilder fileMenuBuilder = mock(FileMenuBuilder.class);
doReturn(fileMenuBuilder).when(fileMenuBuilder).addNewTopLevelMenu(any());
menuItems.populateMenu(fileMenuBuilder);
verify(builder).newValidateItem(validateItemArgumentCaptor.capture());
doReturn(validateSessionCommand).when(sessionCommands).getValidateSessionCommand();
validateItemArgumentCaptor.getValue().execute();
verify(validateSessionCommand).execute(violationsArgumentCapture.capture());
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DMNDiagramEditorTest method testOnDataTypeEditModeToggleWhenEditModeIsNotEnabled.
@Test
@SuppressWarnings("unchecked")
public void testOnDataTypeEditModeToggleWhenEditModeIsNotEnabled() {
final DataTypeEditModeToggleEvent event = mock(DataTypeEditModeToggleEvent.class);
final MenuItem menuItem = mock(MenuItem.class);
final Menus menus = mock(Menus.class);
final List<MenuItem> items = singletonList(menuItem);
when(menus.getItems()).thenReturn(items);
when(event.isEditModeEnabled()).thenReturn(false);
doAnswer(invocationOnMock -> {
invocationOnMock.getArgument(0, Consumer.class).accept(menus);
return null;
}).when(editor).getMenu(any());
editor.onDataTypeEditModeToggle(event);
verify(menuItem).setEnabled(true);
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DMNDiagramEditorTest method testOnDataTypeEditModeToggleWhenEditModeIsEnabled.
@Test
@SuppressWarnings("unchecked")
public void testOnDataTypeEditModeToggleWhenEditModeIsEnabled() {
final DataTypeEditModeToggleEvent event = mock(DataTypeEditModeToggleEvent.class);
final MenuItem menuItem = mock(MenuItem.class);
final Menus menus = mock(Menus.class);
final List<MenuItem> items = singletonList(menuItem);
when(menus.getItems()).thenReturn(items);
when(event.isEditModeEnabled()).thenReturn(true);
doAnswer(invocationOnMock -> {
invocationOnMock.getArgument(0, Consumer.class).accept(menus);
return null;
}).when(editor).getMenu(any());
editor.onDataTypeEditModeToggle(event);
verify(menuItem).setEnabled(false);
}
Aggregations