Thanks Gleb, I added ContextMenu component to my project, but got compile errors:
D:\Documents\cuba-projects\portaltest\modules\web\src\com\company\portaltest\web\gui\components\WebContextMenu.java:6: error: type argument ContextMenu is not within bounds of type-variable T
public class WebContextMenu extends WebAbstractComponent<com.vaadin.addon.contextmenu.ContextMenu> implements ContextMenu {
^
where T is a type-variable:
T extends AbstractComponent declared in class WebAbstractComponent
D:\Documents\cuba-projects\portaltest\modules\web\src\com\company\portaltest\web\gui\components\WebContextMenu.java:8: error: constructor ContextMenu in class ContextMenu cannot be applied to given types;
this.component = new com.vaadin.addon.contextmenu.ContextMenu();
^
required: AbstractComponent,boolean
found: no arguments
reason: actual and formal argument lists differ in length
Maybe I should set another component interface name or something else?
ContextMenu isn’t a component, it’s an extension, so this means that you can’t create a UI component for this add-on, but you can use it to extend the functionality of existing component. For example:
// Create a context menu for 'someComponent'
ContextMenu contextMenu = new ContextMenu(somComponent, true);
// Checkable item
final MenuItem item = contextMenu.addItem("Checkable", e -> {
Notification.show("checked: " + e.isChecked());
});
item.setCheckable(true);
item.setChecked(true);
// Disabled item
MenuItem item2 = contextMenu.addItem("Disabled", e -> {
Notification.show("disabled");
});
item2.setEnabled(false);