OLD | NEW |
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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 /** | 26 /** |
27 * @constructor | 27 * @constructor |
28 * @extends {TreeElement} | 28 * @extends {TreeElement} |
| 29 * @param {string} title |
29 */ | 30 */ |
30 WebInspector.SidebarSectionTreeElement = function(title, hasChildren) | 31 WebInspector.SidebarSectionTreeElement = function(title) |
31 { | 32 { |
32 TreeElement.call(this, title.escapeHTML(), hasChildren); | 33 TreeElement.call(this, title.escapeHTML(), true); |
33 this.expand(); | 34 this.expand(); |
34 } | 35 } |
35 | 36 |
36 WebInspector.SidebarSectionTreeElement.prototype = { | 37 WebInspector.SidebarSectionTreeElement.prototype = { |
37 selectable: false, | 38 selectable: false, |
38 | 39 |
39 collapse: function() | 40 collapse: function() |
40 { | 41 { |
41 // Should not collapse as it is not selectable. | 42 // Should not collapse as it is not selectable. |
42 }, | 43 }, |
(...skipping 26 matching lines...) Expand all Loading... |
69 | 70 |
70 __proto__: TreeElement.prototype | 71 __proto__: TreeElement.prototype |
71 } | 72 } |
72 | 73 |
73 /** | 74 /** |
74 * @constructor | 75 * @constructor |
75 * @extends {TreeElement} | 76 * @extends {TreeElement} |
76 * @param {string} className | 77 * @param {string} className |
77 * @param {string} title | 78 * @param {string} title |
78 * @param {string=} subtitle | 79 * @param {string=} subtitle |
79 * @param {boolean=} hasChildren | 80 * @param {boolean=} expandable |
80 */ | 81 */ |
81 WebInspector.SidebarTreeElement = function(className, title, subtitle, hasChildr
en) | 82 WebInspector.SidebarTreeElement = function(className, title, subtitle, expandabl
e) |
82 { | 83 { |
83 TreeElement.call(this, "", hasChildren); | 84 TreeElement.call(this, "", expandable); |
84 | 85 |
85 if (hasChildren) | 86 if (expandable) |
86 this.disclosureButton = createElementWithClass("button", "disclosure-but
ton"); | 87 this.disclosureButton = createElementWithClass("button", "disclosure-but
ton"); |
87 | 88 |
88 this.iconElement = createElementWithClass("div", "icon"); | 89 this.iconElement = createElementWithClass("div", "icon"); |
89 this.statusElement = createElementWithClass("div", "status"); | 90 this.statusElement = createElementWithClass("div", "status"); |
90 this.titlesElement = createElementWithClass("div", "titles"); | 91 this.titlesElement = createElementWithClass("div", "titles"); |
91 | 92 |
92 this.titleContainer = this.titlesElement.createChild("span", "title-containe
r"); | 93 this.titleContainer = this.titlesElement.createChild("span", "title-containe
r"); |
93 this.titleElement = this.titleContainer.createChild("span", "title"); | 94 this.titleElement = this.titleContainer.createChild("span", "title"); |
94 | 95 |
95 this.subtitleElement = this.titlesElement.createChild("span", "subtitle"); | 96 this.subtitleElement = this.titlesElement.createChild("span", "subtitle"); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 onattach: function() | 169 onattach: function() |
169 { | 170 { |
170 this.listItemElement.classList.add("sidebar-tree-item"); | 171 this.listItemElement.classList.add("sidebar-tree-item"); |
171 | 172 |
172 if (this.className) | 173 if (this.className) |
173 this.listItemElement.classList.add(this.className); | 174 this.listItemElement.classList.add(this.className); |
174 | 175 |
175 if (this.small) | 176 if (this.small) |
176 this.listItemElement.classList.add("small"); | 177 this.listItemElement.classList.add("small"); |
177 | 178 |
178 if (this.hasChildren && this.disclosureButton) | 179 if (this.isExpandable() && this.disclosureButton) |
179 this.listItemElement.appendChild(this.disclosureButton); | 180 this.listItemElement.appendChild(this.disclosureButton); |
180 | 181 |
181 this.listItemElement.appendChildren(this.iconElement, this.statusElement
, this.titlesElement); | 182 this.listItemElement.appendChildren(this.iconElement, this.statusElement
, this.titlesElement); |
182 }, | 183 }, |
183 | 184 |
184 onreveal: function() | 185 onreveal: function() |
185 { | 186 { |
186 if (this.listItemElement) | 187 if (this.listItemElement) |
187 this.listItemElement.scrollIntoViewIfNeeded(false); | 188 this.listItemElement.scrollIntoViewIfNeeded(false); |
188 }, | 189 }, |
189 | 190 |
190 __proto__: TreeElement.prototype | 191 __proto__: TreeElement.prototype |
191 } | 192 } |
OLD | NEW |