use of com.vaadin.server.Resource in project cuba by cuba-platform.
the class WebAppMenu method createMenuItem.
@Override
public MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<MenuItem> command) {
checkNotNullArgument(id);
checkItemIdDuplicate(id);
MenuItem menuItem = new MenuItemImpl(this, id);
Resource iconResource = null;
if (icon != null) {
iconResource = AppBeans.get(IconResolver.class).getIconResource(icon);
}
MenuBar.MenuItem delegateItem = component.createMenuItem(caption, iconResource, null);
if (command != null) {
delegateItem.setCommand(selectedItem -> command.accept(menuItem));
}
((MenuItemImpl) menuItem).setDelegateItem(delegateItem);
menuItem.setCaption(caption);
menuItem.setIcon(icon);
menuItem.setCommand(command);
return menuItem;
}
use of com.vaadin.server.Resource in project cuba by cuba-platform.
the class CubaSideMenu method markMenuStructureAsDirty.
protected void markMenuStructureAsDirty() {
markAsDirty();
this.structureChanged = true;
for (String menuIconsKey : menuIconResourceKeys) {
Resource resource = getResource(menuIconsKey);
menuIconsKeyMapper.remove(resource);
setResource(menuIconsKey, null);
}
menuItemIdMapper.removeAll();
menuIconsKeyMapper.removeAll();
// all badges will be sent to client with items
badgeUpdates.clear();
}
Aggregations