Lines Matching refs:item

26    * Helper function that finds the first ancestor tree item.
28 * @return {cr.ui.TreeItem} The found tree item or null if not found.
63 * Returns the tree item that are children of this tree.
70 * Adds a tree item to the tree.
71 * @param {!cr.ui.TreeItem} treeItem The item to add.
78 * Adds a tree item at the given index.
79 * @param {!cr.ui.TreeItem} treeItem The item to add.
80 * @param {number} index The index where we want to add the item.
88 * Removes a tree item child.
89 * @param {!cr.ui.TreeItem} treeItem The tree item to remove.
139 var item = this.selectedItem;
140 if (!item)
143 var rtl = getComputedStyle(item).direction == 'rtl';
147 itemToSelect = item ? getPrevious(item) :
151 itemToSelect = item ? getNext(item) :
162 if (item.expanded)
163 item.expanded = false;
165 itemToSelect = findTreeItem(item.parentNode);
167 if (!item.expanded)
168 item.expanded = true;
170 itemToSelect = item.items[0];
188 * The selected tree item or null if none.
194 set selectedItem(item) {
196 if (oldSelectedItem != item) {
197 // Set the selectedItem_ before deselecting the old item since we only
199 this.selectedItem_ = item;
204 if (item)
205 item.selected = true;
234 * This is used as a blueprint for new tree item elements.
239 treeItem.className = 'tree-item';
250 * Creates a new tree item.
277 * The depth of the tree item.
296 for (var i = 0, item; item = items[i]; i++) {
297 item.setDepth_(depth + 1);
303 * Adds a tree item as a child.
311 * Adds a tree item as a child at a given index.
324 * @param {!cr.ui.TreeItem} child The tree item child to remove.
327 // If we removed the selected item we should become selected.
339 * The parent tree item.
351 * The tree that the tree item belongs to or null of no added to a tree.
363 * Whether the tree item is expanded or not.
445 * Whether the tree item is selected or not.
472 * Whether the tree item has children.
490 * Whether the tree item has children.
498 * Whether the tree item has children.
510 * Called when the user clicks on a tree item. This is forwarded from the
522 * Makes the tree item user editable. If the user renamed the item a
541 // Calling tree.focus blurs the input which will make the tree item
576 // item.
617 * Helper function that returns the next visible tree item.
618 * @param {cr.ui.TreeItem} item The tree item.
619 * @return {cr.ui.TreeItem} The found item or null.
621 function getNext(item) {
622 if (item.expanded) {
623 var firstChild = item.items[0];
629 return getNextHelper(item);
633 * Another helper function that returns the next visible tree item.
634 * @param {cr.ui.TreeItem} item The tree item.
635 * @return {cr.ui.TreeItem} The found item or null.
637 function getNextHelper(item) {
638 if (!item)
641 var nextSibling = item.nextElementSibling;
645 return getNextHelper(item.parentItem);
649 * Helper function that returns the previous visible tree item.
650 * @param {cr.ui.TreeItem} item The tree item.
651 * @return {cr.ui.TreeItem} The found item or null.
653 function getPrevious(item) {
654 var previousSibling = item.previousElementSibling;
655 return previousSibling ? getLastHelper(previousSibling) : item.parentItem;
659 * Helper function that returns the last visible tree item in the subtree.
660 * @param {cr.ui.TreeItem} item The item to find the last visible item for.
661 * @return {cr.ui.TreeItem} The found item or null.
663 function getLastHelper(item) {
664 if (!item)
666 if (item.expanded && item.hasChildren) {
667 var lastChild = item.items[item.items.length - 1];
670 return item;