Example usage for com.vaadin.ui MenuBar removeItems

List of usage examples for com.vaadin.ui MenuBar removeItems

Introduction

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

Prototype

public void removeItems() 

Source Link

Document

Empty the menu bar.

Usage

From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java

License:Apache License

/**
 * Inits the application menu bar./*  w  w w.j a v a  2  s  .  c o  m*/
 *
 * @param menuBar
 *            the menu bar
 */
protected final void initApplicationMenuBar(final MenuBar menuBar) {
    menuBar.removeItems();
    menuBar.setWidth("80%");
    menuBar.setStyleName("Header");
    final MenuItem mainViewItem = menuBar.addItem("Application", FontAwesome.SERVER, null);

    mainViewItem.addItem(START_TEXT, FontAwesome.STAR, COMMAND);

    final MenuItem mainItem = mainViewItem.addItem("Main", FontAwesome.STAR, null);

    mainItem.addItem(PAGE_VISIT_HISTORY_TEXT, FontAwesome.AREA_CHART, COMMAND18);

    if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN)
            || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) {
        mainViewItem.addItem(USERHOME, FontAwesome.USER, COMMAND2);
        createAdminMenu(mainViewItem);
        mainViewItem.addItem("Logout", FontAwesome.SIGN_OUT, COMMAND3);
    } else {
        mainViewItem.addItem("Login", FontAwesome.SIGN_IN, COMMAND4);
        mainViewItem.addItem("Register", FontAwesome.USER_PLUS, COMMAND5);
    }

}