goog.ui.TabBar
Classgoog.ui.TabBar
> goog.ui.Container
> goog.ui.Component
> goog.events.EventTarget
> goog.Disposable
goog.ui.TabBar(opt_location, opt_renderer, opt_domHelper)
Tab bar UI component. A tab bar contains tabs, rendered above, below, before, or after tab contents. Tabs in tab bars dispatch the following events:
opt_location
{goog.ui.TabBar.Location
=}
opt_renderer
{goog.ui.TabBarRenderer
=}
opt_domHelper
{goog.dom.DomHelper
=}
goog.ui.TabBar.Location
EnumTab bar location relative to tab contents. … 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
=}
.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.Container
.
Returns whether the given item can be highlighted.
item
{goog.ui.Control
}
boolean
}
.createDom()
Inherited from goog.ui.Container
.
Creates the container's DOM.
.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
}
.decorateInternal(element)
[protected]Inherited from goog.ui.Container
.
Decorates the given element with this container. Overrides {@link goog.ui.Component#decorateInternal}. Considered protected.
element
{Element
}
.deselectIfSelected(tab)
[protected]If the specified tab is the currently selected tab, deselects it, and selects the closest selectable tab in the tab bar (first looking before, then after the deselected tab). Does nothing if the argument is not the currently selected tab. Called internally when a tab is removed, hidden, or disabled, to ensure that another tab is selected instead.
tab
{goog.ui.Control
?}
.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()
[protected]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.
.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()
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
=}
.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()
Inherited from goog.ui.Container
.
Returns the DOM element into which child components are to be rendered, or null if the container itself hasn't been rendered yet. Overrides {@link goog.ui.Component#getContentElement} by delegating to the renderer.
Element
}
.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
}
.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
}
.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
}
.getLocation()
goog.ui.TabBar.Location
}
.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
}
.getOrientationFromLocation(location)
Returns the {@link goog.ui.Container.Orientation} that is implied by the given {@link goog.ui.TabBar.Location}.
location
{goog.ui.TabBar.Location
}
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
}
.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
}
.getSelectedTab()
goog.ui.Control
?}
.getSelectedTabIndex()
number
}
.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.Container
.
Handles ENTER events raised by child controls when they are navigated to.
e
{goog.events.Event
}
boolean
}
.handleFocus(e)
[protected]Handles focus events dispatched by the tab bar's key event target. If no tab is currently highlighted, highlights the selected tab or the first tab if no tab is selected either.
e
{goog.events.Event
}
.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)
Inherited from goog.ui.Container
.
Attempts to handle a keyboard event, if the control is enabled, by calling {@link handleKeyEventInternal}. Considered protected; should only be used within this package and by subclasses.
e
{goog.events.KeyEvent
}
boolean
}
.handleKeyEventInternal(e)
Inherited from goog.ui.Container
.
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
}
.handleTabDisable(e)
[protected]Handles {@code DISABLE} events displayed by tabs.
e
{goog.events.Event
}
.handleTabHide(e)
[protected]Handles {@code HIDE} events displayed by tabs.
e
{goog.events.Event
}
.handleTabSelect(e)
[protected]Handles {@code SELECT} events dispatched by tabs as they become selected.
e
{goog.events.Event
}
.handleTabUnselect(e)
[protected]Handles {@code UNSELECT} events dispatched by tabs as they become deselected.
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
}
.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).
.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
}
.isAutoSelectTabs()
boolean
}
.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
}
.isSelectableTab(tab)
[protected]Returns true if the tab is selectable, false otherwise. Only visible and enabled tabs are selectable.
tab
{goog.ui.Control
}
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
}
.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(tab, opt_unrender)
Removes the tab from the tab bar. Overrides the superclass implementation by deselecting the tab being removed. Since {@link #removeChildAt} uses {@link #removeChild} internally, we only need to override this method.
tab
{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
=}
.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
}
.setAutoSelectTabs(enable)
Enables or disables auto-selecting tabs using the keyboard. If auto-select is enabled, keyboard navigation switches tabs immediately, otherwise it just moves the highlight.
enable
{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
}
.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)
Inherited from goog.ui.Container
.
Highlights the item at the given 0-based index (if any). If another item was previously highlighted, it is un-highlighted.
index
{number
}
.setHighlightedIndexFromKeyEvent(index)
[protected]Highlights the tab at the given index in response to a keyboard event. Overrides the superclass implementation by also selecting the tab if {@link #isAutoSelectTabs} returns true.
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
}
.setLocation(location)
Sets the location of the tab bar relative to tab contents.
location
{goog.ui.TabBar.Location
}
.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
?}
.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
}
.setSelectedTab(tab)
Selects the given tab.
tab
{goog.ui.Control
?}
.setSelectedTabIndex(index)
Selects the tab at the given index.
index
{number
}
.setVisible(visible, opt_force)
Inherited from goog.ui.Container
.
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.
visible
{boolean
}
opt_force
{boolean
=}
boolean
}
.wasDecorated()
Inherited from goog.ui.Component
.
boolean
}