Example usage for com.google.gwt.user.client.ui MenuItem setSelectionStyle

List of usage examples for com.google.gwt.user.client.ui MenuItem setSelectionStyle

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui MenuItem setSelectionStyle.

Prototype

protected void setSelectionStyle(boolean selected) 

Source Link

Usage

From source file:com.vaadin.client.ui.menubar.MenuBar.java

License:Apache License

/**
 * Adds a menu item to the bar.//from w  w w  .j  av a2 s.  c  om
 * 
 * @param item
 *            the item to be added
 */
public void addItem(MenuItem item) {
    Element tr;
    if (vertical) {
        tr = DOM.createTR();
        DOM.appendChild(body, tr);
    } else {
        tr = DOM.getChild(body, 0);
    }

    DOM.appendChild(tr, item.getElement());

    item.setParentMenu(this);
    item.setSelectionStyle(false);
    items.add(item);
}

From source file:com.vaadin.client.ui.menubar.MenuBar.java

License:Apache License

public void selectItem(MenuItem item) {
    if (item == selectedItem) {
        scrollItemIntoView(item);//from  ww w . j  a v a 2 s . com
        return;
    }

    if (selectedItem != null) {
        selectedItem.setSelectionStyle(false);
    }

    if (item != null) {
        item.setSelectionStyle(true);
    }

    selectedItem = item;

    scrollItemIntoView(item);
}

From source file:com.vaadin.terminal.gwt.client.ui.MenuBar.java

License:Open Source License

void selectItem(MenuItem item) {
    if (item == selectedItem) {
        return;//  w w w  .j  a  va  2  s. co m
    }

    if (selectedItem != null) {
        selectedItem.setSelectionStyle(false);
    }

    if (item != null) {
        item.setSelectionStyle(true);
    }

    selectedItem = item;
}