public void selectItem(MenuItem item) { if (item == selectedItem) { return; } if (selectedItem != null) { selectedItem.setSelectionStyle(false); } if (item != null) { item.setSelectionStyle(true); } selectedItem = item; }
/** * Adds a menu item to the bar. * * @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); }