use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class ExplorerMenuViewImpl method asMenu.
@Override
public Menus asMenu() {
return MenuFactory.newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {
@Override
public void push(MenuFactory.CustomMenuBuilder element) {
}
@Override
public MenuItem build() {
return new BaseMenuCustom() {
@Override
public Widget build() {
return new ButtonGroup() {
{
add(new Button() {
{
setToggleCaret(false);
setDataToggle(Toggle.DROPDOWN);
setIcon(IconType.COG);
setSize(ButtonSize.SMALL);
setTitle(ProjectExplorerConstants.INSTANCE.customizeView());
}
});
add(new DropDownMenu() {
{
addStyleName("pull-right");
add(businessView);
add(techView);
add(new Divider());
add(breadcrumbExplorer);
add(treeExplorer);
add(new Divider());
add(showTagFilter);
add(new Divider());
add(archiveProject);
}
});
}
};
}
};
}
}).endMenu().newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {
@Override
public void push(MenuFactory.CustomMenuBuilder element) {
}
@Override
public MenuItem build() {
return new BaseMenuCustom() {
@Override
public Widget build() {
return new Button() {
{
setIcon(IconType.REFRESH);
setSize(ButtonSize.SMALL);
setTitle(ProjectExplorerConstants.INSTANCE.refresh());
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.onRefresh();
}
});
}
};
}
};
}
}).endMenu().build();
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class NewResourcesMenu method enableMenuItemsForContext.
void enableMenuItemsForContext() {
for (Map.Entry<NewResourceHandler, MenuItem> entry : this.newResourceHandlers.entrySet()) {
final NewResourceHandler handler = entry.getKey();
final MenuItem menuItem = entry.getValue();
handler.acceptContext(getCallback(menuItem));
}
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class WorkbenchConfigurationMenu method setup.
@PostConstruct
public void setup() {
final Collection<SyncBeanDef<WorkbenchConfigurationHandler>> handlerBeans = iocBeanManager.lookupBeans(WorkbenchConfigurationHandler.class);
if (handlerBeans.size() > 0) {
for (SyncBeanDef<WorkbenchConfigurationHandler> handlerBean : handlerBeans) {
final WorkbenchConfigurationHandler activeHandler = handlerBean.getInstance();
final String description = activeHandler.getDescription();
final MenuItem menuItem = MenuFactory.newSimpleItem(description).respondsWith(new Command() {
@Override
public void execute() {
newResourcePresenter.show(activeHandler);
}
}).endMenu().build().getItems().get(0);
workbenchConfigurationHandler.put(activeHandler, menuItem);
items.add(menuItem);
}
}
Collections.sort(items, new Comparator<MenuItem>() {
@Override
public int compare(final MenuItem o1, final MenuItem o2) {
return o1.getCaption().compareToIgnoreCase(o2.getCaption());
}
});
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DefaultWorkbenchFeaturesMenusHelper method buildMenuItemsFromNavGroup.
public List<MenuItem> buildMenuItemsFromNavGroup(NavGroup navGroup) {
List<MenuItem> result = new ArrayList<>();
for (NavItem navItem : navGroup.getChildren()) {
// Skip dividers
if (navItem instanceof NavDivider) {
continue;
}
// Append its children
MenuBuilder<Builder> builder = MenuFactory.newSimpleItem(navItem.getName());
if (navItem instanceof NavGroup) {
List<MenuItem> childItems = buildMenuItemsFromNavGroup((NavGroup) navItem);
builder.withItems(childItems);
}
// Append the place request
NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);
if (navCtx.getResourceId() != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {
PlaceRequest placeRequest = resolvePlaceRequest(navCtx.getResourceId());
builder.place(placeRequest);
}
// Build the menu item & continue with the next one
MenuItem menuItem = builder.endMenu().build().getItems().get(0);
result.add(menuItem);
}
return result;
}
use of org.uberfire.workbench.model.menu.MenuItem in project kie-wb-common by kiegroup.
the class DefaultWorkbenchFeaturesMenusHelper method getPerspectivesMenuItems.
public List<MenuItem> getPerspectivesMenuItems() {
final List<MenuItem> perspectives = new ArrayList<>();
for (final PerspectiveActivity perspective : getPerspectiveActivities()) {
final String name = perspective.getDefaultPerspectiveLayout().getName();
final MenuItem item = newSimpleItem(name).perspective(perspective.getIdentifier()).endMenu().build().getItems().get(0);
perspectives.add(item);
}
return perspectives;
}
Aggregations