Example usage for com.vaadin.ui MenuBar.MenuItem isEnabled

List of usage examples for com.vaadin.ui MenuBar.MenuItem isEnabled

Introduction

In this page you can find the example usage for com.vaadin.ui MenuBar.MenuItem isEnabled.

Prototype

@Override
    public boolean isEnabled() 

Source Link

Usage

From source file:org.opennms.features.topology.app.internal.menu.TopologyContextMenu.java

License:Open Source License

private void addItems(ItemAddBehaviour<ContextMenuItem> behaviour, MenuBar.MenuItem child) {
    ContextMenuItem contextMenuItem = behaviour.addItem();
    contextMenuItem.setEnabled(child.isEnabled());
    contextMenuItem.setSeparatorVisible(child.isSeparator());
    if (child.getCommand() != null) {
        contextMenuItem/*from   www.j a  v  a  2 s  . co m*/
                .addItemClickListener(contextMenuItemClickEvent -> child.getCommand().menuSelected(child));
    }
    if (child.hasChildren()) {
        for (MenuBar.MenuItem eachChild : child.getChildren()) {
            addItems(() -> contextMenuItem.addItem(eachChild.getText(), eachChild.getIcon()), eachChild);
        }
    }
}