| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * @constructor | 28 * @constructor |
| 29 * @extends {WebInspector.VBox} | 29 * @extends {WebInspector.VBox} |
| 30 */ | 30 */ |
| 31 WebInspector.UIList = function() | 31 WebInspector.UIList = function() |
| 32 { | 32 { |
| 33 WebInspector.VBox.call(this, true); | 33 WebInspector.VBox.call(this, true); |
| 34 this.registerRequiredCSS("sources/uiList.css"); | 34 this.registerRequiredCSS("sources/uiList.css"); |
| 35 | 35 |
| 36 /** @type {!Array.<!WebInspector.UIList.Item>} */ | 36 /** @type {!Array.<!WebInspector.UIList.Item>} */ |
| 37 this._items = []; | 37 this._items = []; |
| 38 } | 38 }; |
| 39 | 39 |
| 40 WebInspector.UIList._Key = Symbol("ownerList"); | 40 WebInspector.UIList._Key = Symbol("ownerList"); |
| 41 | 41 |
| 42 WebInspector.UIList.prototype = { | 42 WebInspector.UIList.prototype = { |
| 43 /** | 43 /** |
| 44 * @param {!WebInspector.UIList.Item} item | 44 * @param {!WebInspector.UIList.Item} item |
| 45 * @param {?WebInspector.UIList.Item=} beforeItem | 45 * @param {?WebInspector.UIList.Item=} beforeItem |
| 46 */ | 46 */ |
| 47 addItem: function(item, beforeItem) | 47 addItem: function(item, beforeItem) |
| 48 { | 48 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 item.element.remove(); | 66 item.element.remove(); |
| 67 }, | 67 }, |
| 68 | 68 |
| 69 clear: function() | 69 clear: function() |
| 70 { | 70 { |
| 71 this.contentElement.removeChildren(); | 71 this.contentElement.removeChildren(); |
| 72 this._items = []; | 72 this._items = []; |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 __proto__: WebInspector.VBox.prototype | 75 __proto__: WebInspector.VBox.prototype |
| 76 } | 76 }; |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * @constructor | 79 * @constructor |
| 80 * @param {string} title | 80 * @param {string} title |
| 81 * @param {string} subtitle | 81 * @param {string} subtitle |
| 82 * @param {boolean=} isLabel | 82 * @param {boolean=} isLabel |
| 83 */ | 83 */ |
| 84 WebInspector.UIList.Item = function(title, subtitle, isLabel) | 84 WebInspector.UIList.Item = function(title, subtitle, isLabel) |
| 85 { | 85 { |
| 86 this.element = createElementWithClass("div", "list-item"); | 86 this.element = createElementWithClass("div", "list-item"); |
| 87 if (isLabel) | 87 if (isLabel) |
| 88 this.element.classList.add("label"); | 88 this.element.classList.add("label"); |
| 89 | 89 |
| 90 this.titleElement = this.element.createChild("div", "title"); | 90 this.titleElement = this.element.createChild("div", "title"); |
| 91 this.subtitleElement = this.element.createChild("div", "subtitle"); | 91 this.subtitleElement = this.element.createChild("div", "subtitle"); |
| 92 | 92 |
| 93 this._hidden = false; | 93 this._hidden = false; |
| 94 this._isLabel = !!isLabel; | 94 this._isLabel = !!isLabel; |
| 95 this.setTitle(title); | 95 this.setTitle(title); |
| 96 this.setSubtitle(subtitle); | 96 this.setSubtitle(subtitle); |
| 97 this.setSelected(false); | 97 this.setSelected(false); |
| 98 } | 98 }; |
| 99 | 99 |
| 100 WebInspector.UIList.Item.prototype = { | 100 WebInspector.UIList.Item.prototype = { |
| 101 /** | 101 /** |
| 102 * @return {?WebInspector.UIList.Item} | 102 * @return {?WebInspector.UIList.Item} |
| 103 */ | 103 */ |
| 104 nextSibling: function() | 104 nextSibling: function() |
| 105 { | 105 { |
| 106 var list = this[WebInspector.UIList._Key]; | 106 var list = this[WebInspector.UIList._Key]; |
| 107 var index = list._items.indexOf(this); | 107 var index = list._items.indexOf(this); |
| 108 console.assert(index >= 0); | 108 console.assert(index >= 0); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 { | 226 { |
| 227 }, | 227 }, |
| 228 | 228 |
| 229 /** | 229 /** |
| 230 * @param {boolean} hoverable | 230 * @param {boolean} hoverable |
| 231 */ | 231 */ |
| 232 setHoverable: function(hoverable) | 232 setHoverable: function(hoverable) |
| 233 { | 233 { |
| 234 this.element.classList.toggle("ignore-hover", !hoverable); | 234 this.element.classList.toggle("ignore-hover", !hoverable); |
| 235 }, | 235 }, |
| 236 } | 236 }; |
| OLD | NEW |