Home

# Class goog.ui.SubMenuRenderer

Default renderer for {@link goog.ui.SubMenu}s. Each item has the following structure:

...(menuitem content)...
extends goog.ui.MenuItemRenderer

Instance Method Summary
| `addArrow_(?goog.ui.SubMenu subMenu, ?Element element)` Appends a child node with the class goog.getCssName('goog-submenu-arrow') or 'goog-submenu-arrow-rtl' which can be styled to show an arrow.
| `createDom(?goog.ui.SubMenu subMenu) ⇒ ?Element` Overrides {@link goog.ui.MenuItemRenderer#createDom} by adding the additional class 'goog-submenu' to the created element, and passes the element to {@link goog.ui.SubMenuItemRenderer#addArrow_} to add an child element that can be styled to show an arrow.

`decorate(?goog.ui.SubMenu subMenu, ?Element element) ⇒ ?Element`

Overrides {@link goog.ui.MenuItemRenderer#decorate} by adding the additional class 'goog-submenu' to the decorated element, and passing the element to {@link goog.ui.SubMenuItemRenderer#addArrow_} to add a child element that can be styled to show an arrow. Also searches the element for a child with the class goog-menu. If a matching child element is found, creates a goog.ui.Menu, uses it to decorate the child element, and passes that menu to subMenu.setMenu.

`initializeDom(?goog.ui.SubMenu subMenu)`

Overrides {@link goog.ui.MenuItemRenderer#initializeDom} to tweak the DOM structure for the span.goog-submenu-arrow element depending on the text direction (LTR or RTL). When the SubMenu is RTL the arrow will be given the additional class of goog-submenu-arrow-rtl, and the arrow will be moved up to be the first child in the SubMenu's element. Otherwise the arrow will have the class goog-submenu-arrow-ltr, and be kept as the last child of the SubMenu's element.

| `setContent(?Element element, ?goog.ui.ControlContent content)` Takes a menu item's root element, and sets its content to the given text caption or DOM structure. Overrides the superclass immplementation by making sure that the submenu arrow structure is preserved.

Static Method Summary
| `setArrowTextContent_(?goog.ui.SubMenu subMenu, ?Element arrow)` Set the text content of an arrow.