ui.MenuRenderer Extends goog.ui.ContainerRenderer
Default renderer for goog.ui.Menus, based on goog.ui.ContainerRenderer.

Inheritance

Constructor

goog.ui.MenuRenderer(opt_ariaRole)

Parameters

opt_ariaRole : string=
Optional ARIA role used for the element.

Instance Methods

Public Protected Private
canDecorate(element) boolean
Returns whether the element is a UL or acceptable to our superclass.
Arguments:
element : Element
Element to decorate.
Returns: boolean  Whether the renderer can decorate the element.
code »
containsElement(menuelement) boolean
Returns whether the given element is contained in the menu's DOM.
Arguments:
menu : goog.ui.Menu
The menu to test.
element : Element
The element to test.
Returns: boolean  Whether the given element is contained in the menu.
code »
getCssClass() string
Returns the CSS class to be applied to the root element of containers rendered using this renderer.
Returns: string  Renderer-specific CSS class.
code »
getDecoratorForChild(element) ?goog.ui.Control
Inspects the element, and creates an instance of goog.ui.Control or an appropriate subclass best suited to decorate it. Overrides the superclass implementation by recognizing HR elements as separators.
Arguments:
element : Element
Element to decorate.
Returns: ?goog.ui.Control  A new control suitable to decorate the element (null if none).
code »
initializeDom()
No description.
code »
canDecorate(element) boolean
Default implementation of canDecorate; returns true if the element is a DIV, false otherwise.
Arguments:
element : Element
Element to decorate.
Returns: boolean  Whether the renderer can decorate the element.
code »
createDom(container) Element
Creates and returns the container's root element. The default simply creates a DIV and applies the renderer's own CSS class name to it. To be overridden in subclasses.
Arguments:
container : goog.ui.Container
Container to render.
Returns: Element  Root element for the container.
code »
decorate(containerelement) !Element
Default implementation of decorate for goog.ui.Containers. Decorates the element with the container, and attempts to decorate its child elements. Returns the decorated element.
Arguments:
container : goog.ui.Container
Container to decorate the element.
element : Element
Element to decorate.
Returns: !Element  Decorated element.
code »
decorateChildren(containerelementopt_firstChild)
Takes a container and an element that may contain child elements, decorates the child elements, and adds the corresponding components to the container as child components. Any non-element child nodes (e.g. empty text nodes introduced by line breaks in the HTML source) are removed from the element.
Arguments:
container : goog.ui.Container
Container whose children are to be discovered.
element : Element
Element whose children are to be decorated.
opt_firstChild : Element=
the first child to be decorated.
code »
enableTabIndex(elementenable)
Enables or disables the tab index of the element. Only elements with a valid tab index can receive focus.
Arguments:
element : Element
Element whose tab index is to be changed.
enable : boolean
Whether to add or remove the element's tab index.
code »
getAriaRole() undefined | string
Returns the ARIA role to be applied to the container. See http://wiki/Main/ARIA for more info.
Returns: undefined | string  ARIA role.
code »
getClassNames(container) !Array.<string>
Returns all CSS class names applicable to the given container, based on its state. The array of class names returned includes the renderer's own CSS class, followed by a CSS class indicating the container's orientation, followed by any state-specific CSS classes.
Arguments:
container : goog.ui.Container
Container whose CSS classes are to be returned.
Returns: !Array.<string>  Array of CSS class names applicable to the container.
code »
getContentElement(element) Element
Returns the DOM element into which child components are to be rendered, or null if the container hasn't been rendered yet.
Arguments:
element : Element
Root element of the container whose content element is to be returned.
Returns: Element  Element to contain child elements (null if none).
code »
getCssClass() string
Returns the CSS class to be applied to the root element of containers rendered using this renderer.
Returns: string  Renderer-specific CSS class.
code »
getDecoratorForChild(element) ?goog.ui.Control
Inspects the element, and creates an instance of goog.ui.Control or an appropriate subclass best suited to decorate it. Returns the control (or null if no suitable class was found). This default implementation uses the element's CSS class to find the appropriate control class to instantiate. May be overridden in subclasses.
Arguments:
element : Element
Element to decorate.
Returns: ?goog.ui.Control  A new control suitable to decorate the element (null if none).
code »
getDefaultOrientation() goog.ui.Container.Orientation
Returns the default orientation of containers rendered or decorated by this renderer. The base class implementation returns VERTICAL.
Returns: goog.ui.Container.Orientation  Default orientation for containers created or decorated by this renderer.
code »
getKeyEventTarget(container) Element
Returns the element within the container's DOM that should receive keyboard focus (null if none). The default implementation returns the container's root element.
Arguments:
container : goog.ui.Container
Container whose key event target is to be returned.
Returns: Element  Key event target (null if none).
code »
initializeDom(container)
Initializes the container's DOM when the container enters the document. Called from goog.ui.Container#enterDocument.
Arguments:
container : goog.ui.Container
Container whose DOM is to be initialized as it enters the document.
code »
setStateFromClassName(containerclassNamebaseClass)
Sets the container's state based on the given CSS class name, encountered during decoration. CSS class names that don't represent container states are ignored. Considered protected; subclasses should override this method to support more states and CSS class names.
Arguments:
container : goog.ui.Container
Container to update.
className : string
CSS class name.
baseClass : string
Base class name used as the root of state-specific class names (typically the renderer's own class name).
code »

Instance Properties

constructor :
No description.
Code »
ariaRole_ :
No description.
Code »

Static Methods

goog.ui.MenuRenderer.getInstance()
No description.
code »

Static Properties

goog.ui.MenuRenderer.CSS_CLASS :
Default CSS class to be applied to the root element of toolbars rendered by this renderer.
Code »
goog.ui.MenuRenderer.instance_ :
No description.
Code »
goog.ui.MenuRenderer.superClass_ :
No description.
Code »

Package ui

Package Reference