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 // require: array_data_model.js | 5 // require: array_data_model.js |
6 // require: list_selection_model.js | 6 // require: list_selection_model.js |
7 // require: list_selection_controller.js | 7 // require: list_selection_controller.js |
8 // require: list_item.js | 8 // require: list_item.js |
9 | 9 |
10 /** | 10 /** |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 /** | 79 /** |
80 * Whether or not the list view has a blank space below the last row. | 80 * Whether or not the list view has a blank space below the last row. |
81 * @type {boolean} | 81 * @type {boolean} |
82 * @private | 82 * @private |
83 */ | 83 */ |
84 remainingSpace_: true, | 84 remainingSpace_: true, |
85 | 85 |
86 /** | 86 /** |
87 * Function used to create grid items. | 87 * Function used to create grid items. |
88 * @type {function(new:cr.ui.ListItem, Object)} | 88 * @type {function(new:cr.ui.ListItem, *)} |
89 * @private | 89 * @private |
90 */ | 90 */ |
91 itemConstructor_: cr.ui.ListItem, | 91 itemConstructor_: cr.ui.ListItem, |
92 | 92 |
93 /** | 93 /** |
94 * Function used to create grid items. | 94 * Function used to create grid items. |
95 * @return {function(new:cr.ui.ListItem, Object)} | 95 * @return {function(new:cr.ui.ListItem, Object)} |
96 */ | 96 */ |
97 get itemConstructor() { | 97 get itemConstructor() { |
98 return this.itemConstructor_; | 98 return this.itemConstructor_; |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 getIndexOfListItem: function(item) { | 789 getIndexOfListItem: function(item) { |
790 var index = item.listIndex; | 790 var index = item.listIndex; |
791 if (this.cachedItems_[index] == item) { | 791 if (this.cachedItems_[index] == item) { |
792 return index; | 792 return index; |
793 } | 793 } |
794 return -1; | 794 return -1; |
795 }, | 795 }, |
796 | 796 |
797 /** | 797 /** |
798 * Creates a new list item. | 798 * Creates a new list item. |
799 * @param {Object} value The value to use for the item. | 799 * @param {*} value The value to use for the item. |
800 * @return {!ListItem} The newly created list item. | 800 * @return {!ListItem} The newly created list item. |
801 */ | 801 */ |
802 createItem: function(value) { | 802 createItem: function(value) { |
803 var item = new this.itemConstructor_(value); | 803 var item = new this.itemConstructor_(value); |
804 item.label = value; | 804 item.label = value; |
805 item.id = this.uniqueIdPrefix_ + '-' + this.nextUniqueIdSuffix_++; | 805 item.id = this.uniqueIdPrefix_ + '-' + this.nextUniqueIdSuffix_++; |
806 if (typeof item.decorate == 'function') | 806 if (typeof item.decorate == 'function') |
807 item.decorate(); | 807 item.decorate(); |
808 return item; | 808 return item; |
809 }, | 809 }, |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 if (element.tabIndex >= 0 && !element.disabled) | 1339 if (element.tabIndex >= 0 && !element.disabled) |
1340 return true; | 1340 return true; |
1341 } | 1341 } |
1342 return false; | 1342 return false; |
1343 } | 1343 } |
1344 | 1344 |
1345 return { | 1345 return { |
1346 List: List | 1346 List: List |
1347 }; | 1347 }; |
1348 }); | 1348 }); |
OLD | NEW |