| goog.Disposable | |
| goog.events.EventTarget | goog.Disposable |
| goog.ui.Component | goog.events.EventTarget |
| goog.ui.tree.BaseNode | goog.ui.Component |
| goog.ui.tree.TreeControl | goog.ui.tree.BaseNode |
|
html
:
The HTML content of the node label.
|
|
opt_config
:
The configuration for the tree. See goog.ui.tree.TreeControl.DefaultConfig. If not specified, a default config will be used.
|
|
opt_domHelper
:
Optional DOM helper.
|
attachEvents_()
Adds the event listeners to the tree.
|
code » | ||
clearTypeAhead()
Clear the typeahead buffer.
|
code » | ||
|
Creates a new tree node using the same config as the root.
Arguments:
Returns:
The new item.
|
code » | ||
detachEvents_()
Removes the event listeners from the tree.
|
code » | ||
enterDocument()
No description.
|
code » | ||
exitDocument()
No description.
|
code » | ||
|
Returns the source for the icon.
Returns:
Src for the icon.
|
code » | ||
getDepth()
No description.
|
code » | ||
getExpandIconElement()
No description.
|
code » | ||
getExpandIconHtml()
No description.
|
code » | ||
getExpanded()
No description.
|
code » | ||
getIconElement()
No description.
|
code » | ||
|
Finds the containing node given an event.
Arguments:
Returns:
The containing node or null if no node is found.
|
code » | ||
getRowClassName()
No description.
|
code » | ||
|
Returns the selected item.
Returns:
The currently selected item.
|
code » | ||
|
No description.
Returns:
Whether to show expand icons.
|
code » | ||
|
No description.
Returns:
Whether to show lines.
|
code » | ||
|
No description.
Returns:
Whether to show root lines.
|
code » | ||
|
No description.
Returns:
Whether to show the root node.
|
code » | ||
getTree()
No description.
|
code » | ||
handleBlur_(e)
Handles blur on the tree.
Arguments:
|
code » | ||
handleFocus_(e)
Handles focus on the tree.
Arguments:
|
code » | ||
|
Handles key down on the tree.
Arguments:
Returns:
The handled value.
|
code » | ||
handleMouseEvent_(e)
Handles mouse events.
Arguments:
|
code » | ||
|
No description.
Returns:
Whether the tree has keyboard focus.
|
code » | ||
initAccessibility()
Add roles and states.
|
code » | ||
removeNode(node)
Allows the caller to notify that the given node is being removed from the
tree.
Arguments:
|
code » | ||
reveal()
Expands the parent chain of this node so that it is visible.
|
code » | ||
setExpanded(expanded)
No description.
Arguments:
|
code » | ||
setNode(node)
Allows the caller to notify that the given node has been added or just had
been updated in the tree.
Arguments:
|
code » | ||
setSelectedItem(node)
Sets the selected item.
Arguments:
|
code » | ||
setShowExpandIcons(b)
Sets whether to show expand icons.
Arguments:
|
code » | ||
setShowLines(b)
Sets whether to show lines.
Arguments:
|
code » | ||
setShowRootLines(b)
Sets whether to show root lines.
Arguments:
|
code » | ||
setShowRootNode(b)
Sets whether to show the root node.
Arguments:
|
code » | ||
updateExpandIcon()
No description.
|
code » | ||
updateLinesAndExpandIcons_()
Updates the lines after the tree has been drawn.
|
code » |
|
Adds a node as a child to the current node.
Arguments:
Returns:
The added child.
|
code » | ||||
addChildAt(child, index, opt_render)
The method assumes that the child doesn't have parent node yet.
The
opt_render argument is not used. If the parent node is expanded,
the child node's state will be the same as the parent's. Otherwise the
child's DOM tree won't be created.
Arguments:
|
code » | ||||
collapse()
Collapses the node.
|
code » | ||||
collapseAll()
Collapses the children and the node.
|
code » | ||||
collapseChildren()
Collapses the children of the node.
|
code » | ||||
|
Computes the depth of the node in the tree.
Called only by getDepth, when the depth hasn't already been cached.
Returns:
The non-negative depth of this node (the root is zero).
|
code » | ||||
|
Returns true if the node is a descendant of this node
Arguments:
Returns:
True if the node is a descendant of this node, false otherwise.
|
code » | ||||
createDom()
No description.
|
code » | ||||
deselect()
Use
tree.setSelectedItem(null).
Originally it was intended to deselect the node but never worked.
|
code » | ||||
disposeInternal()
No description.
|
code » | ||||
enterDocument()
No description.
|
code » | ||||
exitDocument()
No description.
|
code » | ||||
expand()
Expands the node.
|
code » | ||||
expandAll()
Expands the children and the node.
|
code » | ||||
expandChildren()
Expands the children of the node.
|
code » | ||||
|
No description.
Returns:
The element after the label.
|
code » | ||||
|
Returns the html that appears after the label. This is useful if you want to
put extra UI on the row of the label but not inside the anchor tag.
Returns:
The html.
|
code » | ||||
|
No description.
Arguments:
Returns:
The child at the given index; null if none.
|
code » | ||||
|
Returns the children of this node.
Returns:
The children.
|
code » | ||||
|
No description.
Returns:
The div containing the children.
|
code » | ||||
getClientData()
⇒ *
Use #getModel instead.
No description.
Returns:
*
Data set by the client.
|
code » | ||||
|
No description.
Returns:
The configuration for the tree.
|
code » | ||||
|
Returns the depth of the node in the tree. Should not be overridden.
Returns:
The non-negative depth of this node (the root is zero).
|
code » | ||||
|
No description.
Returns:
The element for the tree node.
|
code » | ||||
|
No description.
Returns:
The class names of the icon used for expanding the node.
|
code » | ||||
|
No description.
Returns:
The expanded icon element.
|
code » | ||||
|
No description.
Returns:
The source for the icon.
|
code » | ||||
|
No description.
Returns:
Whether the node is expanded.
|
code » | ||||
|
Gets the icon class for when the node is expanded.
Returns:
The class.
|
code » | ||||
|
No description.
Returns:
The first child of this node.
|
code » | ||||
|
Returns the html of the label.
Returns:
The html string of the label.
|
code » | ||||
|
Gets the icon class for the node.
Returns:
s The icon source.
|
code » | ||||
|
No description.
Returns:
The icon element.
|
code » | ||||
|
No description.
Returns:
The html for the icon.
|
code » | ||||
|
No description.
Returns:
The label element.
|
code » | ||||
|
No description.
Returns:
The html for the label.
|
code » | ||||
|
No description.
Returns:
The last child of this node.
|
code » | ||||
|
No description.
Returns:
The last shown descendant.
|
code » | ||||
|
No description.
Returns:
The line style.
|
code » | ||||
|
No description.
Returns:
The line style.
|
code » | ||||
|
No description.
Returns:
The next node to show or null if there isn't a next node to show.
|
code » | ||||
|
No description.
Returns:
The next sibling of this node.
|
code » | ||||
|
No description.
Returns:
The pixel indent of the row.
|
code » | ||||
|
No description.
Returns:
The previous node to show.
|
code » | ||||
|
No description.
Returns:
The previous sibling of this node.
|
code » | ||||
|
No description.
Returns:
The class name for the row.
|
code » | ||||
|
No description.
Returns:
The row is the div that is used to draw the node without the children.
|
code » | ||||
|
No description.
Returns:
The html for the row.
|
code » | ||||
|
Returns the text of the label. If the text was originally set as HTML, the
return value is unspecified.
Returns:
The plain text of the label.
|
code » | ||||
|
Returns the text of the tooltip.
Returns:
The tooltip text.
|
code » | ||||
initAccessibility()
Adds roles and states.
|
code » | ||||
|
No description.
Returns:
Whether the node is the last sibling.
|
code » | ||||
|
No description.
Returns:
Whether the node is selected.
|
code » | ||||
|
No description.
Returns:
Whether the node is collapsible by user actions.
|
code » | ||||
onClick_(e)
Handles a click event.
Arguments:
|
code » | ||||
onDoubleClick_(e)
Handles a double click event.
Arguments:
|
code » | ||||
|
Handles a key down event.
Arguments:
Returns:
The handled value.
|
code » | ||||
onKeyPress_(e)
Handles a key down event.
Arguments:
|
code » | ||||
onMouseDown(e)
Handles mouse down event.
Arguments:
|
code » | ||||
onTimeoutSelect_()
Handler for setting focus asynchronously.
|
code » | ||||
remove()
Use #removeChild.
No description.
|
code » | ||||
|
Removes a child. The caller is responsible for disposing the node.
Arguments:
Returns:
The child that was removed.
|
code » | ||||
reveal()
Expands the parent chain of this node so that it is visible.
|
code » | ||||
select()
Selects the node.
|
code » | ||||
setAfterLabelHtml(html)
Sets the html that appears after the label. This is useful if you want to
put extra UI on the row of the label but not inside the anchor tag.
Arguments:
|
code » | ||||
setClientData(data)
Use #setModel instead.
Sets client data to associate with the node.
Arguments:
|
code » | ||||
setDepth_(depth)
Changes the depth of a node (and all its descendants).
Arguments:
|
code » | ||||
setExpanded(expanded)
Sets the node to be expanded.
Arguments:
|
code » | ||||
setExpandedIconClass(s)
Sets the icon class for when the node is expanded.
Arguments:
|
code » | ||||
setExpandedInternal(expanded)
Sets the node to be expanded internally, without state change events.
Arguments:
|
code » | ||||
setHtml(s)
Sets the html of the label.
Arguments:
|
code » | ||||
setIconClass(s)
Sets the icon class for the node.
Arguments:
|
code » | ||||
setIsUserCollapsible(isCollapsible)
Sets whether the node will allow the user to collapse it.
Arguments:
|
code » | ||||
setSelectedInternal(selected)
Called from the tree to instruct the node change its selection state.
Arguments:
|
code » | ||||
setText(s)
Sets the text of the label.
Arguments:
|
code » | ||||
setToolTip(s)
Sets the text of the tooltip.
Arguments:
|
code » | ||||
setTreeInternal(tree)
Internal method that is used to set the tree control on the node.
Arguments:
|
code » | ||||
toHtml(sb)
Returns the html for the node.
Arguments:
|
code » | ||||
toggle()
Toggles the expanded state of the node.
|
code » | ||||
updateExpandIcon()
Updates the expand icon of the node.
|
code » | ||||
updateIcon_()
Updates the icon of the node. Assumes that this.getElement() is created.
|
code » | ||||
updateRow()
Updates the row styles.
|
code » |
addChild(child, opt_render)
Adds the specified component as the last child of this component. See
goog.ui.Component#addChildAt for detailed semantics.
Arguments:
|
code » | ||||
addChildAt(child, index, opt_render)
⇒ undefined
Adds the specified component as a child of this component at the given
0-based index.
Both
addChild and addChildAt assume the following contract
between parent and child components:
parent.addChild(child) will throw an error if the
child component is already in the document, but the parent isn't.
Clients of this API may call addChild and addChildAt with
opt_render set to true. If opt_render is true, calling these
methods will automatically render the child component's element into the
parent component's element. However, parent.addChild(child, true)
will throw an error if:
opt_render is true and the parent component is not already
in the document, enterDocument will not be called on this component
at this point.
Finally, this method also throws an error if the new child already has a
different parent, or the given index is out of bounds.
Arguments:
Returns:
undefined
Nada.
|
code » | ||||
|
Determines if a given element can be decorated by this type of component.
This method should be overridden by inheriting objects.
|
code » | ||||
createDom()
Creates the initial DOM representation for the component. The default
implementation is to set this.element_ = div.
|
code » | ||||
decorate(element)
Decorates the element for the UI component.
Arguments:
|
code » | ||||
decorateInternal(element)
Actually decorates the element. Should be overridden by inheriting objects.
This method can assume there are checks to ensure the component has not
already been rendered have occurred and that enter document will be called
afterwards. This method is considered protected.
Arguments:
|
code » | ||||
disposeInternal()
Disposes of the component. Calls
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.
|
code » | ||||
enterDocument()
Called when the component's element is known to be in the document. Anything
using document.getElementById etc. should be done at this stage.
If the component contains child components, this call is propagated to its
children.
|
code » | ||||
exitDocument()
Called by dispose to clean up the elements and listeners created by a
component, or by a parent component/application who has removed the
component from the document but wants to reuse it later.
If the component contains child components, this call is propagated to its
children.
It should be possible for the component to be rendered again once this method
has been called.
|
code » | ||||
forEachChild(f, opt_obj)
Calls the given function on each of this component's children in order. If
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.
|
code » | ||||
|
Returns the child with the given ID, or null if no such child exists.
Arguments:
Returns:
The child with the given ID; null if none.
|
code » | ||||
|
Returns the child at the given index, or null if the index is out of bounds.
Arguments:
Returns:
The child at the given index; null if none.
|
code » | ||||
|
Returns the number of children of this component.
Returns:
The number of children.
|
code » | ||||
|
Returns an array containing the IDs of the children of this component, or an
empty array if the component has no children.
Returns:
Child component IDs.
|
code » | ||||
|
Returns the DOM element into which child components are to be rendered,
or null if the component itself hasn't been rendered yet. This default
implementation returns the component's root element. Subclasses with
complex DOM structures must override this method.
Returns:
Element to contain child elements (null if none).
|
code » | ||||
|
Returns the dom helper that is being used on this component.
Returns:
The dom helper used on this component.
|
code » | ||||
|
Gets the component's element.
Returns:
The element for the component.
|
code » | ||||
|
Returns the first element in this component's DOM with the provided
className.
|
code » | ||||
|
Helper function for returning an element in the document with a unique id
generated using makeId().
|
code » | ||||
getElementsByClass(className)
⇒ {length: number}
Returns an array of all the elements in this component's DOM with the
provided className.
Arguments:
Returns:
{length: number}
The items found with the class name provided.
|
code » | ||||
|
Helper function for returning the fragment portion of an id generated using
makeId().
|
code » | ||||
|
Returns the event handler for this component, lazily created the first time
this method is called.
Returns:
Event handler for this component.
|
code » | ||||
|
Gets the unique ID for the instance of this component. If the instance
doesn't already have an ID, generates one on the fly.
Returns:
Unique component ID.
|
code » | ||||
getModel()
⇒ *
Returns the model associated with the UI component.
Returns:
*
The model.
|
code » | ||||
|
Returns the component's parent, if any.
Returns:
The parent component.
|
code » | ||||
|
Returns true if the component has children.
Returns:
True if the component has children.
|
code » | ||||
|
Returns the 0-based index of the given child component, or -1 if no such
child is found.
Arguments:
Returns:
0-based index of the child component; -1 if not found.
|
code » | ||||
|
Determines whether the component has been added to the document.
Returns:
TRUE if rendered. Otherwise, FALSE.
|
code » | ||||
|
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.
Returns:
Whether the control is rendered right-to-left.
|
code » | ||||
|
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.
|
code » | ||||
|
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.
|
code » | ||||
|
Removes the given child from this component, and returns it. Throws an error
if the argument is invalid or if the specified child isn't found in the
parent component. The argument can either be a string (interpreted as the
ID of the child component to remove) or the child component itself.
If
opt_unrender is true, calls goog.ui.component#exitDocument
on the removed child, and subsequently detaches the child's DOM from the
document. Otherwise it is the caller's responsibility to clean up the child
component's DOM.
Arguments:
Returns:
The removed component, if any.
|
code » | ||||
|
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 goog.ui.Component#removeChild for
detailed semantics.
Arguments:
Returns:
The removed component, if any.
|
code » | ||||
removeChildren(opt_unrender)
Removes every child component attached to this one.
Arguments:
|
code » | ||||
render(opt_parentElement)
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
enterDocument
on this component.
Throws an Error if the component is already rendered.
Arguments:
|
code » | ||||
renderBefore(sibling)
Renders the component before another element. The other element should be in
the document already.
Throws an Error if the component is already rendered.
Arguments:
|
code » | ||||
render_(opt_parentElement, opt_beforeNode)
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
enterDocument
on this component.
Throws an Error if the component is already rendered.
|
code » | ||||
setElementInternal(element)
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.
Arguments:
|
code » | ||||
setId(id)
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.
Arguments:
|
code » | ||||
setModel(obj)
Sets the model associated with the UI component.
Arguments:
|
code » | ||||
setParent(parent)
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
removeChild
or removeChildAt to remove components from their containers before
calling this method.
Arguments:
|
code » | ||||
setParentEventTarget(parent)
Overrides goog.events.EventTarget#setParentEventTarget to throw an
error if the parent component is set, and the argument is not the parent.
Arguments:
|
code » | ||||
setRightToLeft(rightToLeft)
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
#enterDocument is called and is right-to-left is set).
Arguments:
|
code » | ||||
|
No description.
Returns:
Whether the component was decorated.
|
code » |
addEventListener(type, handler, opt_capture, opt_handlerScope)
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.
Arguments:
|
code » | |||||
|
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.
Arguments:
Returns:
If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.
|
code » | |||||
disposeInternal()
Unattach listeners from this object. Classes that extend EventTarget may
need to override this method in order to remove references to DOM Elements
and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() {
MyClass.superClass_.disposeInternal.call(this);
// Dispose logic for MyClass
};
|
code » | |||||
|
Returns the parent of this event target to use for bubbling.
Returns:
The parent EventTarget or null if there is no parent.
|
code » | |||||
removeEventListener(type, handler, opt_capture, opt_handlerScope)
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.
Arguments:
|
code » | |||||
setParentEventTarget(parent)
Sets the parent of this event target to use for bubbling.
Arguments:
|
code » |
dispose()
⇒ undefined
Disposes of the object. If the object hasn't already been disposed of, calls
#disposeInternal. Classes that extend
goog.Disposable should
override #disposeInternal in order to delete references to COM
objects, DOM nodes, and other disposable objects. Reentrant.
Returns:
undefined
Nothing.
|
code » | ||
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend
goog.Disposable should
override this method.
Not reentrant. To avoid calling it twice, it must only be called from the
subclass' disposeInternal method. Everywhere else the public
dispose method must be used.
For example:
mypackage.MyClass = function() {
goog.base(this);
// Constructor logic specific to MyClass.
...
};
goog.inherits(mypackage.MyClass, goog.Disposable);
mypackage.MyClass.prototype.disposeInternal = function() {
goog.base(this, 'disposeInternal');
// Dispose logic specific to MyClass.
...
};
|
code » | ||
|
Use #isDisposed instead.
No description.
Returns:
Whether the object has been disposed of.
|
code » | ||
|
No description.
Returns:
Whether the object has been disposed of.
|
code » | ||
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed
together.
Arguments:
|
code » |
|
The object handling focus events.
|
Code » | |
|
Child node that currently has focus.
|
Code » | |
|
Whether the tree is focused.
|
Code » | |
|
The object handling keyboard events.
|
Code » | |
|
Logger
|
Code » | |
|
Whether to show expanded lines.
|
Code » | |
|
Whether to show lines.
|
Code » | |
|
Whether to show the root lines.
|
Code » | |
|
Whether to show the root node.
|
Code » | |
|
Used for typeahead support.
|
Code » |
|
HTML that can appear after the label (so not inside the anchor).
|
Code » | |
|
The configuration for the tree.
|
Code » | |
|
Nesting depth of this node; cached result of computeDepth_.
-1 if value has not been cached.
|
Code » | |
|
Whether the tree node is expanded.
|
Code » | |
|
HTML content of the node label.
|
Code » | |
|
Whether to allow user to collapse this node.
|
Code » | |
|
Whether the tree item is selected.
|
Code » | |
|
Tooltip for the tree item
|
Code » |
|
Map of child component IDs to child components. Used for constant-time
random access to child components by ID. Lazily initialized on first use.
Must be kept in sync with
children_. This property is strictly
private and must not be accessed directly outside of this class!
We use a plain Object, not a goog.structs.Map, for simplicity.
This means components can't have children with IDs such as 'constructor' or
'valueOf', but this shouldn't really be an issue in practice, and if it is,
we can always fix it later without changing the API.
|
Code » | |
|
Array of child components. Lazily initialized on first use. Must be kept in
sync with
childIndex_. This property is strictly private and must
not be accessed directly outside of this class!
|
Code » | |
|
DomHelper used to interact with the document, allowing components to be
created in a different window.
|
Code » | |
|
The DOM element for the component.
|
Code » | |
|
Event handler.
TODO(user): rename it to handler_ after all component subclasses in
inside Google have been cleaned up.
Code search: http://go/component_code_search
|
Code » | |
|
Generator for unique IDs.
|
Code » | |
|
Unique ID of the component, lazily initialized in goog.ui.Component#getId if needed. This property is strictly private and
must not be accessed directly outside of this class!
|
Code » | |
|
Whether the component is in the document.
|
Code » | |
model_
: *
Arbitrary data object associated with the component. Such as meta-data.
|
Code » | |
|
Parent component to which events will be propagated. This property is
strictly private and must not be accessed directly outside of this class!
|
Code » | |
|
Whether the component is rendered right-to-left. Right-to-left is set
lazily when #isRightToLeft is called the first time, unless it has
been set by calling #setRightToLeft explicitly.
|
Code » | |
|
Flag used to keep track of whether a component decorated an already existing
element or whether it created the DOM itself.
If an element is decorated, dispose will leave the node in the document.
It is up to the app to remove the node.
If an element was rendered, dispose will remove the node automatically.
|
Code » |