Home

# Class goog.ui.BasicMenu

Class that extends AttachableMenu and creates a simple menu, purely from code.The ITEM_EVENT instead of returning the DOM node returns a reference the menu item.

extends goog.ui.AttachableMenu

Instance Method Summary
| `activateItem_(?Element el)` Activates a menu item, opens submenu or triggers the select event and closes the menu if no submenu is available for item.
| `add(?goog.ui.BasicMenu.Item item)` Add a menu item.
| `containsElement_(?Element el) ⇒ boolean` Returns whether the specified element is contained inside the menu, including open submenus.

`disposeInternal()`

Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:

    MyClass.prototype.disposeInternal = function() {
    MyClass.superClass_.disposeInternal.call(this);
    // Dispose logic for MyClass
    };

| `focus()` Sets focus to the menu's base element.
| `getItemForElement_(?Element el) ⇒ ?goog.ui.BasicMenu.Item` Returns the menu item a given element is associated with.
| `getParentMenu() ⇒ ?goog.ui.BasicMenu`
| `getSelectedItem() ⇒ ?goog.ui.BasicMenu.Item`
| `getZIndex() ⇒ number`
| `insertAt(?goog.ui.BasicMenu.Item item, number index)` Add a menu item at a specific index.
| `itemSelectionHandler_(?Element el, boolean= opt_keyEvent)` Select menu item by element reference and active it (open/close submenus) with a slight delay.
| `onDocumentFocus_(?goog.events.Event e)` Overloaded document focus handler. Prevents the default action which is to close the menu on focus change, which is not desirable for hierarchical menus.
| `onDocumentMouseDown_(?goog.events.BrowserEvent e)` Mouse down handler for the document on capture phase. Hides the menu.
| `onKeyDown(?goog.events.KeyEvent e)` Key down handler for the menu.
| `onMouseOut(?goog.events.Event e)` Mouse out handler for the menu.
| `onMouseOver(?goog.events.Event e)` Mouse over handler for the menu.
| `onMouseUp(?goog.events.Event e)` Mouse up handler for the menu.
| `onResize_()` Window resize handler.
| `onShow_()` Called after the menu is shown.
| `openMenu_()` Anchor triggered, open menu unless it was just closed by the mousedown part of the click.
| `remove(?goog.ui.BasicMenu.Item item)` Remove a menu item.
| `removeAt(number index)` Remove a menu item from a particular index.
| `selectItem_(?goog.ui.BasicMenu.Item item)` Select menu item, triggered by a delayed call from itemSelectionHandler_. Opens submenu associated with selected/active item and/or closes any other open submenus.
| `setAnchorElement(?Element el, ?goog.positioning.Corner= opt_pos, ?goog.events.EventType= opt_eventType)` Anchor the menu position to an element, and attach a click event.
| `setParentMenu_(?goog.ui.BasicMenu parent)` Sets menu's parent menu in case it's a submenu.
| `setSelectedIndex(number index)` Select menu item by index.
| `setSelectedItem((Element|goog.ui.BasicMenu.Item|null) arg)` Select menu item by element reference and activate it immediately.
| `setVisible(boolean visible, boolean= opt_bubble)` Sets whether the popup should be visible.
| `setZIndex(number zIndex)` Sets the z-index. The change will take effect the next time setVisible(true) is called.