goog.ui.FilteredMenu
Classgoog.ui.FilteredMenu
> goog.ui.Menu
> goog.ui.Container
> goog.ui.Component
> goog.events.EventTarget
> goog.Disposable
goog.ui.FilteredMenu(opt_renderer, opt_domHelper)
Filtered menu class.
opt_renderer
{goog.ui.MenuRenderer
=}
opt_domHelper
{goog.dom.DomHelper
=}
goog.ui.FilteredMenu.EventType
EnumEvents fired by component. … more
.addChild(child, opt_render)
Inherited from goog.ui.Container
.
Adds the specified control as the last child of this container. See {@link goog.ui.Container#addChildAt} for detailed semantics.
child
{goog.ui.Component
}
opt_render
{boolean
=}
.addChildAt(control, index, opt_render)
Inherited from goog.ui.Container
.
Adds the control as a child of this container at the given 0-based index. Overrides {@link goog.ui.Component#addChildAt} by also updating the container's highlight index. Since {@link goog.ui.Component#addChild} uses {@link #addChildAt} internally, we only need to override this method.
control
{goog.ui.Component
}
index
{number
}
opt_render
{boolean
=}
void
}
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addItem(item)
[deprecated]Deprecated. Use {@link #addChild} instead, with true for the second argument.
Inherited from goog.ui.Menu
.
Adds a new menu item at the end of the menu.
item
{goog.ui.MenuHeader
|goog.ui.MenuItem
|goog.ui.MenuSeparator
}
.addItemAt(item, n)
[deprecated]Deprecated. Use {@link #addChildAt} instead, with true for the third argument.
Inherited from goog.ui.Menu
.
Adds a new menu item at a specific index in the menu.
item
{goog.ui.MenuHeader
|goog.ui.MenuItem
|goog.ui.MenuSeparator
}
n
{number
}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.canDecorate(element)
Inherited from goog.ui.Container
.
Returns true if the given element can be decorated by this container. Overrides {@link goog.ui.Component#canDecorate}.
element
{Element
}
boolean
}
.canHighlightItem(item)
[protected]Inherited from goog.ui.Menu
.
Returns whether the given item can be highlighted.
item
{goog.ui.Control
}
boolean
}
.containsElement(element)
Inherited from goog.ui.Menu
.
Returns whether the provided element is to be considered inside the menu for purposes such as dismissing the menu on an event. This is so submenus can make use of elements outside their own DOM.
element
{Element
}
boolean
}
.createDom()
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.decorate(element)
Inherited from goog.ui.Component
.
Decorates the element for the UI component.
element
{Element
}
.decorateContent(element)
[protected]Inherited from goog.ui.Menu
.
Decorate menu items located in any descendent node which as been explicitly marked as a 'content' node.
element
{Element
}
.decorateInternal(element)
[protected]Decorates the given element with this container. Overrides {@link goog.ui.Component#decorateInternal}. Considered protected.
element
{Element
}
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
.dom_
[protected] {!goog.dom.DomHelper
}Inherited from goog.ui.Component
.
DomHelper used to interact with the document, allowing components to be created in a different window.
.enterDocument()
Inherited from goog.ui.Container
.
Configures the container after its DOM has been rendered, and sets up event handling. Overrides {@link goog.ui.Component#enterDocument}.
.exitDocument()
Inherited from goog.ui.Container
.
Cleans up the container before its DOM is removed from the document, and removes event handlers. Overrides {@link goog.ui.Component#exitDocument}.
.forEachChild(f, opt_obj)
Inherited from goog.ui.Component
.
Calls the given function on each of this component's children in order. If {@code opt_obj} is provided, it will be used as the 'this' object in the function when called. The function should take two arguments: the child component and its 0-based index. The return value is ignored.
f
{Function
}
opt_obj
{Object
=}
.getAllowAutoFocus()
Inherited from goog.ui.Menu
.
boolean
}
.getAllowHighlightDisabled()
Inherited from goog.ui.Menu
.
boolean
}
.getAllowMultiple()
boolean
}
.getChild
Inherited from goog.ui.Container
.
Overrides {@link goog.ui.Container#getChild} to make it clear that it only returns {@link goog.ui.Control}s.
id
{string
}
goog.ui.Control
}
.getChildAt
Inherited from goog.ui.Container
.
Overrides {@link goog.ui.Container#getChildAt} to make it clear that it only returns {@link goog.ui.Control}s.
index
{number
}
goog.ui.Control
}
.getChildCount()
Inherited from goog.ui.Component
.
Returns the number of children of this component.
number
}
.getChildIds()
Inherited from goog.ui.Component
.
Returns an array containing the IDs of the children of this component, or an empty array if the component has no children.
Array
.<string
>}
.getContentElement()
.getCssClass()
[protected]Deprecated. Use getRenderer().getCssClass().
Inherited from goog.ui.Menu
.
Returns the CSS class applied to menu elements, also used as the prefix for derived styles, if any. Subclasses should override this method as needed. Considered protected.
string
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getDomHelper()
Inherited from goog.ui.Component
.
Returns the dom helper that is being used on this component.
goog.dom.DomHelper
}
.getElement()
Inherited from goog.ui.Component
.
Gets the component's element.
Element
}
.getElementByClass(className)
Inherited from goog.ui.Component
.
Returns the first element in this component's DOM with the provided className.
className
{string
}
Element
}
.getElementByFragment(idFragment)
Inherited from goog.ui.Component
.
Helper function for returning an element in the document with a unique id generated using makeId().
idFragment
{string
}
Element
}
.getElementsByClass(className)
Inherited from goog.ui.Component
.
Returns an array of all the elements in this component's DOM with the provided className.
className
{string
}
goog.array.ArrayLike
}
.getEnteredItems()
Gets a list of items entered in the search box.
Array
.<string
>}
.getFilter()
Returns the filter string.
string
}
.getFilterFromIndex()
Returns the index of first item that is affected by the filter.
number
}
.getFilterInputElement()
Returns the filter input element.
Element
}
.getFilterLabel()
string
}
.getFragmentFromId(id)
Inherited from goog.ui.Component
.
Helper function for returning the fragment portion of an id generated using makeId().
id
{string
}
string
}
.getHandler()
[protected]Inherited from goog.ui.Component
.
Returns the event handler for this component, lazily created the first time this method is called.
goog.events.EventHandler
}
.getHighlighted()
Inherited from goog.ui.Container
.
Returns the currently highlighted item (if any).
goog.ui.Control
?}
.getHighlightedIndex()
Inherited from goog.ui.Container
.
Returns the index of the currently highlighted item (-1 if none).
number
}
.getId()
Inherited from goog.ui.Component
.
Gets the unique ID for the instance of this component. If the instance doesn't already have an ID, generates one on the fly.
string
}
.getItemAt(n)
[deprecated]Deprecated. Use {@link #getChildAt} instead.
Inherited from goog.ui.Menu
.
Returns a reference to the menu item at a given index.
n
{number
}
goog.ui.MenuHeader
|goog.ui.MenuItem
|goog.ui.MenuSeparator
|null
}
.getItemCount()
[deprecated]Deprecated. Use {@link #getChildCount} instead.
Inherited from goog.ui.Menu
.
Returns the number of items in the menu (including separators).
number
}
.getItems()
[deprecated]Deprecated. Use getChildAt, forEachChild, and getChildCount.
Inherited from goog.ui.Menu
.
Returns an array containing the menu items contained in the menu.
Array
.<goog.ui.MenuItem
>}
.getKeyEventTarget()
Inherited from goog.ui.Container
.
Returns the DOM element on which the container is listening for keyboard events (null if none).
Element
}
.getKeyHandler()
Inherited from goog.ui.Container
.
Returns the keyboard event handler for this container, lazily created the first time this method is called. The keyboard event handler listens for keyboard events on the container's key event target, as determined by its renderer.
goog.events.KeyHandler
}
.getModel()
Inherited from goog.ui.Component
.
Returns the model associated with the UI component.
.getOpenItem()
Inherited from goog.ui.Container
.
Returns the currently open (expanded) control in the container (null if none).
goog.ui.Control
?}
.getOrientation()
Inherited from goog.ui.Container
.
Returns the container's orientation.
goog.ui.Container.Orientation
}
.getOwnerControl(node)
[protected]Inherited from goog.ui.Container
.
Returns the child control that owns the given DOM node, or null if no such control is found.
node
{Node
}
goog.ui.Control
?}
.getParent()
Inherited from goog.ui.Component
.
Returns the component's parent, if any.
goog.ui.Component
?}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getPosition()
Inherited from goog.ui.Menu
.
Gets the page offset of the menu, or null if the menu isn't visible
goog.math.Coordinate
?}
.getRenderer()
Inherited from goog.ui.Container
.
Returns the renderer used by this container to render itself or to decorate an existing element.
goog.ui.ContainerRenderer
}
.handleBlur(e)
Inherited from goog.ui.Container
.
Handles blur events raised when the container's key event target loses keyboard focus. The default implementation clears the highlight index.
e
{goog.events.BrowserEvent
}
.handleChildMouseEvents(e)
Inherited from goog.ui.Container
.
Handles mouse events originating from nodes belonging to the controls hosted in the container. Locates the child control based on the DOM node that dispatched the event, and forwards the event to the control for handling.
e
{goog.events.BrowserEvent
}
.handleCloseItem(e)
Inherited from goog.ui.Container
.
Handles CLOSE events dispatched by items in the container when they are closed.
e
{goog.events.Event
}
.handleDocumentMouseUp(e)
Inherited from goog.ui.Container
.
Handles mouseup events over the document. The default implementation clears the "mouse button pressed" flag.
e
{goog.events.BrowserEvent
}
.handleEnterItem(e)
Inherited from goog.ui.Menu
.
Handles ENTER events raised by child controls when they are navigated to.
e
{goog.events.Event
}
boolean
}
.handleFilterEvent(e)
Handles filter input events.
e
{goog.events.BrowserEvent
}
.handleFocus(e)
Inherited from goog.ui.Container
.
Handles focus events raised when the container's key event target receives keyboard focus.
e
{goog.events.BrowserEvent
}
.handleHighlightItem(e)
Inherited from goog.ui.Container
.
Handles HIGHLIGHT events dispatched by items in the container when they are highlighted.
e
{goog.events.Event
}
.handleKeyEvent(e)
Handles the menu's behavior for a key event. The highlighted menu item will be given the opportunity to handle the key behavior.
e
{goog.events.KeyEvent
}
boolean
}
.handleKeyEventInternal(e)
Inherited from goog.ui.Menu
.
Attempts to handle a keyboard event; returns true if the event was handled, false otherwise. If the container is enabled, and a child is highlighted, calls the child control's {@code handleKeyEvent} method to give the control a chance to handle the event first.
e
{goog.events.KeyEvent
}
boolean
}
.handleMouseDown(e)
Inherited from goog.ui.Container
.
Handles mousedown events over the container. The default implementation sets the "mouse button pressed" flag and, if the container is focusable, grabs keyboard focus.
e
{goog.events.BrowserEvent
}
.handleOpenItem(e)
Inherited from goog.ui.Container
.
Handles OPEN events dispatched by items in the container when they are opened.
e
{goog.events.Event
}
.handleUnHighlightItem(e)
Inherited from goog.ui.Container
.
Handles UNHIGHLIGHT events dispatched by items in the container when they are unhighlighted.
e
{goog.events.Event
}
.hasChildren()
Inherited from goog.ui.Component
.
Returns true if the component has children.
boolean
}
.hasPersistentVisibility(child)
Returns whether the specified child should be affected (shown/hidden) by the filter criteria.
child
{goog.ui.Component
}
boolean
}
.highlightFirst()
Inherited from goog.ui.Container
.
Highlights the first highlightable item in the container
.highlightHelper(fn, startIndex)
[protected]Inherited from goog.ui.Container
.
Helper function that manages the details of moving the highlight among child controls in response to keyboard events.
fn
{function
(number
, number
) : number
}
startIndex
{number
}
boolean
}
.highlightLast()
Inherited from goog.ui.Container
.
Highlights the last highlightable item in the container.
.highlightNext()
Inherited from goog.ui.Container
.
Highlights the next highlightable item (or the first if nothing is currently highlighted).
.highlightNextPrefix(charStr)
Inherited from goog.ui.Menu
.
Highlights the next item that begins with the specified string. If no (other) item begins with the given string, the selection is unchanged.
charStr
{string
}
boolean
}
.highlightPrevious()
Inherited from goog.ui.Container
.
Highlights the previous highlightable item (or the last if nothing is currently highlighted).
.indexOfChild(child)
Inherited from goog.ui.Component
.
Returns the 0-based index of the given child component, or -1 if no such child is found.
child
{goog.ui.Component
?}
number
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isEnabled()
Inherited from goog.ui.Container
.
Returns true if the container is enabled, false otherwise.
boolean
}
.isFocusable()
Inherited from goog.ui.Container
.
Returns true if the container is focusable, false otherwise. The default is true. Focusable containers always have a tab index and allocate a key handler to handle keyboard events while focused.
boolean
}
.isFocusableChildrenAllowed()
Inherited from goog.ui.Container
.
Returns true if the container allows children to be focusable, false otherwise. Only effective if the container is not focusable.
boolean
}
.isInDocument()
Inherited from goog.ui.Component
.
Determines whether the component has been added to the document.
boolean
}
.isMouseButtonPressed()
Inherited from goog.ui.Container
.
Returns true if the mouse button is pressed, false otherwise.
boolean
}
.isOpenFollowsHighlight()
Inherited from goog.ui.Container
.
boolean
}
.isRightToLeft()
Inherited from goog.ui.Component
.
Returns true if the component is rendered right-to-left, false otherwise. The first time this function is invoked, the right-to-left rendering property is set if it has not been already.
boolean
}
.isVisible()
Inherited from goog.ui.Container
.
Returns true if the container's visibility is set to visible, false if it is set to hidden. A container that is set to hidden is guaranteed to be hidden from the user, but the reverse isn't necessarily true. A container may be set to visible but can otherwise be obscured by another element, rendered off-screen, or hidden using direct CSS manipulation.
boolean
}
.makeId(idFragment)
Inherited from goog.ui.Component
.
Helper function for subclasses that gets a unique id for a given fragment, this can be used by components to generate unique string ids for DOM elements.
idFragment
{string
}
string
}
.makeIds(object)
Inherited from goog.ui.Component
.
Makes a collection of ids. This is a convenience method for makeId. The object's values are the id fragments and the new values are the generated ids. The key will remain the same.
object
{Object
}
Object
}
.openingCoords
{goog.math.Coordinate
|undefined
}Inherited from goog.ui.Menu
.
Coordinates of the mousedown event that caused this menu to be made visible. Used to prevent the consequent mouseup event due to a simple click from activating a menu item immediately. Considered protected; should only be used within this package or by subclasses.
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeChild(control, opt_unrender)
Inherited from goog.ui.Container
.
Removes a child control. Overrides {@link goog.ui.Component#removeChild} by updating the highlight index. Since {@link goog.ui.Component#removeChildAt} uses {@link #removeChild} internally, we only need to override this method.
control
{string
|goog.ui.Component
}
opt_unrender
{boolean
=}
goog.ui.Control
}
.removeChildAt(index, opt_unrender)
Inherited from goog.ui.Component
.
Removes the child at the given index from this component, and returns it. Throws an error if the argument is out of bounds, or if the specified child isn't found in the parent. See {@link goog.ui.Component#removeChild} for detailed semantics.
index
{number
}
opt_unrender
{boolean
=}
goog.ui.Component
}
.removeChildren(opt_unrender)
Inherited from goog.ui.Component
.
Removes every child component attached to this one and returns them.
opt_unrender
{boolean
=}
Array
.<goog.ui.Component
>|undefined
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.removeItem(item)
[deprecated]Deprecated. Use {@link #removeChild} instead.
Inherited from goog.ui.Menu
.
Removes an item from the menu and disposes of it.
item
{goog.ui.MenuHeader
|goog.ui.MenuItem
|goog.ui.MenuSeparator
}
.removeItemAt(n)
[deprecated]Deprecated. Use {@link #removeChildAt} instead.
Inherited from goog.ui.Menu
.
Removes a menu item at a given index in the menu and disposes of it.
n
{number
}
.render(opt_parentElement)
Inherited from goog.ui.Component
.
Renders the component. If a parent element is supplied, the component's element will be appended to it. If there is no optional parent element and the element doesn't have a parentNode then it will be appended to the document body. If this component has a parent component, and the parent component is not in the document already, then this will not call {@code enterDocument} on this component. Throws an Error if the component is already rendered.
opt_parentElement
{Element
=}
.renderBefore(sibling)
Inherited from goog.ui.Component
.
Renders the component before another element. The other element should be in the document already. Throws an Error if the component is already rendered.
sibling
{Node
}
.setAllowAutoFocus(allow)
Inherited from goog.ui.Menu
.
Sets whether the menu can automatically move focus to its key event target when it is set to visible.
allow
{boolean
}
.setAllowHighlightDisabled(allow)
Inherited from goog.ui.Menu
.
Sets whether the menu will highlight disabled menu items or skip to the next active item.
allow
{boolean
}
.setAllowMultiple(b)
Sets whether multiple items can be entered comma separated.
b
{boolean
}
.setElementInternal(element)
[protected]Inherited from goog.ui.Component
.
Sets the component's root element to the given element. Considered protected and final. This should generally only be called during createDom. Setting the element does not actually change which element is rendered, only the element that is associated with this UI component.
element
{Element
}
.setEnabled(enable)
Inherited from goog.ui.Container
.
Enables/disables the container based on the {@code enable} argument. Dispatches an {@code ENABLED} or {@code DISABLED} event prior to changing the container's state, which may be caught and canceled to prevent the container from changing state. Also enables/disables child controls.
enable
{boolean
}
.setFilter(str)
Sets the filter string.
str
{?string
}
.setFilterFromIndex(index)
Sets the index of first item that should be affected by the filter. Menu items with a lower index will not be affected by the filter.
index
{number
}
.setFilterLabel(label)
Sets the filter label (the label displayed in the filter input element if no text has been entered).
label
{?string
}
.setFocusable(focusable)
Inherited from goog.ui.Container
.
Sets whether the container is focusable. The default is true. Focusable containers always have a tab index and allocate a key handler to handle keyboard events while focused.
focusable
{boolean
}
.setFocusableChildrenAllowed(focusable)
Inherited from goog.ui.Container
.
Sets whether the container allows children to be focusable, false otherwise. Only effective if the container is not focusable.
focusable
{boolean
}
.setHighlighted(item)
Inherited from goog.ui.Container
.
Highlights the given item if it exists and is a child of the container; otherwise un-highlights the currently highlighted item.
item
{goog.ui.Control
}
.setHighlightedIndex(index)
Sets the highlighted index, unless the HIGHLIGHT event is intercepted and cancelled. -1 = no highlight. Also scrolls the menu item into view.
index
{number
}
.setHighlightedIndexFromKeyEvent(index)
[protected]Inherited from goog.ui.Container
.
Helper method that sets the highlighted index to the given index in response to a keyboard event. The base class implementation simply calls the {@link #setHighlightedIndex} method, but subclasses can override this behavior as needed.
index
{number
}
.setId(id)
Inherited from goog.ui.Component
.
Assigns an ID to this component instance. It is the caller's responsibility to guarantee that the ID is unique. If the component is a child of a parent component, then the parent component's child index is updated to reflect the new ID; this may throw an error if the parent already has a child with an ID that conflicts with the new ID.
id
{string
}
.setKeyEventTarget(element)
Inherited from goog.ui.Container
.
Attaches an element on which to listen for key events.
element
{Element
|undefined
}
.setModel(obj)
Inherited from goog.ui.Component
.
Sets the model associated with the UI component.
obj
{*}
.setMouseButtonPressed(pressed)
Inherited from goog.ui.Container
.
Sets or clears the "mouse button pressed" flag.
pressed
{boolean
}
.setOpenFollowsHighlight(follow)
Inherited from goog.ui.Container
.
Sets whether highlighting a child component should also open it.
follow
{boolean
}
.setOrientation(orientation)
Inherited from goog.ui.Container
.
Sets the container's orientation.
orientation
{goog.ui.Container.Orientation
}
.setParent(parent)
Inherited from goog.ui.Component
.
Sets the parent of this component to use for event bubbling. Throws an error if the component already has a parent or if an attempt is made to add a component to itself as a child. Callers must use {@code removeChild} or {@code removeChildAt} to remove components from their containers before calling this method.
parent
{goog.ui.Component
}
.setParentEventTarget(parent)
Inherited from goog.ui.Component
.
Overrides {@link goog.events.EventTarget#setParentEventTarget} to throw an error if the parent component is set, and the argument is not the parent.
parent
{goog.events.EventTarget
?}
.setPersistentVisibility(child, persistent)
Sets whether the specified child should be affected (shown/hidden) by the filter criteria.
child
{goog.ui.Component
}
persistent
{boolean
}
.setPosition(x, opt_y)
Inherited from goog.ui.Menu
.
Sets the position of the menu relative to the view port.
x
{number
|goog.math.Coordinate
}
opt_y
{number
=}
.setRenderer(renderer)
Inherited from goog.ui.Container
.
Registers the given renderer with the container. Changing renderers after the container has already been rendered or decorated is an error.
renderer
{goog.ui.ContainerRenderer
}
.setRightToLeft(rightToLeft)
Inherited from goog.ui.Component
.
Set is right-to-left. This function should be used if the component needs to know the rendering direction during dom creation (i.e. before {@link #enterDocument} is called and is right-to-left is set).
rightToLeft
{boolean
}
.setVisible(opt_e)
Shows or hides the container. Does nothing if the container already has the requested visibility. Otherwise, dispatches a SHOW or HIDE event as appropriate, giving listeners a chance to prevent the visibility change.
opt_e
{goog.events.Event
=}
boolean
}
.wasDecorated()
Inherited from goog.ui.Component
.
boolean
}