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

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

Introduction

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

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the component's description.

Usage

From source file:com.haulmont.cuba.web.gui.components.presentations.TablePresentations.java

License:Apache License

protected void setDefaultItemStyle(com.vaadin.ui.MenuBar.MenuItem item) {
    addStyleForItem(item, DEFAULT_MENUITEM_STYLENAME);
    item.setDescription(messages.getMainMessage("PresentationsPopup.defaultPresentation"));
}

From source file:org.balisunrise.vaadin.components.header.ModuleButton.java

private void init() {
    setStyleName("b-module-button");
    setHeight("100%");

    button = new MenuBar();
    setCompositionRoot(button);/*w ww  .  j av a2s.  c o m*/

    MenuBar.MenuItem modules = button.addItem("", null);
    //modules.setIcon(new ThemeResource("img/modules.png"));
    modules.setDescription("Clique e selecione um mdulo");

    modules.addItem("Pessoas", c -> {
        Notification.show("Modulo: " + c.getText(), Notification.Type.TRAY_NOTIFICATION);
    });
    modules.addItem("Vendas", c -> {
        Notification.show("Modulo: " + c.getText(), Notification.Type.TRAY_NOTIFICATION);
    });
    modules.addItem("Financeiro", c -> {
        Notification.show("Modulo: " + c.getText(), Notification.Type.TRAY_NOTIFICATION);
    });
    modules.addItem("Estoque", c -> {
        Notification.show("Modulo: " + c.getText(), Notification.Type.TRAY_NOTIFICATION);
    });
    modules.addItem("Compras", c -> {
        Notification.show("Modulo: " + c.getText(), Notification.Type.TRAY_NOTIFICATION);
    });
}

From source file:org.balisunrise.vaadin.components.header.ModuleMenu.java

private void init() {
    setHeight("100%");
    setWidthUndefined();/*from  w  w  w.ja v  a2  s .c o m*/

    menuBar = new MenuBar();
    menuBar.setStyleName("b-module-menu");

    setCompositionRoot(menuBar);

    MenuBar.MenuItem item;
    item = menuBar.addItem("Menu 1", new ItemCommand());
    item.setStyleName("b-module-menu-item");
    item.setDescription("1 Item do menu");

    MenuBar.MenuItem subMenu;
    subMenu = menuBar.addItem("Sub Menus 1", null);
    subMenu.setStyleName("b-module-menu-item");

    item = subMenu.addItem("Menu 2", new ItemCommand());
    item.setStyleName("b-module-menu-item");
    item.setDescription("2 Item do menu");

    item = subMenu.addItem("Menu 3", new ItemCommand());
    item.setStyleName("b-module-menu-item");
    item.setDescription("3 Item do menu");

    subMenu = menuBar.addItem("Sub Menus 2", null);
    subMenu.setStyleName("b-module-menu-item");

    MenuBar.MenuItem subMenu2;
    subMenu2 = subMenu.addItem("Sub Sub Menu 1", null);
    subMenu2.setStyleName("b-module-menu-item");

    item = subMenu2.addItem("Menu 4", new ItemCommand());
    item.setStyleName("b-module-menu-item");
    item.setDescription("4 Item do menu");

    item = subMenu2.addItem("Menu 5", new ItemCommand());
    item.setStyleName("b-module-menu-item");
    item.setDescription("5 Item do menu");

    subMenu2 = subMenu.addItem("Sub Sub Menu 2", null);
    subMenu2.setStyleName("b-module-menu-item");

    item = subMenu2.addItem("Menu 6", new ItemCommand());
    item.setStyleName("b-module-menu-item");
    item.setDescription("6 Item do menu");

    item = subMenu2.addItem("Menu 7", new ItemCommand());
    item.setStyleName("b-module-menu-item");
    item.setDescription("7 Item do menu");
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.TabularResultLayout.java

License:Open Source License

private void createMenuBar() {
    HorizontalLayout resultBar = new HorizontalLayout();
    resultBar.setWidth(100, Unit.PERCENTAGE);
    resultBar.setMargin(new MarginInfo(false, true, false, true));

    HorizontalLayout leftBar = new HorizontalLayout();
    leftBar.setSpacing(true);//from  w w w  .  j  a v  a 2s .  c o  m
    resultLabel = new Label("", ContentMode.HTML);
    leftBar.addComponent(resultLabel);

    final Label sqlLabel = new Label("", ContentMode.TEXT);
    sqlLabel.setWidth(800, Unit.PIXELS);
    leftBar.addComponent(sqlLabel);

    resultBar.addComponent(leftBar);
    resultBar.setComponentAlignment(leftBar, Alignment.MIDDLE_LEFT);
    resultBar.setExpandRatio(leftBar, 1);

    MenuBar rightBar = new MenuBar();
    rightBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    rightBar.addStyleName(ValoTheme.MENUBAR_SMALL);

    MenuBar.MenuItem refreshButton = rightBar.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            listener.reExecute(sql);
        }
    });
    refreshButton.setIcon(FontAwesome.REFRESH);

    MenuBar.MenuItem exportButton = rightBar.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            new ExportDialog(grid, db.getName(), sql).show();
        }
    });
    exportButton.setIcon(FontAwesome.UPLOAD);

    if (isInQueryGeneralResults) {
        MenuBar.MenuItem keepResultsButton = rightBar.addItem("", new Command() {
            private static final long serialVersionUID = 1L;

            @Override
            public void menuSelected(com.vaadin.ui.MenuBar.MenuItem selectedItem) {
                queryPanel.addResultsTab(refreshWithoutSaveButton(), StringUtils.abbreviate(sql, 20),
                        queryPanel.getGeneralResultsTab().getIcon());
                queryPanel.resetGeneralResultsTab();
            }
        });
        keepResultsButton.setIcon(FontAwesome.CLONE);
        keepResultsButton.setDescription("Save these results to a new tab");
    }

    if (showSql) {
        sqlLabel.setValue(StringUtils.abbreviate(sql, 200));
    }

    resultBar.addComponent(rightBar);
    resultBar.setComponentAlignment(rightBar, Alignment.MIDDLE_RIGHT);

    this.addComponent(resultBar, 0);
}