| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview This extends cr.ui.List for use in the table. | 6 * @fileoverview This extends cr.ui.List for use in the table. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('cr.ui.table', function() { | 9 cr.define('cr.ui.table', function() { |
| 10 /** @const */ var List = cr.ui.List; | 10 /** @const */ var List = cr.ui.List; |
| 11 /** @const */ var ListItem = cr.ui.ListItem; | 11 /** @const */ var ListItem = cr.ui.ListItem; |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Creates a new table list element. | 14 * Creates a new table list element. |
| 15 * @param {Object=} opt_propertyBag Optional properties. | 15 * @param {Object=} opt_propertyBag Optional properties. |
| 16 * @constructor | 16 * @constructor |
| 17 * @extends {cr.ui.List} | 17 * @extends {cr.ui.List} |
| 18 */ | 18 */ |
| 19 var TableList = cr.ui.define('list'); | 19 var TableList = cr.ui.define('list'); |
| 20 | 20 |
| 21 TableList.prototype = { | 21 TableList.prototype = { |
| 22 __proto__: List.prototype, | 22 __proto__: List.prototype, |
| 23 | 23 |
| 24 table_: null, | 24 table_: null, |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Initializes the element. | 27 * Initializes the element. |
| 28 */ | 28 */ |
| 29 decorate: function() { | 29 decorate: function() { |
| 30 List.prototype.decorate.apply(this); | 30 List.prototype.decorate.apply(this); |
| 31 this.className = 'list'; | 31 this.className = 'list'; |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Resizes columns. Called when column width changed. | 35 * Resizes columns. Called when column width changed. |
| 36 */ | 36 */ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Returns the height of after filler in the list. | 78 * Returns the height of after filler in the list. |
| 79 * @param {number} lastIndex The index of item past the last in viewport. | 79 * @param {number} lastIndex The index of item past the last in viewport. |
| 80 * @return {number} The height of after filler. | 80 * @return {number} The height of after filler. |
| 81 * @override | 81 * @override |
| 82 */ | 82 */ |
| 83 getAfterFillerHeight: function(lastIndex) { | 83 getAfterFillerHeight: function(lastIndex) { |
| 84 // If the list is empty set height to 1 to show horizontal | 84 // If the list is empty set height to 1 to show horizontal |
| 85 // scroll bar. | 85 // scroll bar. |
| 86 return lastIndex == 0 ? 1 : | 86 return lastIndex == 0 ? |
| 87 1 : |
| 87 cr.ui.List.prototype.getAfterFillerHeight.call(this, lastIndex); | 88 cr.ui.List.prototype.getAfterFillerHeight.call(this, lastIndex); |
| 88 }, | 89 }, |
| 89 | 90 |
| 90 /** | 91 /** |
| 91 * Shows or hides vertical and horizontal scroll bars in the list. | 92 * Shows or hides vertical and horizontal scroll bars in the list. |
| 92 * @return {boolean} True if horizontal scroll bar changed. | 93 * @return {boolean} True if horizontal scroll bar changed. |
| 93 */ | 94 */ |
| 94 updateScrollbars_: function() { | 95 updateScrollbars_: function() { |
| 95 var cm = this.table.columnModel; | 96 var cm = this.table.columnModel; |
| 96 var style = this.style; | 97 var style = this.style; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return false; | 209 return false; |
| 209 }, | 210 }, |
| 210 }; | 211 }; |
| 211 | 212 |
| 212 /** | 213 /** |
| 213 * The table associated with the list. | 214 * The table associated with the list. |
| 214 * @type {cr.ui.Table} | 215 * @type {cr.ui.Table} |
| 215 */ | 216 */ |
| 216 cr.defineProperty(TableList, 'table'); | 217 cr.defineProperty(TableList, 'table'); |
| 217 | 218 |
| 218 return { | 219 return {TableList: TableList}; |
| 219 TableList: TableList | |
| 220 }; | |
| 221 }); | 220 }); |
| OLD | NEW |