| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 UI.ListWidget = class extends UI.VBox { | 7 UI.ListWidget = class extends UI.VBox { |
| 8 /** | 8 /** |
| 9 * @param {!UI.ListWidget.Delegate} delegate | 9 * @param {!UI.ListWidget.Delegate} delegate |
| 10 */ | 10 */ |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 * @interface | 219 * @interface |
| 220 */ | 220 */ |
| 221 UI.ListWidget.Delegate = function() {}; | 221 UI.ListWidget.Delegate = function() {}; |
| 222 | 222 |
| 223 UI.ListWidget.Delegate.prototype = { | 223 UI.ListWidget.Delegate.prototype = { |
| 224 /** | 224 /** |
| 225 * @param {*} item | 225 * @param {*} item |
| 226 * @param {boolean} editable | 226 * @param {boolean} editable |
| 227 * @return {!Element} | 227 * @return {!Element} |
| 228 */ | 228 */ |
| 229 renderItem: function(item, editable) {}, | 229 renderItem(item, editable) {}, |
| 230 | 230 |
| 231 /** | 231 /** |
| 232 * @param {*} item | 232 * @param {*} item |
| 233 * @param {number} index | 233 * @param {number} index |
| 234 */ | 234 */ |
| 235 removeItemRequested: function(item, index) {}, | 235 removeItemRequested(item, index) {}, |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * @param {*} item | 238 * @param {*} item |
| 239 * @return {!UI.ListWidget.Editor} | 239 * @return {!UI.ListWidget.Editor} |
| 240 */ | 240 */ |
| 241 beginEdit: function(item) {}, | 241 beginEdit(item) {}, |
| 242 | 242 |
| 243 /** | 243 /** |
| 244 * @param {*} item | 244 * @param {*} item |
| 245 * @param {!UI.ListWidget.Editor} editor | 245 * @param {!UI.ListWidget.Editor} editor |
| 246 * @param {boolean} isNew | 246 * @param {boolean} isNew |
| 247 */ | 247 */ |
| 248 commitEdit: function(item, editor, isNew) {} | 248 commitEdit(item, editor, isNew) {} |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 /** | 251 /** |
| 252 * @unrestricted | 252 * @unrestricted |
| 253 */ | 253 */ |
| 254 UI.ListWidget.Editor = class { | 254 UI.ListWidget.Editor = class { |
| 255 constructor() { | 255 constructor() { |
| 256 this.element = createElementWithClass('div', 'editor-container'); | 256 this.element = createElementWithClass('div', 'editor-container'); |
| 257 this.element.addEventListener('keydown', onKeyDown.bind(null, isEscKey, this
._cancelClicked.bind(this)), false); | 257 this.element.addEventListener('keydown', onKeyDown.bind(null, isEscKey, this
._cancelClicked.bind(this)), false); |
| 258 this.element.addEventListener('keydown', onKeyDown.bind(null, isEnterKey, th
is._commitClicked.bind(this)), false); | 258 this.element.addEventListener('keydown', onKeyDown.bind(null, isEnterKey, th
is._commitClicked.bind(this)), false); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 _cancelClicked() { | 400 _cancelClicked() { |
| 401 var cancel = this._cancel; | 401 var cancel = this._cancel; |
| 402 this._commit = null; | 402 this._commit = null; |
| 403 this._cancel = null; | 403 this._cancel = null; |
| 404 this._item = null; | 404 this._item = null; |
| 405 this._index = -1; | 405 this._index = -1; |
| 406 cancel(); | 406 cancel(); |
| 407 } | 407 } |
| 408 }; | 408 }; |
| OLD | NEW |