Home

# Class goog.ui.PopupMenu

A basic menu class.

extends goog.ui.Menu

Instance Method Summary
| `attach(?Element element, ?goog.positioning.Corner= opt_targetCorner, ?goog.positioning.Corner= opt_menuCorner, boolean= opt_contextMenu, ?goog.math.Box= opt_margin)` Attaches the menu to a new popup position and anchor element. A menu can only be attached to an element once, since attaching the same menu for multiple positions doesn't make sense.
| `attachEvent_(?Object target)` Attaches an event listener to a target

`createAttachTarget(?Element element, ?goog.positioning.Corner= opt_targetCorner, ?goog.positioning.Corner= opt_menuCorner, boolean= opt_contextMenu, ?goog.math.Box= opt_margin) ⇒ ?Object`

Creates an object describing how the popup menu should be attached to the anchoring element based on the given parameters. The created object is stored, keyed by {@code element} and is retrievable later by invoking {@link #getAttachTarget(element)} at a later point. Subclass may add more properties to the returned object, as needed.

| `decorateInternal(?Element element)` Decorate an existing HTML structure with the menu. Menu items will be constructed from elements with classname 'goog-menuitem', separators will be made from HR elements.
| `detach(?Element element)` Detaches a menu from a given element.
| `detachAll()` Detaches all listeners
| `detachEvent_(?Object target)` Detaches an event listener to a target
| `disposeInternal()` Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.
| `enterDocument()` The menu has been added to the document.
| `getAttachTarget(?Element element) ⇒ ?Object` Returns the object describing how the popup menu should be attach to given element or {@code null}. The object is created and the association is formed when {@link #attach} is invoked.
| `getAttachedElement() ⇒ ?Element`
| `getToggleMode() ⇒ boolean` Gets whether the menu is in toggle mode
| `handleBlur(?goog.events.BrowserEvent e)` Handles the key event target loosing focus.
| `hide()` Hides the menu.
| `isAttachTarget(?Element element) ⇒ boolean`
| `isOrWasRecentlyVisible() ⇒ boolean` Returns whether the menu is currently visible or was visible within about 150 ms ago. This stops the menu toggling back on if the toggleMode == false.
| `onAction_(?goog.events.Event= opt_e)` Dismiss the popup menu when an action fires.
| `onDocClick(?goog.events.BrowserEvent e)` Handles click events that propagate to the document.
| `onTargetClick_(?goog.events.BrowserEvent e)` Handles a browser event on one of the popup targets
| `setToggleMode(boolean toggle)` Sets whether the menu should toggle if it is already open. For context menus this should be false, for toolbar menus it makes more sense to be true.
| `showAt(number x, number y, ?goog.positioning.Corner= opt_menuCorner)` Shows the menu immediately at the given client coordinates.
| `showAtElement(?Element element, ?goog.positioning.Corner targetCorner, ?goog.positioning.Corner= opt_menuCorner)` Shows the menu immediately attached to the given element
| `showMenu(?Object target, number x, number y)` Show the menu at a given attached target.
| `showWithPosition(?goog.positioning.AbstractPosition position, ?goog.positioning.Corner= opt_menuCorner, ?goog.math.Box= opt_margin, ?Element= opt_anchor)` Show the menu using given positioning object.
| `wasRecentlyHidden() ⇒ boolean` Used to stop the menu toggling back on if the toggleMode == false.