use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class NewResourcesMenu method addMenuItem.
private void addMenuItem(final NewResourceHandler newResourceHandler) {
if (newResourceHandler.canCreate()) {
final MenuItem menuItem = getMenuItem(newResourceHandler);
newResourceHandlers.put(newResourceHandler, menuItem);
if (isProjectMenuItem(newResourceHandler)) {
this.projectMenuItem = menuItem;
} else {
items.add(menuItem);
}
}
}
use of org.uberfire.workbench.model.menu.MenuItem in project drools-wb by kiegroup.
the class DecisionTableXLSEditorPresenter method getConvertMenu.
protected MenuItem getConvertMenu() {
return new MenuFactory.CustomMenuBuilder() {
private Button button = new Button(DecisionTableXLSEditorConstants.INSTANCE.Convert()) {
{
setSize(ButtonSize.SMALL);
addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
convert();
}
});
}
};
@Override
public void push(MenuFactory.CustomMenuBuilder element) {
// Nothing to do. We don't support nested menus
}
@Override
public MenuItem build() {
return new BaseMenuCustom<IsWidget>() {
@Override
public IsWidget build() {
return button;
}
@Override
public boolean isEnabled() {
return button.isEnabled();
}
@Override
public void setEnabled(boolean enabled) {
button.setEnabled(enabled);
}
};
}
}.build();
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class BPMNDiagramEditorMenuItemsBuilder method newFormsGenerationMenuItem.
public MenuItem newFormsGenerationMenuItem(final Command generateProcessForm, final Command generateAllForms, final Command generateSelectedForms) {
final DropDownMenu menu = new DropDownMenu() {
{
setPull(Pull.RIGHT);
}
};
menu.add(new AnchorListItem(translationService.getValue(BPMNClientConstants.EditorGenerateProcessForm)) {
{
setIcon(IconType.LIST_ALT);
setIconPosition(IconPosition.LEFT);
setTitle(translationService.getValue(BPMNClientConstants.EditorGenerateProcessForm));
addClickHandler(event -> generateProcessForm.execute());
}
});
menu.add(new AnchorListItem(translationService.getValue(BPMNClientConstants.EditorGenerateAllForms)) {
{
setIcon(IconType.LIST_ALT);
setIconPosition(IconPosition.LEFT);
setTitle(translationService.getValue(BPMNClientConstants.EditorGenerateAllForms));
addClickHandler(event -> generateAllForms.execute());
}
});
menu.add(new AnchorListItem(translationService.getValue(BPMNClientConstants.EditorGenerateSelectionForms)) {
{
setIcon(IconType.LIST_ALT);
setIconPosition(IconPosition.LEFT);
setTitle(translationService.getValue(BPMNClientConstants.EditorGenerateSelectionForms));
addClickHandler(event -> generateSelectedForms.execute());
}
});
final IsWidget group = new ButtonGroup() {
{
add(new Button() {
{
setToggleCaret(true);
setDataToggle(Toggle.DROPDOWN);
setIcon(IconType.LIST_ALT);
setSize(ButtonSize.SMALL);
setTitle(translationService.getValue(BPMNClientConstants.EditorFormGenerationTitle));
}
});
add(menu);
}
};
return MenuUtils.buildItem(group);
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class ProjectDiagramEditorMenuItemsBuilder method newExportsItem.
public MenuItem newExportsItem(final Command exportPNGCommand, final Command exportJPGCommand, final Command exportPDFCommand, final Command exportBPMNCommand) {
final DropDownMenu menu = new DropDownMenu() {
{
setPull(Pull.RIGHT);
}
};
menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_PNG)) {
{
setIcon(IconType.FILE_IMAGE_O);
setIconPosition(IconPosition.LEFT);
setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_PNG));
addClickHandler(event -> exportPNGCommand.execute());
}
});
menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_JPG)) {
{
setIcon(IconType.FILE_IMAGE_O);
setIconPosition(IconPosition.LEFT);
setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_JPG));
addClickHandler(event -> exportJPGCommand.execute());
}
});
menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_PDF)) {
{
setIcon(IconType.FILE_PDF_O);
setIconPosition(IconPosition.LEFT);
setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_PDF));
addClickHandler(event -> exportPDFCommand.execute());
}
});
menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_BPMN)) {
{
setIcon(IconType.FILE_TEXT_O);
setIconPosition(IconPosition.LEFT);
setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_BPMN));
addClickHandler(event -> exportBPMNCommand.execute());
}
});
final IsWidget group = new ButtonGroup() {
{
add(new Button() {
{
setToggleCaret(true);
setDataToggle(Toggle.DROPDOWN);
setIcon(IconType.DOWNLOAD);
setSize(ButtonSize.SMALL);
setTitle(translationService.getValue(StunnerProjectClientConstants.DOWNLOAD_DIAGRAM));
}
});
add(menu);
}
};
return buildItem(group);
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DMNEditorMenuSessionItemsTest method testPopulateMenu.
@Test
public void testPopulateMenu() {
final DMNEditorMenuSessionItems menuItems = spy(new DMNEditorMenuSessionItems(builder, sessionCommands, placeManager));
final MenuItem menuItem = mock(MenuItem.class);
doNothing().when(menuItems).superPopulateMenu(any());
doReturn(menuItem).when(menuItems).newPerformAutomaticLayout();
menuItems.populateMenu(fileMenuBuilder);
verify(menuItems).addPerformAutomaticLayout(any());
}
Aggregations