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

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

Introduction

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

Prototype

public MenuBar.MenuItem addItem(String caption, MenuBar.Command command) 

Source Link

Document

Add a new item to the menu bar.

Usage

From source file:org.vaadin.spring.samples.sidebar.ValoSideBarUI.java

License:Apache License

@Override
protected void init(VaadinRequest vaadinRequest) {
    super.init(vaadinRequest);
    CssLayout header = new CssLayout();

    MenuBar menuBar = new MenuBar();
    header.addComponent(menuBar);//from www. java2s  .c om

    MenuBar.MenuItem settingsItem = menuBar.addItem("", FontAwesome.WRENCH, null);

    MenuBar.MenuItem useLargeIconsItem = settingsItem.addItem("Use large icons", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            sideBar.setLargeIcons(selectedItem.isChecked());
        }
    });
    useLargeIconsItem.setCheckable(true);

    MenuBar.MenuItem showLogoItem = settingsItem.addItem("Show logo", new MenuBar.Command() {

        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            if (selectedItem.isChecked()) {
                showLogo();
            } else {
                hideLogo();
            }
        }
    });
    showLogoItem.setCheckable(true);

    sideBar.setHeader(header);
}

From source file:ru.bormoshka.tstocks.view.DataView.java

public DataView() {
    super();//from   w  w  w .j a  va 2s  .c o  m
    this.viewName = "Data View";
    MenuBar.MenuItem mItem = this.viewMenu.addItem("Get Some Data", null);
    mItem.addItem("Yo!", null);
}

From source file:ru.bormoshka.tstocks.view.ListsView.java

protected void buildMenu() {
    MenuBar.MenuItem managementItem = this.viewMenu.addItem(L.get("list_edit"), null);
    managementItem.addItem(L.get("list_edit_unit_type"), getDummyCommand());
    managementItem.addItem(L.get("list_edit_location"), getCommand(Location.class));
    managementItem.addItem(L.get("list_edit_location_type"), getCommand(LocationType.class));
    managementItem.addItem(L.get("list_edit_address"), getCommand(Address.class));
    managementItem.addItem(L.get("list_edit_category"), getCommand(Category.class));
}

From source file:ru.bormoshka.tstocks.view.StockingView.java

public StockingView() {
    super();//from   w  w w .  ja v  a  2s  . c o m
    this.viewName = "Stocking View";
    iconStyle = FontIcon.Name.TASKS;
    MenuBar.MenuItem mItem = this.viewMenu.addItem("Lets Do some stocking", null);
    mItem.addItem("YAY!", null);

    viewContent = new HorizontalLayout();
    viewContent.addComponent(new Label("wuuuut"));
}

From source file:ru.bormoshka.tstocks.view.TransactionView.java

public TransactionView() {
    super();/*from w  ww .j  a  v  a  2 s. co  m*/
    this.viewName = "Transaction View";
    iconStyle = FontIcon.Name.EXCHANGE;
    MenuBar.MenuItem mItem = this.viewMenu.addItem("Show Some T", null);
    mItem.addItem("Nope!", null);

    viewContent = new HorizontalLayout();
    viewContent.addComponent(new Label("Som weird shit"));
}