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

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

Introduction

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

Prototype

@Override
    public String getId() 

Source Link

Usage

From source file:com.trender.user.component.Header.java

public Component intitUserPageComponent(String name) {
    init();/*from  w ww  .j  a  v a  2  s .  c om*/

    userNameLable = new Label();
    userNameLable.setWidth(400, Unit.PIXELS);
    userNameLable.setValue("  " + name);
    userNameLable.addStyleName("v-label-header-user-name");
    userNameLable.addStyleName("v-label");
    singInOrSingOutButton = new Button();
    singInOrSingOutButton.setCaption("");
    singInOrSingOutButton.addStyleName("v-button-header-sing-out");
    singInOrSingOutButton.addStyleName("v-button-primary");

    MenuBar.Command command = new MenuBar.Command() {
        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            Header.this.menuSelected(selectedItem.getId());
        }
    };

    menuBar.addItem(" ??", command);
    menuBar.addItem("  ??", command);
    menuBar.addItem("", command);

    addComponent(userNameLable);
    addComponent(singInOrSingOutButton);
    addComponent(menuBar);

    return this;
}

From source file:nz.co.senanque.perspectivemanager.MenuCloner.java

License:Apache License

public static void clean(MenuBar target, List<MenuBar.MenuItem> added) {
    if (target != null) {
        List<MenuBar.MenuItem> items = target.getItems();
        for (MenuBar.MenuItem r : added) {
            for (MenuBar.MenuItem targetItem : items) {
                if (r.getId() == targetItem.getId()) {
                    items.remove(r);/*from ww  w.  jav  a  2 s  . c  o  m*/
                    break;
                }
            }
        }
        for (MenuBar.MenuItem targetItem : items) {
            clean(targetItem, added);
        }
    }
    added.clear();
}

From source file:nz.co.senanque.perspectivemanager.MenuCloner.java

License:Apache License

private static void clean(MenuBar.MenuItem target, List<MenuBar.MenuItem> added) {
    if (target.hasChildren()) {
        List<MenuBar.MenuItem> items = target.getChildren();
        for (MenuBar.MenuItem r : added) {
            for (MenuBar.MenuItem targetItem : items) {
                if (r.getId() == targetItem.getId()) {
                    items.remove(r);//from  w  ww  .  j av  a 2s .  c  o m
                    break;
                }
            }
        }
        for (MenuBar.MenuItem targetItem : items) {
            clean(targetItem, added);
        }
    }
}