Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js

Issue 2716983002: [Devtools] Moved DataGridNode's .parent property to proper getter/setter (Closed)
Patch Set: [Devtools] Moved DataGridNode's .parent property to proper getter/setter Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 while (nextSelectedNode && !nextSelectedNode.selectable) 797 while (nextSelectedNode && !nextSelectedNode.selectable)
798 nextSelectedNode = nextSelectedNode.traverseNextNode(true); 798 nextSelectedNode = nextSelectedNode.traverseNextNode(true);
799 handled = nextSelectedNode ? true : false; 799 handled = nextSelectedNode ? true : false;
800 } else if (event.key === 'ArrowLeft') { 800 } else if (event.key === 'ArrowLeft') {
801 if (this.selectedNode.expanded) { 801 if (this.selectedNode.expanded) {
802 if (event.altKey) 802 if (event.altKey)
803 this.selectedNode.collapseRecursively(); 803 this.selectedNode.collapseRecursively();
804 else 804 else
805 this.selectedNode.collapse(); 805 this.selectedNode.collapse();
806 handled = true; 806 handled = true;
807 } else if (this.selectedNode.parent && !this.selectedNode.parent._isRoot) { 807 } else if (this.selectedNode.parent() && !this.selectedNode.parent()._isRo ot) {
808 handled = true; 808 handled = true;
809 if (this.selectedNode.parent.selectable) { 809 if (this.selectedNode.parent().selectable) {
810 nextSelectedNode = this.selectedNode.parent; 810 nextSelectedNode = this.selectedNode.parent();
811 handled = nextSelectedNode ? true : false; 811 handled = nextSelectedNode ? true : false;
812 } else if (this.selectedNode.parent) { 812 } else if (this.selectedNode.parent()) {
813 this.selectedNode.parent.collapse(); 813 this.selectedNode.parent().collapse();
814 } 814 }
815 } 815 }
816 } else if (event.key === 'ArrowRight') { 816 } else if (event.key === 'ArrowRight') {
817 if (!this.selectedNode.revealed) { 817 if (!this.selectedNode.revealed) {
818 this.selectedNode.reveal(); 818 this.selectedNode.reveal();
819 handled = true; 819 handled = true;
820 } else if (this.selectedNode.hasChildren()) { 820 } else if (this.selectedNode.hasChildren()) {
821 handled = true; 821 handled = true;
822 if (this.selectedNode.expanded) { 822 if (this.selectedNode.expanded) {
823 nextSelectedNode = this.selectedNode.children[0]; 823 nextSelectedNode = this.selectedNode.children[0];
(...skipping 25 matching lines...) Expand all
849 event.consume(true); 849 event.consume(true);
850 } 850 }
851 851
852 /** 852 /**
853 * @param {?NODE_TYPE} root 853 * @param {?NODE_TYPE} root
854 * @param {boolean} onlyAffectsSubtree 854 * @param {boolean} onlyAffectsSubtree
855 */ 855 */
856 updateSelectionBeforeRemoval(root, onlyAffectsSubtree) { 856 updateSelectionBeforeRemoval(root, onlyAffectsSubtree) {
857 var ancestor = this.selectedNode; 857 var ancestor = this.selectedNode;
858 while (ancestor && ancestor !== root) 858 while (ancestor && ancestor !== root)
859 ancestor = ancestor.parent; 859 ancestor = ancestor.parent();
860 // Selection is not in the subtree being deleted. 860 // Selection is not in the subtree being deleted.
861 if (!ancestor) 861 if (!ancestor)
862 return; 862 return;
863 863
864 var nextSelectedNode; 864 var nextSelectedNode;
865 // Skip subtree being deleted when looking for the next selectable node. 865 // Skip subtree being deleted when looking for the next selectable node.
866 for (ancestor = root; ancestor && !ancestor.nextSibling; ancestor = ancestor .parent) { 866 for (ancestor = root; ancestor && !ancestor.nextSibling; ancestor = ancestor .parent()) {
867 } 867 }
868 if (ancestor) 868 if (ancestor)
869 nextSelectedNode = ancestor.nextSibling; 869 nextSelectedNode = ancestor.nextSibling;
870 while (nextSelectedNode && !nextSelectedNode.selectable) 870 while (nextSelectedNode && !nextSelectedNode.selectable)
871 nextSelectedNode = nextSelectedNode.traverseNextNode(true); 871 nextSelectedNode = nextSelectedNode.traverseNextNode(true);
872 872
873 if (!nextSelectedNode || nextSelectedNode.isCreationNode) { 873 if (!nextSelectedNode || nextSelectedNode.isCreationNode) {
874 nextSelectedNode = root.traversePreviousNode(true); 874 nextSelectedNode = root.traversePreviousNode(true);
875 while (nextSelectedNode && !nextSelectedNode.selectable) 875 while (nextSelectedNode && !nextSelectedNode.selectable)
876 nextSelectedNode = nextSelectedNode.traversePreviousNode(true); 876 nextSelectedNode = nextSelectedNode.traversePreviousNode(true);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 this._shouldRefreshChildren = true; 1250 this._shouldRefreshChildren = true;
1251 /** @type {!Object.<string, *>} */ 1251 /** @type {!Object.<string, *>} */
1252 this._data = data || {}; 1252 this._data = data || {};
1253 /** @type {boolean} */ 1253 /** @type {boolean} */
1254 this._hasChildren = hasChildren || false; 1254 this._hasChildren = hasChildren || false;
1255 /** @type {!Array.<!NODE_TYPE>} */ 1255 /** @type {!Array.<!NODE_TYPE>} */
1256 this.children = []; 1256 this.children = [];
1257 /** @type {?DataGrid.DataGrid} */ 1257 /** @type {?DataGrid.DataGrid} */
1258 this.dataGrid = null; 1258 this.dataGrid = null;
1259 /** @type {?NODE_TYPE} */ 1259 /** @type {?NODE_TYPE} */
1260 this.parent = null; 1260 this._parent = null;
1261 /** @type {?NODE_TYPE} */ 1261 /** @type {?NODE_TYPE} */
1262 this.previousSibling = null; 1262 this.previousSibling = null;
1263 /** @type {?NODE_TYPE} */ 1263 /** @type {?NODE_TYPE} */
1264 this.nextSibling = null; 1264 this.nextSibling = null;
1265 /** @type {number} */ 1265 /** @type {number} */
1266 this.disclosureToggleWidth = 10; 1266 this.disclosureToggleWidth = 10;
1267 1267
1268 /** @type {boolean} */ 1268 /** @type {boolean} */
1269 this.selectable = true; 1269 this.selectable = true;
1270 1270
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 */ 1326 */
1327 createCells(element) { 1327 createCells(element) {
1328 element.removeChildren(); 1328 element.removeChildren();
1329 var columnsArray = this.dataGrid._visibleColumnsArray; 1329 var columnsArray = this.dataGrid._visibleColumnsArray;
1330 for (var i = 0; i < columnsArray.length; ++i) 1330 for (var i = 0; i < columnsArray.length; ++i)
1331 element.appendChild(this.createCell(columnsArray[i].id)); 1331 element.appendChild(this.createCell(columnsArray[i].id));
1332 element.appendChild(this._createTDWithClass('corner')); 1332 element.appendChild(this._createTDWithClass('corner'));
1333 } 1333 }
1334 1334
1335 /** 1335 /**
1336 * @param {?NODE_TYPE} parentNode
1337 */
1338 setParent(parentNode) {
1339 delete this._depth;
1340 this._parent = parentNode;
luoe 2017/03/06 16:56:40 Do we need to recalculate depth of this node's gra
allada 2017/03/06 18:18:32 Done.
1341 }
1342
1343 /**
1344 * @return {?NODE_TYPE}
1345 */
1346 parent() {
1347 return this._parent;
1348 }
1349
1350 /**
1336 * @return {!Object.<string, *>} 1351 * @return {!Object.<string, *>}
1337 */ 1352 */
1338 get data() { 1353 get data() {
1339 return this._data; 1354 return this._data;
1340 } 1355 }
1341 1356
1342 /** 1357 /**
1343 * @param {!Object.<string, *>} x 1358 * @param {!Object.<string, *>} x
1344 */ 1359 */
1345 set data(x) { 1360 set data(x) {
1346 this._data = x || {}; 1361 this._data = x || {};
1347 this.refresh(); 1362 this.refresh();
1348 } 1363 }
1349 1364
1350 /** 1365 /**
1351 * @return {boolean} 1366 * @return {boolean}
1352 */ 1367 */
1353 get revealed() { 1368 get revealed() {
1354 if (this._revealed !== undefined) 1369 if (this._revealed !== undefined)
1355 return this._revealed; 1370 return this._revealed;
1356 1371
1357 var currentAncestor = this.parent; 1372 var currentAncestor = this.parent();
1358 while (currentAncestor && !currentAncestor._isRoot) { 1373 while (currentAncestor && !currentAncestor._isRoot) {
1359 if (!currentAncestor.expanded) { 1374 if (!currentAncestor.expanded) {
1360 this._revealed = false; 1375 this._revealed = false;
1361 return false; 1376 return false;
1362 } 1377 }
1363 1378
1364 currentAncestor = currentAncestor.parent; 1379 currentAncestor = currentAncestor.parent();
1365 } 1380 }
1366 1381
1367 this._revealed = true; 1382 this._revealed = true;
1368 return true; 1383 return true;
1369 } 1384 }
1370 1385
1371 /** 1386 /**
1372 * @param {boolean} x 1387 * @param {boolean} x
1373 */ 1388 */
1374 set revealed(x) { 1389 set revealed(x) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 this._element.classList.toggle('parent', this._hasChildren); 1466 this._element.classList.toggle('parent', this._hasChildren);
1452 this._element.classList.toggle('expanded', this._hasChildren && this.expande d); 1467 this._element.classList.toggle('expanded', this._hasChildren && this.expande d);
1453 } 1468 }
1454 1469
1455 /** 1470 /**
1456 * @return {number} 1471 * @return {number}
1457 */ 1472 */
1458 get depth() { 1473 get depth() {
1459 if (this._depth !== undefined) 1474 if (this._depth !== undefined)
1460 return this._depth; 1475 return this._depth;
1461 if (this.parent && !this.parent._isRoot) 1476 if (this.parent() && !this.parent()._isRoot)
1462 this._depth = this.parent.depth + 1; 1477 this._depth = this.parent().depth + 1;
1463 else 1478 else
1464 this._depth = 0; 1479 this._depth = 0;
1465 return this._depth; 1480 return this._depth;
1466 } 1481 }
1467 1482
1468 /** 1483 /**
1469 * @return {number} 1484 * @return {number}
1470 */ 1485 */
1471 get leftPadding() { 1486 get leftPadding() {
1472 return this.depth * this.dataGrid.indentWidth; 1487 return this.depth * this.dataGrid.indentWidth;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 this.insertChild(child, this.children.length); 1611 this.insertChild(child, this.children.length);
1597 } 1612 }
1598 1613
1599 /** 1614 /**
1600 * @param {!NODE_TYPE} child 1615 * @param {!NODE_TYPE} child
1601 * @param {number} index 1616 * @param {number} index
1602 */ 1617 */
1603 insertChild(child, index) { 1618 insertChild(child, index) {
1604 if (!child) 1619 if (!child)
1605 throw 'insertChild: Node can\'t be undefined or null.'; 1620 throw 'insertChild: Node can\'t be undefined or null.';
1606 if (child.parent === this) { 1621 if (child.parent() === this) {
1607 var currentIndex = this.children.indexOf(child); 1622 var currentIndex = this.children.indexOf(child);
1608 if (currentIndex < 0) 1623 if (currentIndex < 0)
1609 console.assert(false, 'Inconsistent DataGrid state'); 1624 console.assert(false, 'Inconsistent DataGrid state');
1610 if (currentIndex === index) 1625 if (currentIndex === index)
1611 return; 1626 return;
1612 if (currentIndex < index) 1627 if (currentIndex < index)
1613 --index; 1628 --index;
1614 } 1629 }
1615 1630
1616 child.remove(); 1631 child.remove();
1617 1632
1618 this.children.splice(index, 0, child); 1633 this.children.splice(index, 0, child);
1619 this.setHasChildren(true); 1634 this.setHasChildren(true);
1620 1635
1621 child.parent = this; 1636 child.setParent(this);
1622 child.dataGrid = this.dataGrid; 1637 child.dataGrid = this.dataGrid;
1623 child.recalculateSiblings(index); 1638 child.recalculateSiblings(index);
1624 1639
1625 child._depth = undefined; 1640 child._depth = undefined;
luoe 2017/03/06 16:56:40 No longer need this since setParent deletes it?
1626 child._revealed = undefined; 1641 child._revealed = undefined;
1627 child._attached = false; 1642 child._attached = false;
1628 child._shouldRefreshChildren = true; 1643 child._shouldRefreshChildren = true;
1629 1644
1630 var current = child.children[0]; 1645 var current = child.children[0];
1631 while (current) { 1646 while (current) {
1632 current.dataGrid = this.dataGrid; 1647 current.dataGrid = this.dataGrid;
1633 current._depth = undefined; 1648 current._depth = undefined;
1634 current._revealed = undefined; 1649 current._revealed = undefined;
1635 current._attached = false; 1650 current._attached = false;
1636 current._shouldRefreshChildren = true; 1651 current._shouldRefreshChildren = true;
1637 current = current.traverseNextNode(false, child, true); 1652 current = current.traverseNextNode(false, child, true);
1638 } 1653 }
1639 1654
1640 if (this.expanded) 1655 if (this.expanded)
1641 child._attach(); 1656 child._attach();
1642 if (!this.revealed) 1657 if (!this.revealed)
1643 child.revealed = false; 1658 child.revealed = false;
1644 } 1659 }
1645 1660
1646 remove() { 1661 remove() {
1647 if (this.parent) 1662 if (this.parent())
1648 this.parent.removeChild(this); 1663 this.parent().removeChild(this);
1649 } 1664 }
1650 1665
1651 /** 1666 /**
1652 * @param {!NODE_TYPE} child 1667 * @param {!NODE_TYPE} child
1653 */ 1668 */
1654 removeChild(child) { 1669 removeChild(child) {
1655 if (!child) 1670 if (!child)
1656 throw 'removeChild: Node can\'t be undefined or null.'; 1671 throw 'removeChild: Node can\'t be undefined or null.';
1657 if (child.parent !== this) 1672 if (child.parent() !== this)
1658 throw 'removeChild: Node is not a child of this node.'; 1673 throw 'removeChild: Node is not a child of this node.';
1659 1674
1660 if (this.dataGrid) 1675 if (this.dataGrid)
1661 this.dataGrid.updateSelectionBeforeRemoval(child, false); 1676 this.dataGrid.updateSelectionBeforeRemoval(child, false);
1662 child._detach(); 1677 child._detach();
1663 1678
1664 this.children.remove(child, true); 1679 this.children.remove(child, true);
1665 1680
1666 if (child.previousSibling) 1681 if (child.previousSibling)
1667 child.previousSibling.nextSibling = child.nextSibling; 1682 child.previousSibling.nextSibling = child.nextSibling;
1668 if (child.nextSibling) 1683 if (child.nextSibling)
1669 child.nextSibling.previousSibling = child.previousSibling; 1684 child.nextSibling.previousSibling = child.previousSibling;
1670 1685
1671 child.dataGrid = null; 1686 child.dataGrid = null;
1672 child.parent = null; 1687 child.setParent(null);
1673 child.nextSibling = null; 1688 child.nextSibling = null;
1674 child.previousSibling = null; 1689 child.previousSibling = null;
1675 1690
1676 if (this.children.length <= 0) 1691 if (this.children.length <= 0)
1677 this.setHasChildren(false); 1692 this.setHasChildren(false);
1678 } 1693 }
1679 1694
1680 removeChildren() { 1695 removeChildren() {
1681 if (this.dataGrid) 1696 if (this.dataGrid)
1682 this.dataGrid.updateSelectionBeforeRemoval(this, true); 1697 this.dataGrid.updateSelectionBeforeRemoval(this, true);
1683 for (var i = 0; i < this.children.length; ++i) { 1698 for (var i = 0; i < this.children.length; ++i) {
1684 var child = this.children[i]; 1699 var child = this.children[i];
1685 child._detach(); 1700 child._detach();
1686 child.dataGrid = null; 1701 child.dataGrid = null;
1687 child.parent = null; 1702 child.setParent(null);
1688 child.nextSibling = null; 1703 child.nextSibling = null;
1689 child.previousSibling = null; 1704 child.previousSibling = null;
1690 } 1705 }
1691 1706
1692 this.children = []; 1707 this.children = [];
1693 this.setHasChildren(false); 1708 this.setHasChildren(false);
1694 } 1709 }
1695 1710
1696 /** 1711 /**
1697 * @param {number} myIndex 1712 * @param {number} myIndex
1698 */ 1713 */
1699 recalculateSiblings(myIndex) { 1714 recalculateSiblings(myIndex) {
1700 if (!this.parent) 1715 if (!this.parent())
1701 return; 1716 return;
1702 1717
1703 var previousChild = this.parent.children[myIndex - 1] || null; 1718 var previousChild = this.parent().children[myIndex - 1] || null;
1704 if (previousChild) 1719 if (previousChild)
1705 previousChild.nextSibling = this; 1720 previousChild.nextSibling = this;
1706 this.previousSibling = previousChild; 1721 this.previousSibling = previousChild;
1707 1722
1708 var nextChild = this.parent.children[myIndex + 1] || null; 1723 var nextChild = this.parent().children[myIndex + 1] || null;
1709 if (nextChild) 1724 if (nextChild)
1710 nextChild.previousSibling = this; 1725 nextChild.previousSibling = this;
1711 this.nextSibling = nextChild; 1726 this.nextSibling = nextChild;
1712 } 1727 }
1713 1728
1714 collapse() { 1729 collapse() {
1715 if (this._isRoot) 1730 if (this._isRoot)
1716 return; 1731 return;
1717 if (this._element) 1732 if (this._element)
1718 this._element.classList.remove('expanded'); 1733 this._element.classList.remove('expanded');
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 var item = this; 1789 var item = this;
1775 while (item) { 1790 while (item) {
1776 item.expand(); 1791 item.expand();
1777 item = item.traverseNextNode(false, this); 1792 item = item.traverseNextNode(false, this);
1778 } 1793 }
1779 } 1794 }
1780 1795
1781 reveal() { 1796 reveal() {
1782 if (this._isRoot) 1797 if (this._isRoot)
1783 return; 1798 return;
1784 var currentAncestor = this.parent; 1799 var currentAncestor = this.parent();
1785 while (currentAncestor && !currentAncestor._isRoot) { 1800 while (currentAncestor && !currentAncestor._isRoot) {
1786 if (!currentAncestor.expanded) 1801 if (!currentAncestor.expanded)
1787 currentAncestor.expand(); 1802 currentAncestor.expand();
1788 currentAncestor = currentAncestor.parent; 1803 currentAncestor = currentAncestor.parent();
1789 } 1804 }
1790 1805
1791 this.element().scrollIntoViewIfNeeded(false); 1806 this.element().scrollIntoViewIfNeeded(false);
1792 } 1807 }
1793 1808
1794 /** 1809 /**
1795 * @param {boolean=} supressSelectedEvent 1810 * @param {boolean=} supressSelectedEvent
1796 */ 1811 */
1797 select(supressSelectedEvent) { 1812 select(supressSelectedEvent) {
1798 if (!this.dataGrid || !this.selectable || this.selected) 1813 if (!this.dataGrid || !this.selectable || this.selected)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 1873
1859 if (this === stayWithin) 1874 if (this === stayWithin)
1860 return null; 1875 return null;
1861 1876
1862 node = (!skipHidden || this.revealed) ? this.nextSibling : null; 1877 node = (!skipHidden || this.revealed) ? this.nextSibling : null;
1863 if (node) 1878 if (node)
1864 return node; 1879 return node;
1865 1880
1866 node = this; 1881 node = this;
1867 while (node && !node._isRoot && !((!skipHidden || node.revealed) ? node.next Sibling : null) && 1882 while (node && !node._isRoot && !((!skipHidden || node.revealed) ? node.next Sibling : null) &&
1868 node.parent !== stayWithin) { 1883 node.parent() !== stayWithin) {
1869 if (info) 1884 if (info)
1870 info.depthChange -= 1; 1885 info.depthChange -= 1;
1871 node = node.parent; 1886 node = node.parent();
1872 } 1887 }
1873 1888
1874 if (!node) 1889 if (!node)
1875 return null; 1890 return null;
1876 1891
1877 return (!skipHidden || node.revealed) ? node.nextSibling : null; 1892 return (!skipHidden || node.revealed) ? node.nextSibling : null;
1878 } 1893 }
1879 1894
1880 /** 1895 /**
1881 * @param {boolean} skipHidden 1896 * @param {boolean} skipHidden
1882 * @param {boolean=} dontPopulate 1897 * @param {boolean=} dontPopulate
1883 * @return {?NODE_TYPE} 1898 * @return {?NODE_TYPE}
1884 */ 1899 */
1885 traversePreviousNode(skipHidden, dontPopulate) { 1900 traversePreviousNode(skipHidden, dontPopulate) {
1886 var node = (!skipHidden || this.revealed) ? this.previousSibling : null; 1901 var node = (!skipHidden || this.revealed) ? this.previousSibling : null;
1887 if (!dontPopulate && node && node._hasChildren) 1902 if (!dontPopulate && node && node._hasChildren)
1888 node.populate(); 1903 node.populate();
1889 1904
1890 while (node && 1905 while (node &&
1891 ((!skipHidden || (node.revealed && node.expanded)) ? node.children[no de.children.length - 1] : null)) { 1906 ((!skipHidden || (node.revealed && node.expanded)) ? node.children[no de.children.length - 1] : null)) {
1892 if (!dontPopulate && node._hasChildren) 1907 if (!dontPopulate && node._hasChildren)
1893 node.populate(); 1908 node.populate();
1894 node = ((!skipHidden || (node.revealed && node.expanded)) ? node.children[ node.children.length - 1] : null); 1909 node = ((!skipHidden || (node.revealed && node.expanded)) ? node.children[ node.children.length - 1] : null);
1895 } 1910 }
1896 1911
1897 if (node) 1912 if (node)
1898 return node; 1913 return node;
1899 1914
1900 if (!this.parent || this.parent._isRoot) 1915 if (!this.parent() || this.parent()._isRoot)
1901 return null; 1916 return null;
1902 1917
1903 return this.parent; 1918 return this.parent();
1904 } 1919 }
1905 1920
1906 /** 1921 /**
1907 * @param {!Event} event 1922 * @param {!Event} event
1908 * @return {boolean} 1923 * @return {boolean}
1909 */ 1924 */
1910 isEventWithinDisclosureTriangle(event) { 1925 isEventWithinDisclosureTriangle(event) {
1911 if (!this._hasChildren) 1926 if (!this._hasChildren)
1912 return false; 1927 return false;
1913 var cell = event.target.enclosingNodeOrSelfWithNodeName('td'); 1928 var cell = event.target.enclosingNodeOrSelfWithNodeName('td');
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 this.wasDetached(); 1964 this.wasDetached();
1950 } 1965 }
1951 1966
1952 wasDetached() { 1967 wasDetached() {
1953 } 1968 }
1954 1969
1955 savePosition() { 1970 savePosition() {
1956 if (this._savedPosition) 1971 if (this._savedPosition)
1957 return; 1972 return;
1958 1973
1959 if (!this.parent) 1974 if (!this.parent())
1960 throw 'savePosition: Node must have a parent.'; 1975 throw 'savePosition: Node must have a parent.';
1961 this._savedPosition = {parent: this.parent, index: this.parent.children.inde xOf(this)}; 1976 this._savedPosition = {parent: this.parent(), index: this.parent().children. indexOf(this)};
1962 } 1977 }
1963 1978
1964 restorePosition() { 1979 restorePosition() {
1965 if (!this._savedPosition) 1980 if (!this._savedPosition)
1966 return; 1981 return;
1967 1982
1968 if (this.parent !== this._savedPosition.parent) 1983 if (this.parent() !== this._savedPosition.parent())
1969 this._savedPosition.parent.insertChild(this, this._savedPosition.index); 1984 this._savedPosition.parent().insertChild(this, this._savedPosition.index);
1970 1985
1971 this._savedPosition = null; 1986 this._savedPosition = null;
1972 } 1987 }
1973 }; 1988 };
1974 1989
1975 /** 1990 /**
1976 * @unrestricted 1991 * @unrestricted
1977 * @extends {DataGrid.DataGridNode<!NODE_TYPE>} 1992 * @extends {DataGrid.DataGridNode<!NODE_TYPE>}
1978 * @template NODE_TYPE 1993 * @template NODE_TYPE
1979 */ 1994 */
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 /** 2049 /**
2035 * @override 2050 * @override
2036 */ 2051 */
2037 detachChildWidgets() { 2052 detachChildWidgets() {
2038 super.detachChildWidgets(); 2053 super.detachChildWidgets();
2039 for (var dataGrid of this._dataGrids) 2054 for (var dataGrid of this._dataGrids)
2040 this.element.removeChild(dataGrid.element); 2055 this.element.removeChild(dataGrid.element);
2041 this._dataGrids = []; 2056 this._dataGrids = [];
2042 } 2057 }
2043 }; 2058 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698