goog.ui.MenuRenderer
Classgoog.ui.MenuRenderer
> goog.ui.ContainerRenderer
goog.ui.MenuRenderer()
Default renderer for {@link goog.ui.Menu}s, based on {@link goog.ui.ContainerRenderer}.
.CSS_CLASS
{string
}Default CSS class to be applied to the root element of toolbars rendered by this renderer.
.canDecorate(element)
Returns whether the element is a UL or acceptable to our superclass.
element
{Element
}
boolean
}
.containsElement(menu, element)
Returns whether the given element is contained in the menu's DOM.
menu
{goog.ui.Menu
}
element
{Element
}
boolean
}
.createDom(container)
Inherited from goog.ui.ContainerRenderer
.
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.
container
{goog.ui.Container
}
Element
}
.decorate(container, element)
Inherited from goog.ui.ContainerRenderer
.
Default implementation of {@code decorate} for {@link goog.ui.Container}s. Decorates the element with the container, and attempts to decorate its child elements. Returns the decorated element.
container
{goog.ui.Container
}
element
{Element
}
Element
}
.decorateChildren(container, element, opt_firstChild)
Inherited from goog.ui.ContainerRenderer
.
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.
container
{goog.ui.Container
}
element
{Element
}
opt_firstChild
{Element
=}
.enableTabIndex(element, enable)
Inherited from goog.ui.ContainerRenderer
.
Enables or disables the tab index of the element. Only elements with a valid tab index can receive focus.
element
{Element
}
enable
{boolean
}
.getAriaRole()
Returns the ARIA role to be applied to menus.
string
}
.getClassNames(container)
Inherited from goog.ui.ContainerRenderer
.
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.
container
{goog.ui.Container
}
Array
.<string
>}
.getContentElement(element)
Inherited from goog.ui.ContainerRenderer
.
Returns the DOM element into which child components are to be rendered, or null if the container hasn't been rendered yet.
element
{Element
}
Element
}
.getCssClass()
Returns the CSS class to be applied to the root element of containers rendered using this renderer.
string
}
.getDecoratorForChild(element)
Inspects the element, and creates an instance of {@link goog.ui.Control} or an appropriate subclass best suited to decorate it. Overrides the superclass implementation by recognizing HR elements as separators.
element
{Element
}
goog.ui.Control
?}
.getDefaultOrientation()
Inherited from goog.ui.ContainerRenderer
.
Returns the default orientation of containers rendered or decorated by this renderer. The base class implementation returns {@code VERTICAL}.
goog.ui.Container.Orientation
}
.getKeyEventTarget(container)
Inherited from goog.ui.ContainerRenderer
.
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.
container
{goog.ui.Container
}
Element
}
.initializeDom(container)
Initializes the container's DOM when the container enters the document. Called from {@link goog.ui.Container#enterDocument}.
container
{goog.ui.Container
}
.setStateFromClassName(container, className, baseClass)
[protected]Inherited from goog.ui.ContainerRenderer
.
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.
container
{goog.ui.Container
}
className
{string
}
baseClass
{string
}